-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
Replace mover tool by selector tool #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello and thank you very much for your contribution ! Selection would be a great feature to have ! But unfortunately, you would need to find a way to let the browser's engine compute the selected elements list. Otherwise, this will not scale beyond very small boards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I tested the changes, and made a few small changes. I am happy with how things are now. If you validate my changes, I'm ready to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes look good to me and everything works when I test it.
It's live on https://wbo.ophir.dev 👍 |
This PR replaces the mover tool (secondary for hand) with a selector tool. It enables the user to draw a box around
elements and move all the elements in the box together. Additionaly the old way of dragging elements by clicking directly on them
also works.
The PR checks if the bounding boxes of the elements are contained in the selection box. Because SVGElement.getBBox() does not include transformations I've added the necessary calculations in
client_data/js/intersect.js
. I am not sure if selection by intersecting bounding boxes would feel better but I am working to implement that too to test it out.Eventually it would be awesome if we could define shortcuts to act on the selection for copy/paste/cut but I haven't looked into that yet.
On the server side this adds handling batch messages going client->server, which until now only went server->client.
For now it simply duplicates the
handleMessage
because I didn't want to change the server code so much.The selector tool works well with #124.
Thank you for making this awesome tool!
By opening a pull request, I certify that I hold the intellectual property of the code I am submitting,
and I am granting the initial authors of WBO a perpetual, worldwide, non-exclusive, royalty-free, and irrevocable license to this code.