onMouseMove/onMouseOut events of GraphicLayer not called when a Draw tool is activated with "Draw.EXTENT" or "Draw.RECTANGLE" mode

1033
3
Jump to solution
11-07-2016 04:06 AM
ahuarte
New Contributor III

Hi, I have an issue in a widget. I found that "onMouseMove" or "onMouseOut" events of a GraphicLayer are not called when a Draw tool is activated with "Draw.EXTENT" or "Draw.RECTANGLE" modes. But, they work with "Draw.POINT" and "Draw.POLYGON" modes.

Sample code;

widget.selectingTool = new esri.toolbars.Draw(widget.map);

dojo.connect(widget.map.graphics, 'onMouseMove', function (evt) {

... bla bla
});
dojo.connect(widget.map.graphics, 'onMouseOut', function (evt) {
... bla bla

});

... bla bla

widget.selectingTool.activate(Draw.RECTANGLE);

Is it a bug?

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

a huarte,

   No that is by design. If you really need mouse move events when a Line, Polyline, Freehand Polyline,  Rectangle, Triangle, Circle, Ellipse or Freehand Polygon then you have to use the map.graphics.enableMouseEvents(); after you activate one of those draw tools.

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

a huarte,

   No that is by design. If you really need mouse move events when a Line, Polyline, Freehand Polyline,  Rectangle, Triangle, Circle, Ellipse or Freehand Polygon then you have to use the map.graphics.enableMouseEvents(); after you activate one of those draw tools.

0 Kudos
ahuarte
New Contributor III

Hi Robert, thank you very much! It works fine now.

But It seems only necessary for "Draw.Extent/Rectangle" mode.

Anyway, I always will activate it.

Alvaro

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Alvaro,

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

0 Kudos