AnsweredAssumed Answered

Draw toolbar cancel last vertex

Question asked by maiklas on Aug 2, 2013
Latest reply on Sep 30, 2014 by gcontino
Hello,

I need to cancel last vertex drawn using Draw toolbar with geometry types POLYGON or POLYLINE and do not interrupt drawing process (geometry should be redrawn).

I implemented it like this:

              
var dt = drawToolbar; // NOTE: from somewhere  
var points = dt._points;
if (points.length > 1) {
    var geom = dt._graphic.geometry;
    geom.removePoint(0, points.length - 1);
    points.splice(points.length - 1, 1);
    dt._graphic.setGeometry(geom);
                    
    var start = points[points.length - 1];
    var tempGeom = dt._tGraphic.geometry;
    tempGeom.setPoint(0, 0, start.offset(0, 0));
    tempGeom.setPoint(0, 1, start.offset(0, 0));
    dt._tGraphic.setGeometry(tempGeom);
} else {
    dt._points = [];
    dt._onMouseMoveHandler_connect.remove();
    dt._clear();
}


But as You can see, it uses private attributes. It would be nice, if ESRI would implement this functionality in later releases, because it's really useful, I think. Maybe someone has an idea how to avoid using privates?

Outcomes