eclipse-gmf-runtime / gmf-runtime

Eclipse GMF Runtime
https://projects.eclipse.org/projects/modeling.gmf-runtime
Eclipse Public License 2.0
5 stars 19 forks source link

[33] Increase the precision in edge segments computation #34

Closed lfasani closed 1 year ago

lfasani commented 1 year ago

Depending on the zoom, the bendpoints may slightly differ. While zooming, the precise point may pass from 50,999 to 51,001 and that imply that the PointList will contain 50 or 51.

One known consequence: With a rectilinear edge(horizontal or vertical segments), the vector used to display the edge label is expressed in an orthonormal frame that depends of the orientation of the segment that contains the anchor point. So if the anchor point is at the limit of two segments, when changing the zoom, the segment computation must not vary of one pixel otherwise the edge label is not displayed at the same location.

The fix changes how the bendpoints are computed. It leverages precise points to get a round value instead of casting into integer (which takes the nearest lower integer) The fix is related to Router classes but we could imagine to do the changes inside PointList class in methods setPoint(Point pt, int index) and addPoint(Point p). Nevertheless, the change in PointList is very impacting.

Bug: https://github.com/eclipse/gmf-runtime/issues/33