mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-15 06:42:31 +00:00
Moving a circle so its edge point met another circle's point snapped at 200 % but missed at 100 %. A layer's point lies on its own edge line and centre row, so a vertical and a horizontal line through it tie with it, and the point only won that tie by 1e-9. Any other line a little nearer on one axis (the comp's centre row, a guide) then made a pair nearer than the point, taking x from the edge and y from that line and leaving the moved circle off the point. At 100 % the tolerance (8 screen points) covers more comp pixels and reaches those lines; zoomed in they were out of reach. Before #2855 a single nearer line was enough, which is how it was reported on 0.18.0. snap() now lets a line pair with a line through the point beat that point only when the pair is nearer by POINT_BIAS of the tolerance (2 of the 8 screen points at any zoom), in place of the exact tie. A pair whose lines both miss the point gets no margin, so a guide crossing right beside a layer's point stays reachable; two clearly nearer lines still win, as #2855 intended. Tests: two Ellipse-tool circles, parametric and converted to Bezier paths, at 1x, 2x and 4x on device scales 1, 1.25 and 1.5, dropped just off the point and nearer the comp's centre row than the circle's own row, with and without snapping to a guide between them: the moved point lands exactly on the other's, a single point hit (a path point for the Bezier circles). The margin: a pair through the point only a little nearer leaves the point, a clearly nearer one wins; a guide crossing 1 px beside a point is reached next to the crossing. Moving a layer snaps the feature nearest where it was grabbed, as before (the snap handle, as in After Effects): grab the circle near its edge point to snap that point; grabbed in the middle, its centre snaps. Fixes #2681