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

bug(Shape): Fix some properties not persisting correctly when modified #1487

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

Kruptein
Copy link
Owner

This fixes #1484

PA tracks internally which shapes are currently selected and the most prominent location of changes of this selection occur when you use the select tool to click on other shapes or deselect the active shape.

Before this PR, the select tool would immediately update the selection state when the mouseDown event is fired. This PR changes this behaviour to wait until mouseMove or mouseUp.

When you're editing for example the name of a shape and you directly click on another shape or even just the map (causing a deselect), a bunch of browser events are fired. First the mouseDown event fires, which until now changed the selection info immediately, then the change event fires, which indicates that the name input field changed content and finally mouseUp is fired.

As you can see by the time the change event hits, we've already changed our selection to either a different shape or cleared the selection info. Which in turn means that the updateName function either changes the name of the wrong shape or simply doesn't have any shape to update.

By delaying the selection change to mouseMove or mouseUp, we're ensuring that these events still operate on the originally selected shape.

Some of you might wonder why the other input field (i.e. 'value') mentioned in the related ticket was working correctly before these changes. That's because that field is still using a legacy way to detect which shape is active that reactively watches the main selection system. This legacy system was getting its update a tick later which happens to be after the change event fired.

@Kruptein Kruptein merged commit c44312a into dev Oct 28, 2024
5 checks passed
@Kruptein Kruptein deleted the bugfix/1484-selection-change-timings branch October 28, 2024 13:48
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.

[BUG] Changing Shape Name Can Change Different Shape's Name In Specific Scenario
1 participant