Draw Toolbar Fill Symbol

425
1
04-24-2013 02:01 AM
RichardBetts
New Contributor
Hi everyone,

How can I get the draw toolbar to display what will become the final line section (between the first/last vertex and the cursor location) as the user is sketching a new polygon feature?
I'm basically looking for the same effect we get with the measurement widget.

Many Thanks.
0 Kudos
1 Reply
JohnGravois
Frequent Contributor
i took a look at the minified source code and it looks like we are wiring up a mouseMove event handler specific to polygons.  once the number of input points is greater than two, an additional path is added to the graphic geometry (connecting back to the first vertex).

_measureAreaMouseMoveHandler : function (evt) {
    var _36;
    //after the first vertex is created...
    if (this.inputPoints.length > 0) {
     var _37 = new _15(this._map.spatialReference);
     var _38;
     //snap if snapping is enabled
     if (this._map.snappingManager) {
      _38 = this._map.snappingManager._snappingPoint;
     }
     _36 = _38 || evt.mapPoint;
     //add a path between the first vertex and where the mouse is hovering
     _37.addPath([this._currentStartPt, _36]);
     var _39 = this._densifyGeometry(_37);
     //add the geometry to the graphic
     this.tempGraphic.setGeometry(_39);
    }
    //after two verticies have been created...
    if (this.inputPoints.length > 1) {
     var _3a = new _15(this._map.spatialReference);
     //add a path back to the first point
     _3a.addPath([_36, this.inputPoints[0]]);
     var _3b = this._densifyGeometry(_3a);
     //add the geometry to the graphic
     this.tempGraphic.setGeometry(this.tempGraphic.geometry.addPath(_3b.paths[0]));
    }
   },

since the draw toolbar itself doesn't already have an eventHandler to hook up to, you'd have to create your own.  to be perfectly honest, i have no idea how you could get a reference to the same kind of "temporary" graphic.
0 Kudos