laptop and a wrench

Bug

The disableDoubleClickZoom function is overridden when using the Draw toolbar. When trying to implement the disableDoubleClickZoom function, it does not work for some tools from the Draw toolbar such as Multipoint, polyline and polygon.

Last Published: May 6, 2019 No Product Found
Bug ID Number NIM065568
SubmittedFebruary 28, 2011
Last ModifiedJune 5, 2024
Applies toNo Product Found
Version found2.1
StatusWill Not Be Addressed

Additional Information

There are no plans to address this issue for an unsupported version.

Workaround

If the line of code map.disableDoubleClickZoom(); is again in the code after the graphics are added, the DoubleClickZoom property remains false for all the tools in the Draw toolbar

Sample code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<meta name="viewport" content="width=device-width,user-scalable=no"/>

<!--The viewport meta tag is used to improve the presentation and behavior of the samples

on iOS devices-->

<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>

<title>Maps Toolbar</title>

<link rel="stylesheet" type="text/css" href="<a href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css" target="_blank">http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css</a>">

<style type="text/css">

html, body {

height: 100%; width: 100%; margin: 0; padding: 0;

}

</style>

<script type="text/javascript">

djConfig = {

parseOnLoad: true

}

</script>

<script type="text/javascript" src="<a href="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1" target="_blank">http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1</a>"></script>

<script type="text/javascript">

dojo.require("esri.map");

dojo.require("esri.toolbars.draw");

dojo.require("dijit.dijit"); // optimize: load dijit layer

dojo.require("dijit.layout.BorderContainer");

dojo.require("dijit.layout.ContentPane");

var map, toolbar, symbol, geomTask;

function init() {

var startExtent = new esri.geometry.Extent({"xmin":-11721159.665358918,"ymin":-1138850.8106919006,"xmax":8277212.918942982,"ymax":9858297.322750043,"spatialReference":{"wkid":102100}});

map = new esri.Map("map",{extent:startExtent});

dojo.connect(map, "onLoad", createToolbar);

var basemap = new esri.layers.ArcGISTiledMapServiceLayer("<a href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" target="_blank">http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer</a>");

map.addLayer(basemap);

}

function createToolbar(map) {

toolbar = new esri.toolbars.Draw(map);

dojo.connect(toolbar, "onDrawEnd", addToMap);

map.disableDoubleClickZoom();

alert("The value of property Double Click Zoom on map load is "+ map.isDoubleClickZoom);

}

function addToMap(geometry) {

toolbar.deactivate();

//alert("Using toolbar the value of Double click zoom now is "+ map.isDoubleClickZoom );

map.showZoomSlider();

switch (geometry.type) {

case "point":

var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25]));

break;

case "polyline":

var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 1);

break;

case "polygon":

var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));

break;

case "extent":

var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]));

break;

case "multipoint":

var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,0]), 1), new dojo.Color([255,255,0,0.5]));

break;

}

var graphic = new esri.Graphic(geometry, symbol);

map.graphics.add(graphic);

map.disableDoubleClickZoom();

alert("Using toolbar the value of Double click zoom now is "+ map.isDoubleClickZoom );

}

dojo.addOnLoad(init);

</script>

</head>

<body class="claro">

<div id="mainWindow" dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%; height:100%;">

<div id="header" dojotype="dijit.layout.ContentPane" region="top" style="height:70px;text-align:left;font-weight:bold;font-size:14px;color:#400D12;">

<span>Draw:<br /></span>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.POINT);map.hideZoomSlider();">Point</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.MULTI_POINT);map.hideZoomSlider();">Multipoint</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.LINE);map.hideZoomSlider();">Line</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.POLYLINE);map.hideZoomSlider();">Polyline</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.POLYGON);map.hideZoomSlider();">Polygon</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.FREEHAND_POLYLINE);map.hideZoomSlider();">Freehand Polyline</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.FREEHAND_POLYGON);map.hideZoomSlider();">Freehand Polygon</button>

<!--The Arrow,Triangle,Circle and Ellipse types all draw with the polygon symbol-->

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.ARROW);map.hideZoomSlider();">Arrow</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.TRIANGLE);map.hideZoomSlider();">Triangle</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.CIRCLE);map.hideZoomSlider();">Circle</button>

<button dojoType="dijit.form.Button" onClick="toolbar.activate(esri.toolbars.Draw.ELLIPSE);map.hideZoomSlider();">Ellipse</button>

</div>

<div id="map" dojoType="dijit.layout.ContentPane" style="border:solid 2px #587498;margin:5px;" region="center">

</div>

</div>

</body>

</html>

Steps to Reproduce

Bug ID: NIM065568

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options