Select to view content in your preferred language

DrawTool Bug...?

538
1
06-12-2010 02:55 PM
RobertScheitlin__GISP
MVP Emeritus
I have run into an issue using the 2.0 API update 3 that I think is a BUG or just my lack of understanding.

    So here is the scenario. Using the DrawTool and ensuring that the map has the useHandCursor set to true. The LINE, FREEHAND_POLYLINE, FREEHAND_POLYGON, and EXTENT all return the mouse cursor to the hand once you finish drawing and the DrawTool is deactivated. The MAPPOINT, MULTIPOINT, POLYLINE and POLYGON all do not restore the hand cursor once the DrawTool is deactivated.

Here is the DrawToolSample from the sample page with the one little change of having the useHandCursor set to true on the map, that demonstrates this issue.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:esri="http://www.esri.com/2008/ags"
      pageTitle="Basic usage of DrawTool">
 
 <s:layout>
  <s:VerticalLayout paddingBottom="5"/>
 </s:layout>
 
 <fx:Style>
  @namespace mx "library://ns.adobe.com/flex/mx";  
  mx|ToolTip
  {
   font-size: 14;
  }
 </fx:Style>
 
 <fx:Script>
  <![CDATA[
   import spark.events.IndexChangeEvent;
   
   protected function bb_changeHandler(event:IndexChangeEvent):void
   {
    if (event.newIndex == -1)
    {
     drawTool.deactivate();
    }
    else
    {
     switch (bb.dataProvider.getItemAt(event.newIndex))
     {
      case "Point":
       drawTool.activate(DrawTool.MAPPOINT);
       break;
      case "Multipoint":
       drawTool.activate(DrawTool.MULTIPOINT);
       break;
      case "Single Line":
       drawTool.activate(DrawTool.LINE);
       break;
      case "Polyline":
       drawTool.activate(DrawTool.POLYLINE);
       break;
      case "FreeHand Polyline":
       drawTool.activate(DrawTool.FREEHAND_POLYLINE);
       break;
      case "Polygon":
       drawTool.activate(DrawTool.POLYGON);
       break;
      case "Freehand Polygon":
       drawTool.activate(DrawTool.FREEHAND_POLYGON);
       break;
      case "Rectangle":
       drawTool.activate(DrawTool.EXTENT);
       break;
     }
    }
   }
  ]]>
 </fx:Script>
 
 <fx:Declarations>
  <!-- Symbol for all point shapes -->
  <esri:SimpleMarkerSymbol id="sms"
         color="0x00FF00"
         size="12"
         style="square"/>
  
  <!-- Symbol for all line shapes -->
  <esri:SimpleLineSymbol id="sls"
          color="0x00FF00"
          width="3"/>
  
  <!-- Symbol for all polygon shapes -->
  <esri:SimpleFillSymbol id="sfs"
          color="0xFFFFFF"
          style="diagonalcross">
   <esri:outline>
    <esri:SimpleLineSymbol color="0x00FF00" width="2"/>
   </esri:outline>
  </esri:SimpleFillSymbol>
  
  <esri:DrawTool id="drawTool"
        fillSymbol="{sfs}"
        graphicsLayer="{myGraphicsLayer}"
        lineSymbol="{sls}"
        map="{myMap}"
        markerSymbol="{sms}"/>
 </fx:Declarations>
 
 <s:controlBarLayout>
  <s:HorizontalLayout horizontalAlign="center"
       paddingBottom="7"
       paddingTop="7"/>
 </s:controlBarLayout>
 <s:controlBarContent>
  <s:ButtonBar id="bb" change="bb_changeHandler(event)">
   <s:ArrayList>
    <fx:String>Point</fx:String>
    <fx:String>Multipoint</fx:String>
    <fx:String>Single Line</fx:String>
    <fx:String>Polyline</fx:String>
    <fx:String>FreeHand Polyline</fx:String>
    <fx:String>Polygon</fx:String>
    <fx:String>Freehand Polygon</fx:String>
    <fx:String>Rectangle</fx:String>
   </s:ArrayList>
  </s:ButtonBar>
 </s:controlBarContent>
 
 <esri:Map id="myMap" level="3" useHandCursor="true">
  <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
  <esri:GraphicsLayer id="myGraphicsLayer"/>
 </esri:Map>
 
 <s:Label text="The DrawTool can be used to draw new features which can then either be used as input for another task or saved as new features in a feature service (using the FeatureLayer.applyEdits)" width="100%"/>
 
</s:Application>
Tags (2)
0 Kudos
1 Reply
BjornSvensson
Esri Regular Contributor
That's a bug (that we didn't know about).  We'll try and fix it before the 2.0 release.

Thank you 🙂
0 Kudos