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

feat: add selection tolerance #2210

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sidharth-Singh10
Copy link
Contributor

Closes #2141
Modified the check_layer function in the document_message_handler to add tolerance-based selection

issue2141.mp4

@Sidharth-Singh10 Sidharth-Singh10 marked this pull request as ready for review January 23, 2025 21:47
@Keavon
Copy link
Member

Keavon commented Jan 23, 2025

!build

Copy link

📦 Build Complete for 5d73c54
https://4ce6940d.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Jan 23, 2025

It looks like you're using the bounding box rather than actual proximity to the path. That causes paths like this (which have no Fill node) to be selectable from far too generous of a distance, because anywhere within its bounding box makes it accept the selection.

capture

Please note, we already have a logic for extending the selection to some slightler-larger-than-1.0 scale factor of the shape's stroke thickness. Notice how you can inflate the stroke and it becomes easy to select, even a bit beyond its stroke. I think the proper solution here is to discard your current approach and actually just modify that scale factor: use exactly 1.0 for large values (as measured in viewport space) and cap it to a minimum thickness for smaller values (as measured in viewport space) to ensure no line's click target becomes less thick than some minimum.

@Keavon Keavon marked this pull request as draft January 23, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Small click target when dragging/moving a straight line or small objects
2 participants