Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 520408

Summary: A bug in GMF NodeFigure sometimes causes snapToGrid problem
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: julien.dupont
Version: 0.9Keywords: triaged
Target Milestone: 5.0.2   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/102543
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8dd7a071d3557e77bcb06a1585e9ad67aa95120d
Whiteboard:
Bug Depends on: 519305, 520409    
Bug Blocks:    

Description Laurent Redor CLA 2017-08-01 09:15:10 EDT
+++ This bug was initially created as a clone of Bug #519305 +++

When an edge is created with the snapToGrid enabled, it is sometimes not snaped to the grid. This is caused by a bug in NodeFigure where the getBounds() method is used to create the anchor and after, the getHandleBounds() is used to compute the corresponding location. The both methods do not return the same Rectangle. This explains the small shift that can be observed.

Steps to reproduce:
* Import the project "EdgeCreationPositionTest" (from "EdgeCreationPositionTest.zip")
* Open the diagram "Container"
* Activate the snapToGrid ("Ruler Units"=Pixels, and "Grid Spacing"=100)
* Activate the "Show Grid" option
* Enable the preference "Enable user specific default values" in Preferences/Sirius/Sirius Diagram/Connections" and set "Line style" to Rectilinear.
* Create an edge with the tool "Super" between "A" and "B" near the top grid line (y = 100).
* The edge is just above the grid line: KO it should be on the grid line.
Comment 1 Eclipse Genie CLA 2017-08-04 10:11:17 EDT
New Gerrit change created: https://git.eclipse.org/r/102543
Comment 3 Pierre-Charles David CLA 2017-09-11 10:07:49 EDT
Available in Sirius 5.0.2.