Open Keavon opened 1 month ago
@Keavon this doesn't freeze the editor for hours unless you have millions of points.
If you don't want the snapping to be run, simply disable the snapping. This will alleviate your performance concerns.
The fact is that the snapping function tries to snap each point in the dragging path. Snapping each point requires some iteration in order to find where it snaps to.
Type a bunch of text with the text tool, like a sizable paragraph, across multiple lines. Hold Alt and drag with the Select tool, in order to duplicate the text layer. (I also tested this while holding Shift to constrain it to horizontal or vertical movement when duplicate-dragging, I'm not sure if that part is relevant.) This freezes the editor for many seconds or minutes.
As we can see, this originates in fn snap_drag. That function has a loop
for point in candidates
that calls fn constrained_snap. The code in here has several more layers of loops.