All,
I've added in the Draw Toolbar to my project and need to disable the popups from the map when the toolbar is in use. I've tried the solution mentioned in this thread, but didn't have any luck. I've also tried using aspect.after, which is what I had to use to disable the popups when the Measurement tool is active. How do I go about disabling popups when the draw toolbar is active? Is there a way I can handle the popup issue for the measurement and draw tools within the same snippet of code?
Thanks in advance for your help!
Here's the code for my draw toolbar:
mapMain.on("load", initDrawTool); function initDrawTool() { drawToolbar = new Draw(mapMain, { drawTime: 25, tolerance: 4 }); drawToolbar.on("draw-end", addGraphic); on(dom.byId("info"), "click", function (evt) { if(evt.target.id === "info") { return; } var drawTool=evt.target.id.toLowerCase(); mapMain.disableMapNavigation(); drawToolbar.activate(drawTool); }); } function addGraphic(evt) { drawToolbar.deactivate(); mapMain.enableMapNavigation(); var symbol; if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") { symbol = drawMarker; } else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") { symbol = drawLine; } else { symbol = drawFill; } mapMain.graphics.add(new Graphic(evt.geometry, symbol)); }
Solved! Go to Solution.
Ashley,
Right before you activate the draw toolbar just call map.setInfoWindowOnClick(false);
on(dom.byId("info"), "click", function (evt) { if(evt.target.id === "info") { return; } var drawTool=evt.target.id.toLowerCase(); mapMain.disableMapNavigation(); map.setInfoWindowOnClick(false); drawToolbar.activate(drawTool); });
Can you also share the html part where the info node is.
<div id="info"> <button id="close" style="position:absolute; right: 3px; top: 3px">X</button> <button id="Point">Point</button> <button id="Multipoint">Multipoint</button> <button id="Line">Line</button> <button id="Polyline">Polyline</button> <button id="FreehandPolyline">Freehand Polyline</button> <button id="Triangle">Triangle</button> <button id="Extent">Rectangle</button> <button id="Circle">Circle</button> <button id="Ellipse">Ellipse</button> <button id="Polygon">Polygon</button> <button id="FreehandPolygon">Freehand Polygon</button> </div>
Ashley,
Right before you activate the draw toolbar just call map.setInfoWindowOnClick(false);
on(dom.byId("info"), "click", function (evt) { if(evt.target.id === "info") { return; } var drawTool=evt.target.id.toLowerCase(); mapMain.disableMapNavigation(); map.setInfoWindowOnClick(false); drawToolbar.activate(drawTool); });
Thanks Robert! I'd tried that call in multiple locations, but not there.