Hello every superiors:
Now I have a question to consult.
code A :
var measureLengthToolbar = new esri.toolbars.Draw(map);
measureLengthToolbar.activate(esri.toolbars.Draw.POLYLINE);
I know the end of the event is
code B:
dojo.connect(measureLengthToolbar, "onDrawEnd", function(geometry) {
.....
}
this is the double click event .
when I draw the line of center ,I need single click, because I need to deal songthing when single click ,how can I draw the code like code B,thanks very much.
Solved! Go to Solution.
You could create a variable to check if the draw toolbar is active:
var isDrawing = false;
When you activate the draw toolbar update this variable to true:
tb.activate(tool);
isDrawing = true;
When you deactivate the draw toolbar update this variable to false:
tb.deactivate();
isDrawing = false;
Now you can use the map click event:
map.on("click", function(evt){
// Check if user is drawing
if (isDrawing) {
// Add your code here...
}
});
I have created a working example on JS Bin: Draw Toolbar - map click event
The example prints information to the console log:
Hope this helps,
Owen
Spatial XP
You could create a variable to check if the draw toolbar is active:
var isDrawing = false;
When you activate the draw toolbar update this variable to true:
tb.activate(tool);
isDrawing = true;
When you deactivate the draw toolbar update this variable to false:
tb.deactivate();
isDrawing = false;
Now you can use the map click event:
map.on("click", function(evt){
// Check if user is drawing
if (isDrawing) {
// Add your code here...
}
});
I have created a working example on JS Bin: Draw Toolbar - map click event
The example prints information to the console log:
Hope this helps,
Owen
Spatial XP
Dear oearley:
Thanks very much, wish you happy every day.