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: Allow binding only via linear element ends #7946

Merged
merged 20 commits into from
May 2, 2024

Conversation

mtolmacs
Copy link
Collaborator

@mtolmacs mtolmacs commented Apr 24, 2024

Change the behavior of binding to only allow connections if the start or end node of an arrow is dragged.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…visual bind suggestion

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Copy link

vercel bot commented Apr 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
excalidraw ✅ Ready (Inspect) Visit Preview May 2, 2024 6:22am
excalidraw-package-example ✅ Ready (Inspect) Visit Preview May 2, 2024 6:22am
excalidraw-package-example-with-nextjs ✅ Ready (Inspect) Visit Preview May 2, 2024 6:22am
1 Ignored Deployment
Name Status Preview Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview May 2, 2024 6:22am

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
@dwelle
Copy link
Member

dwelle commented Apr 24, 2024

Couple more notes:

  • there are a few cases where we should keep showing the suggested bindings, in particular (check production to see how it works in practice):

    • when moving bound arrow(s) with a keyboard
    • when resizing/rotating 3+ point bound arrows
    • ... maybe more?
  • previously the now removed maybeSuggestBindingForAll() function was bailing if we had more than 50 selected elements. I'd still keep doing this so we don't allocate large arrays on the hot path unnecessarily when calculating the suggested bindings.

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
dwelle added 2 commits May 1, 2024 23:40
(I think)
(complexity goes brrrr)
Copy link
Member

@dwelle dwelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(pushed two tiny commits.)

Ready to ship! 🔥

Initial implementation of the idea comes from excalidraw#6947

Co-authored-by: Sammy Lee <sammy.joe.lee@gmail.com>
isBindingEnabled(this.state)
? bindOrUnbindSelectedElements(selectedElements, this)
: unbindLinearElements(selectedElements, elementsMap);
bindOrUnbindLinearElements(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwelle @mtolmacs We will need to do something about the keyUp handler, as it triggers after each keyDown in our colour picker, command palette and now font picker, blocking the UI thread.

#8057

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants