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 placing objects via touch in editor not working sometimes #30411

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

Conversation

frenzibyte
Copy link
Member

Placing objects in editor requires the presence of a PlacementBlueprint that responds to the input of the user placing the object. But placement blueprints are programmed to be removed when the user's cursor is outside the compose area.

Similar to the symptoms in #30263, in the case of touch input, if the current position of the cursor (led by where the user has tapped the screen last time) is currently outside the compose area, then if the user tries to tap on the compose screen to place an object, nothing happens because there's no PlacementBlueprint present at the point of the user tapping the compose area.

Unlike #30263, this cannot be resolved by responding to mouse movement events and create a PlacementBlueprint right before the subsequent mouse click event is raised, because adding a drawable in the scene requires waiting a full update frame cycle in order for the drawable to become alive (which is a prerequisite for the drawable to be considered in the input queue).

Instead, this PR resolves the issue by making placement blueprints always exist, and change their visibility state instead. This required a minor refactor around the IPlacementHandler interface to better work with the new behaviour.

ScreenRecording_10-23-2024.16-55-59_1.MP4

…input

More specifically, this fixes placement blueprints not beginning placement when using touch input while the cursor was previously outside compose area, due to the placement blueprint not existing (removed from the scene by `ComposeBlueprintContainer`).
@@ -127,6 +129,16 @@ protected override bool Handle(UIEvent e)
}
}

protected override void PopIn()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want a fade.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought it may be a nice touch, no problem.

@peppy
Copy link
Member

peppy commented Oct 24, 2024

I think the direction seems okay. Will need some conflict resolution on tests (need to be moved to new class).

@peppy peppy self-requested a review October 25, 2024 07:17
Comment on lines 326 to +329
if (!Composer.CursorInPlacementArea)
removePlacement();
CurrentPlacement.Hide();
else if (Composer.CursorInPlacementArea)
CurrentPlacement.Show();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??????????????????????????????????????

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit of a surprising reaction since PlacementBlueprints were actually historically like this, until it was "simplified" at some point to not have this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read the code you're written again, please.

@peppy
Copy link
Member

peppy commented Oct 25, 2024

In initial testing I can't find any edge cases that don't match previous behaviour. But reviewing this change is a bit arduous due to the amount of weird logic surrounding the placement object (and the change doesn't simplify but instead adds more new state).

Will need some time to work through this.

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.

Drawing sliders when using a touch device doesn't work as expected
2 participants