Deactive Drawing

544
4
03-30-2011 03:47 AM
FaizanTayyab
Occasional Contributor
Hello All,

I have the following method on a widget that sets the map action and allow the user to draw on the map. This method is called once the widget is initialized.

private function activateSearchTool(value:String):void
   {
  // some code up here        setMapAction(value, status, searchDrawEnd);  
   }  


I have the map tools (zoomin,zoom out etc) in a seperate component;

private function PanMap(event:MouseEvent):void{
   navToolBar.activate(Navigation.PAN,true);
}

The problem is that after using the widget, if i select the pan tool it activates the pan functionality but it also draws on the map while panning. is there anyway to disable the drawing while panning but keeping the drawn (graphic Layer)


Any help appreciated.

Thanks
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Faizan,

   All you need to do is add this line to your searchDrawEnd function.

event.target.deactivate();
0 Kudos
RaymondBlack
New Contributor
Hi,

I have the opposite problem.  I use the 'old style' pan and zoom tools on a version 2.2 viewer.  I would like the drawing tools to remain active rather than deactivate at the end of each selection. Th eidea is that the user might want ot make multiple selections and having to repeatedly select the drawing tool is a bit frustrating. So I have removed the line of code suggested by Robert above (event.target.deactivate();) in my Drawend method.  However, this fix only works the first time the tool is used.  That is to say, I can make as many selections as I like without the tool deactivating, once the tool is open for the firts time in a session, but as soon as I close it and select another tool (pan, zoom etc), my drawing widget reverts to deactivating after a single selection.  Any ideas?  This behaviour is really baffling!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ray,

  You can look in MapManager.mxml and see that choosing a navigation tool automatically disables the drawing tool. Look at changeNavigation function.
0 Kudos
RaymondBlack
New Contributor
Thanks Robert,

That got me looking in the right direction.

++ Ray
0 Kudos