I have a draw tool using the draw and edit toolbar classes. The idea is that the user can draw a shape on the map. There is a UI that allows the user to select the drawn shape from a list. There is a context menu to edit the shape. The problem is with rectangle.
If the user starts to draw a rectangle and drags down and to the right, everything is fine. The edit UI displays, showing the top left point of the rectangle and the bottom right. However, the user cannot edit the bottom right point, to a point that is north of the top left point with out buggy behavior. In fact, if the once bottom right point (now top right) is edited a second time, the rectangle turns into a line.
And, this rectangle to line issue can be replicated by drawing a rectangle upside down. If the user clicks and drags north east, to make the rectangle, the top left point ends up being the bottom left.
I hope I explained this well enough. I understand this to be all in how the expected clockwise creation of points of a shape? Is there anything I can do to make cleaner shapes so they can be edited?
Maybe if I asked this differently. In code I have:
The graphic object is passed to addGraphic.
To grab the top left point of a rectangle, I have this in code:
item.Geometry.Polygon.Rings = x; // top-left x
item.Geometry.Polygon.Rings = y; // top-left y
Since ,  is the x, y of the first point drawn (where the user first clicks the map) to begin drawing the rectangle, x, y is not always the top left point of the rectangle.
Is there a way to draw, or re-draw, a shape clockwise from the top left most point on the map (that doesn't interfere with the API)?
Maybe the best way is to not go by array position but geo-math?
Since you are working with it as a polygon have you tried to run a GeometryService simplify on it is the polygon.isclockwise(ring) is false?
rscheitlin, kind of weird... if I draw a rectangle while clicking and dragging to the NW, the isClockwise returns true. If I click and drag NE or SW, isClockwise returns false. If I click and drag SE or NW, isClockwise will return true.
So, it was a start, but I'm still a little stuck.
Oops, actually... that's just using the draw toolbar. GeometryService.simplify puts everything in clockwise as if it is redrawn? isClockwise is true for every way I draw it, and the ring's points are in different positions compared to the draw toolbar.
Is that a 3.20 thing? The ref says added in 3.13 but Google doesn't have any results for "geometryEngineAsync issimple 3.20", the ref has no samples and geometryEngineAsync.isSimple (in code) isn't a thing.
Did the link I provide not work for you? There really would not be any samples as this is such a simple method, just create the GeometryEngine class and then run the isSimple(geometry) method and it returns a boolean. GeometryEngineAsync is just another class that run async instead of synchronous.
The link worked, however, the isSimple method gives me: TypeError: Object doesn't support property or method 'isSimple' TypeError: Object doesn't support property or method 'isSimple'