avm2: Check for state parent in hit_test_shape as well as mouse_pick

This commit is contained in:
CUB3D 2022-12-13 00:08:08 +00:00 committed by kmeisthax
parent 2edbe3092b
commit 80cf98f501
1 changed files with 8 additions and 2 deletions

View File

@ -666,8 +666,14 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
if !options.contains(HitTestOptions::SKIP_INVISIBLE) || self.visible() {
let state = self.0.read().state;
if let Some(child) = self.get_state_child(state.into()) {
// hit_area is not actually a child, so transform point into local space before passing it down.
let point = self.global_to_local(point);
//TODO: the if below should probably always be taken, why does the hit area
// sometimes have a parent?
let mut point = point;
if child.parent().is_none() {
// hit_area is not actually a child, so transform point into local space before passing it down.
point = self.global_to_local(point);
}
if child.hit_test_shape(context, point, options) {
return true;
}