-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
fix: Add binding update to manual stat changes #8183
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
Conversation
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
|
@dwelle Should we update the arrow bindings if manually update via the stats panel? It would make sense that if you move an arrow close to a bindable it would bind. |
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
|
I merged in the master branch and added in functionality to keep linear elements bound if they were previously bound and the manual changes don't remove them from their original binding area. Otherwise the linear element disconnects. Previously it never disconnected the original binding, no matter how far it was moved via stats edits. Consequently it never bound to any shape either when moved within the binding area. |
yeah, sounds good! |
|
Okay, if @ryan-di if you're okay with this, no more edge cases come to mind, then give me the go-ahead and I merge this. |
…ioning 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>
|
@ryan-di added tests and fixed a small bug. Let me know. |
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
|
Removed import reordering as per @dwelle's request. |
|
Hey @mtolmacs, I've gone through the code and if you could take some time to go over the two comments, we're good to go 🙂 |
| interface AngleProps { | ||
| element: ExcalidrawElement; | ||
| elementsMap: ElementsMap; | ||
| scene: Scene; |
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.
What's the purpose of using scene here?
| ): boolean => { | ||
| const threshold = maxBindingGap(element, element.width, element.height); | ||
| const shape = app.getElementShape(element); | ||
| const shape = getElementShape(element, elementsMap); |
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.
Is the inclusion of the getElementShape refactor intentional?
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.
Unfortunately yes, because the getElementShape() was an instance method on App and the binding code uses getElementShape(), therefore an app instance must be provided to the linear binding functions used this PR. Since it was a fairly self-contained instance method, I opted to extract it from App and not add an app instance to all functions all the way down to the stats editor. I also bring this refactor in another PR, so this is a refactor which should happen anyway.
I believe the code and responsibilities are clearer this way.
| angle: nextAngle, | ||
| }); | ||
|
|
||
| if (isLinearElement(latestElement)) { |
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.
I would probably put this in a function in Stats/utilts 🙂
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.
Done!
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
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.
Answered and completed
| ): boolean => { | ||
| const threshold = maxBindingGap(element, element.width, element.height); | ||
| const shape = app.getElementShape(element); | ||
| const shape = getElementShape(element, elementsMap); |
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.
Unfortunately yes, because the getElementShape() was an instance method on App and the binding code uses getElementShape(), therefore an app instance must be provided to the linear binding functions used this PR. Since it was a fairly self-contained instance method, I opted to extract it from App and not add an app instance to all functions all the way down to the stats editor. I also bring this refactor in another PR, so this is a refactor which should happen anyway.
I believe the code and responsibilities are clearer this way.
| angle: nextAngle, | ||
| }); | ||
|
|
||
| if (isLinearElement(latestElement)) { |
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.
Done!
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.
Thanks!
Manual stats changes now respect previous element bindings.

Currently manual stats updates do not respect already bound linear elements.