SketchEditor GeometryChanged events NewGeometry equals OldGeometry

190
3
Jump to solution
08-12-2018 11:03 PM
Highlighted
New Contributor II

The GeometryChanged event of the SketchEditor does sometimes return NewGeometry which equals OldGeometry even though that a point has been modifed using the editor.

Reproduction Steps:

  1. Start the SketchEditor with an already existing geometry as initial geometry and drawAndEdit == true.
  2. Select and move one point of the geometry.
    Expectation: GeometryChanged event gets raised and NewGeometry is different from OldGeometry.
    Observation: GeometryChanged event gets raised and NewGeometry equals OldGeometry (OldGeometry.IsEqual(NewGeometry) == true).

Adding a point, deleting a point or moving multiple points will return the correct NewGeometry.

When registering to the PropertyChanged event and filtering for Geometry property the provided value is what I'd expected to be returned as NewGeometry from the GeometryChanged event. So registering to the PropertyChanged event is currently used by me as a workaround.

1 Solution

Accepted Solutions
Highlighted
Frequent Contributor

Thank you for reporting this issue and offering us a workaround. It does appear GeometryChanged to be raised earlier with an old value for NewGeometry. I just logged the issue so we can work on getting this fixed in future releases of the API.

The Undo/Redo for change in vertex positions however, appear to be working. But if you need to know when/what Geometry has changed to, GeometryChangedEventArgs.NewGeometry only reflects the change when a new vertex is added or a vertex gets deleted.

May I ask what you're using SketchEditor.Geometry for? Would it be something where two-way binding to this property can be done or is it necessary to do in code-behind where you subscribe to PropertyChanged event? Thanks.

View solution in original post

3 Replies
Highlighted
Frequent Contributor

Thank you for reporting this issue and offering us a workaround. It does appear GeometryChanged to be raised earlier with an old value for NewGeometry. I just logged the issue so we can work on getting this fixed in future releases of the API.

The Undo/Redo for change in vertex positions however, appear to be working. But if you need to know when/what Geometry has changed to, GeometryChangedEventArgs.NewGeometry only reflects the change when a new vertex is added or a vertex gets deleted.

May I ask what you're using SketchEditor.Geometry for? Would it be something where two-way binding to this property can be done or is it necessary to do in code-behind where you subscribe to PropertyChanged event? Thanks.

View solution in original post

Highlighted
New Contributor II

Using two-way binding is not applicable as I'm using the event in the context of my question Exit condition for SketchEditor

Reply
0 Kudos
Highlighted
Occasional Contributor II

Using the SketchEditor as a measure tool, I experience the same. Adding new vertexes works, but if I move an existing point, e.NewGeometry holds OldGeometry. Moving the point again, I get the geometry I was supposed to get the previous time, and so on. I have a sample if needed

Reply
0 Kudos