Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt-drag duplication makes snapping freeze the editor for seconds/minutes/hours #2017

Open
Keavon opened this issue Oct 1, 2024 · 2 comments
Labels
Bug Something isn't working Performance Speed and efficiency improvements Rust Involves Rust programming for the backend

Comments

@Keavon
Copy link
Member

Keavon commented Oct 1, 2024

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.

capture

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.

@Keavon Keavon added Bug Something isn't working Rust Involves Rust programming for the backend Performance Speed and efficiency improvements labels Oct 1, 2024
@0HyperCube
Copy link
Member

@Keavon this doesn't freeze the editor for hours unless you have millions of points.

@0HyperCube
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Performance Speed and efficiency improvements Rust Involves Rust programming for the backend
Projects
Status: Short-Term
Development

No branches or pull requests

3 participants
@Keavon @0HyperCube and others