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

Bug 520409

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: pierre.guilet
Version: 0.9Keywords: triaged
Target Milestone: 4.1.7   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/102540
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=a710d14893080e7cc5ebb2720b3ffac4ca7d0dd4
Whiteboard:
Bug Depends on: 519305    
Bug Blocks: 520408    
Attachments:
Description Flags
EdgeCreationPositionTest-Sirius4.1.7.zip
none
Acceleo version none

Description Laurent Redor CLA 2017-08-01 09:16:44 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 09:43:15 EDT
New Gerrit change created: https://git.eclipse.org/r/102540
Comment 3 Laurent Redor CLA 2017-10-31 06:06:17 EDT
Created attachment 271258 [details]
EdgeCreationPositionTest-Sirius4.1.7.zip
Comment 4 Pierre Guilet CLA 2017-10-31 10:19:51 EDT
Created attachment 271266 [details]
Acceleo version
Comment 5 Pierre-Charles David CLA 2017-11-14 05:30:11 EST
Available in Sirius 4.1.7, see https://wiki.eclipse.org/Sirius/4.1.7 for details.