-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Feature: Multi Point Arrows #338
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/vjeux/excalidraw/lupi62niw |
Zwibbler (https://zwibbler.com/demo/) has this interesting UI interaction where if you mouse down and drag, it creates a single directional arrow. But if you click (at the beginning), then you can drag (without mouse down) to select the next point, and again... until you double click to confirm the arrow. It feels really well thought out and I think we should do something similar. |
They allow you to after the fact move the intermediate points, but honestly I've never used it, I would just recreate the arrow from scratch, so we should likely focus on the creation path for now. |
For the hit test, you can use this algorithm to find the closest point on the bezier curve ( https://stackoverflow.com/a/44993719/232122 ) and then you can just compute the distance between that point and the mouse to find when you have to consider it a hit. |
Any update? :) |
@vjeux I am sorry. I just got married and it has been couple of stressful days due to paperwork etc. I will get back into it tomorrow. |
Waaattt!!! Congratulations!!! This is awesome <3 |
Thank you😊😍 |
Does anyone know why this was changed?
I have merged master into this branch but I am still not sure about this part of the code. Are you not setting the width anymore? |
- Allow undoing parts of the arrow
For the last part, if we implement a matrix based scaler, this issue will be resolved. The resizer works a bit weird because there are a lot of additions happening. That's why it keeps moving down instead of staying in place (in reality it shouldn't move). |
It's not that it moves down (which we discussed previously and decided to leave the fix for future PR), but that it sometimes disappears completely (sometimes even well before it reaches and when you add another element: |
Okay, I found the issue but I can't figure out the problem. It is in |
Why do you exempt EDIT: it's not the issue though :/. |
This is a bit problematic approach but the best one that I come up with. The issue here is that when shape of the arrow does not exist (e.g during resizing we remove the shape for regeneration), I was using element position as a fallback value. Now, I am using I have tested it with different test cases and it seems to be working. If there is an issue, we can add a small threshold to make bounds similar to roughjs curve. Additionally, once we implement matrix based scaling, I think this issue will be resolved because we won't be regenerating these shapes every time. |
The change works great (AFAIK). IMO we could have gone even with disabling the optimization (as you did at first), but if the new change works, even better. Either way, as you say, it'll be fully resolved when the matrix based scaling is implemented in the future. Alright, I think we're ready to ship? |
Yes! 🎉 This was one huge PR 😄 |
Woohoo! This has been a wild ride (for you much much more I'm sure). ❤️ It's time to rejoice. |
I am going to celebrate now! 😄 |
* Revert "Revert "Feature: Multi Point Arrows (#338)" (#634)" This reverts commit 3d2e59b. * Convert old arrow spec to new one * Remove unnecessary failchecks and fix context transform issue in retina displays * Remove old points failcheck from getArrowAbsoluteBounds * Remove all failchecks for old arrow * remove the rest of unnecessary checks * Set default values for the arrow during import * Add translations * fix restore using unmigrated elements for state computation * don't use width/height when migrating from new arrow spec Co-authored-by: David Luzar <luzar.david@gmail.com> Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
Currently, I have gotten some preliminary things working. Here are the features that I want to get to working condition