From c19106fd3408556d4362a5b04c25d962208b8dc6 Mon Sep 17 00:00:00 2001 From: fkloft Date: Sat, 16 May 2015 15:57:16 +0200 Subject: [PATCH] [draw-tools] set new color properly This change sets the new color on the cached options before passing them to the DrawControl. Otherwise, bookmark's auto-draw feature would use the wrong color --- plugins/draw-tools.user.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/draw-tools.user.js b/plugins/draw-tools.user.js index d0239406..d1a0d75c 100644 --- a/plugins/draw-tools.user.js +++ b/plugins/draw-tools.user.js @@ -92,12 +92,16 @@ window.plugin.drawTools.setOptions = function() { window.plugin.drawTools.setDrawColor = function(color) { window.plugin.drawTools.currentColor = color; window.plugin.drawTools.currentMarker = window.plugin.drawTools.getMarkerIcon(color); - - window.plugin.drawTools.drawControl.setDrawingOptions({ - 'polygon': { 'shapeOptions': { color: color } }, - 'polyline': { 'shapeOptions': { color: color } }, - 'circle': { 'shapeOptions': { color: color } }, - 'marker': { 'icon': window.plugin.drawTools.currentMarker }, + + window.plugin.drawTools.lineOptions.color = color; + window.plugin.drawTools.polygonOptions.color = color; + window.plugin.drawTools.markerOptions.icon = window.plugin.drawTools.currentMarker; + + plugin.drawTools.drawControl.setDrawingOptions({ + polygon: { shapeOptions: plugin.drawTools.polygonOptions }, + polyline: { shapeOptions: plugin.drawTools.lineOptions }, + circle: { shapeOptions: plugin.drawTools.polygonOptions }, + marker: { icon: plugin.drawTools.markerOptions.icon }, }); }