Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to draw a rectangle on the map using the DrawTool component. I want to start drawing directly after performing a Ctrl + MouseDown.

So in the map_mouseDownHandler function I put the following code:

    // Activate the drawTool

    // This one seems to be necessary in order to deactivate map pan            
    _context.mapRef.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_UP)); 


But this dosn't work correctly a 100%. After the loading of the map, and only after the loading, It's necessary to perform a Ctrl + MouseDown and then perform a second MouseDown to be able to draw. After this, a Ctrl + MouseDown suffises to start drawing.

Do you have any idea about where the problem could be?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.