core: Fix MovieClip's AVM2 mouse picking for AVM1 content#23468
Open
ChrisCPI wants to merge 1 commit intoruffle-rs:masterfrom
Open
core: Fix MovieClip's AVM2 mouse picking for AVM1 content#23468ChrisCPI wants to merge 1 commit intoruffle-rs:masterfrom
ChrisCPI wants to merge 1 commit intoruffle-rs:masterfrom
Conversation
3d5e4c7 to
10c5556
Compare
kjarosh
reviewed
Apr 16, 2026
d82beed to
5ff719a
Compare
Contributor
Author
|
The only downside to this new approach is that it runs |
Contributor
Author
|
Another possible option, which moves the let hit_test_shape = |context: &mut UpdateContext<'gc>| {
if child.hit_test_shape(context, point, options)
&& child
.masker()
.map(|mask| mask.hit_test_shape(context, point, options))
.unwrap_or(true)
{
if self.mouse_enabled() {
Avm2MousePick::Hit(this)
} else {
Avm2MousePick::PropagateToParent
}
} else {
Avm2MousePick::Miss
}
};
let mut res = if let Some(child) = child.as_interactive() {
if child.as_displayobject().movie().is_action_script_3() {
child.mouse_pick_avm2(context, point, require_button_mode)
} else {
let avm1_result =
child.mouse_pick_avm1(context, point, require_button_mode);
if let Some(result) = avm1_result {
Avm2MousePick::Hit(result)
} else {
hit_test_shape(context)
}
}
} else {
hit_test_shape(context)
}; |
Refactors the setting of the `res` value so that if `mouse_pick_avm1` on the child returns `None`, instead of counting it as a `Miss`, it will allow the `hit_test_shape` check to happen, so that the pick can correctly propagate to the parent. Prior to this, an AVM1 child would not respect `mouseChildren` on its parent, and landing on a non-interactive AVM1 object would just go through to the stage (or whatever would happen to be below it).
5ff719a to
758b8b7
Compare
Contributor
Author
|
Sorry for going back and forth on this, but I've finally landed on a solution I think I'm happy with. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors the setting of the
resvalue so that ifmouse_pick_avm1on the child returnsNone, instead of counting it as aMiss, it will allow thehit_test_shapecheck to happen, so that the pick can correctly propagate to the parent.Prior to this, an AVM1 child would not respect
mouseChildrenon its parent, and landing on a non-interactive AVM1 object would just go through to the stage (or whatever would happen to be below it).I also plan on making a follow up PR to apply a similar fix to
LoaderDisplay.