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

Bug 488359

Summary: Demonstrate snap-to-grid in MVC logo example.
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF MVCAssignee: Matthias Wienand <matthias.wienand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ctg, matthias.wienand
Version: 0.2.0   
Target Milestone: 4.0.0 (Neon) RC1   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Nyßen CLA 2016-02-24 02:42:33 EST
We should provide support for enabling/disabling the snap-to-grid behavior through a property on the MVC logo example canvas element (via the property sheet view), so the functionality can be demonstrated there.

This will also give us the opportunity to test the respective behavior thoroughly. We have to ensure that relocating and resizing of nodes as well as bending of connections (including anchor position computations) respect the snap-to-grid settings.
Comment 1 Matthias Wienand CLA 2016-03-18 06:36:09 EDT
I added an "isSnapToGrid" property to FXGeometricModel and created a property source for it. The FXGeometricModel needs to be selected when the selection is cleared so that its properties will be displayed in that case.
Comment 2 Matthias Wienand CLA 2016-05-06 11:31:14 EDT
I pushed the following changes to origin/master:

 - Display the properties of "FXGeometricModel" when the selection is unset (i.e. when nothing is selected).
 - Ensure changes to the "snap-to-grid" property are transferred over to the GridModel.
 - Remove snap-to-grid functionality from the transactional policies and add it to the interaction policies instead.
 - Make the snapping granularity configurable for subclasses.

Anchor computations do not need to perform snap-to-grid, because the interaction policies already constrain segment/bendpoint locations (which the anchor computation depends on) when snap-to-grid is enabled, so that the anchor positions will also be constrained accordingly.

Therefore, I resolve this ticket as fixed for 4.0.0 RC1.