Skip to content

Instantly share code, notes, and snippets.

@raykendo
raykendo / arcgis-jsapi-ondrawbegin.js
Last active August 29, 2015 14:21
ArcGIS-JSAPI: DrawingToolbar hack for onDrawBegin
/*
* Making up for a missing "draw-begin" or "draw-start" event for the ArcGIS JavaScript API Drawing toolbar
*
* Problem: While the drawing toolbar in the ArcGIS JavaScript API has a "draw-end" and a "draw-complete"
* event, it doesn't have a "draw-start" or "draw-begin" event.
*
* Solution: Use a dojo/on pausable event that is only unpaused after the draw-end event.
*/
require(["esri/map", "dojo/on", "esri/toolbars/draw"], function (Map, dojoOn, Draw) {
var map = new Map("mapdiv", {});
@raykendo
raykendo / ArcGIS-JSAPI-MapClickByQueryHack.md
Last active July 6, 2018 20:29
ArcGIS-JSAPI: Clicking on a webmap without clicking on a webmap

Clicking on a map without clicking on a map

An ArcGIS JavaScript API hack

Purpose: I have a map application with a list of results from a query. When I click on one of the items in the result list, I wanted the map to zoom to the associated feature, and trigger a click that shows the result in a popup.

Library: ArcGIS JavaScript API

Version: tested on versions 3.9-3.13.