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

Fix drawing slider with touch inserts a random control point at beginning #28870

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

frenzibyte
Copy link
Member

As can be seen in the video attached in #26509 (comment), when drawing a slider after touching the playfield, a control point is inserted at the point where the user put their finger before drawing.

This is caused by SliderPlacementBlueprint reading the snap result of the last frame instead of the current frame where the touch input was triggered, therefore beginning a curve with the old mouse position.

The solution in this PR might not sit well with everyone because it's essentially a schedule underneath a three-line comment block, but I would like to say that the flow at which the blueprint receives the snap result warrants a schedule so that the placement begins with the snap result constructed based off the current update frame.

Note that PlacementBlueprintTestScene required a refactor so that the solution works. While this might feel like the solution is flaky, PlacementBlueprintTestScene was written in a way that operates opposite to how the editor naturally works. By that I mean the test scene updates the snap result before the test input manager's update flow, so even if beginCurve is scheduled in the mouse event, it'll execute before the next snap result update (in other words, the snap result update flow in the test scene always reads the input state of the last frame)

… manager

This is opposite to how it works in the real game, where the input manager is updated first before anything else below it.

Fixing this shows more logical behaviour from placement blueprints (i.e. this fixes `TestSliderDrawingViaTouch` still not succeeding despite the success in `TestTapSliderButtonThenDragAfterTappingPlayfield`)
Seemingly happening due to the test adding an unnecessary step that doesn't move the touch, and therefore making the touch trigger a right click due to not moving in time.
Tapping the compose area after selecting a tool should begin placement
(commit = true) of the object provided by the selected tool.
Turns out `HitCirclePlacementBlueprint` suffers from this exact same
issue, since it finalises placement on `OnMouseDown`, while the snap
result at that point is from last frame instead of current one.

This fix ensures that the snap result is updated before the blueprints
even handle any input event. Feels better in general.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant