Community
Participate
Working Groups
Currently, the behavior of SnapToGeometry is not really configurable : * What directions (vertical, horizontal) are allowed * what sides of the other figures are used to define the corrections * ... Moreover the class cannot be easily extended because of the "Entry" class with a protected constructor unusable outside SnapToGeometry.
Created attachment 59776 [details] An example of extensible SnapToGeometry The attached class defines a extensible SnapToGeometry where directions can be customized (horizontal, vertical) and snapped sides can be filtered
(Just to propose other use cases which I don't think the patch mentions or handles) In my own use of this class, I extended the class to provide the following customizations: 1) Change the location of the snapped edges. I wanted them offset from the actual figures (so that right and left snaps had a gap between them). 2) Change the "priority" of edges. I wanted LEFT to be the most important, then CENTER, RIGHT. And I plan on making further customizations to align objects using their baseline rather than their vertical middle. Baseline alignment would be highest priority for vertical snapping in my use case.