avm1: Don't fire button events when invisible (fix #1521)

This commit is contained in:
Mike Welsh 2020-11-29 03:44:30 -08:00
parent b7d28e5e7e
commit ab200b6dc0
2 changed files with 8 additions and 0 deletions

View File

@ -326,6 +326,10 @@ impl<'gc> TDisplayObject<'gc> for Button<'gc> {
context: &mut UpdateContext<'_, 'gc, '_>,
event: ClipEvent,
) -> ClipEventResult {
if !self.visible() {
return ClipEventResult::NotHandled;
}
if event.propagates() {
for child in self.iter_execution_list() {
if child.handle_clip_event(context, event) == ClipEventResult::Handled {

View File

@ -1774,6 +1774,10 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
context: &mut UpdateContext<'_, 'gc, '_>,
event: ClipEvent,
) -> ClipEventResult {
if event.is_button_event() && !self.visible() {
return ClipEventResult::NotHandled;
}
if event.propagates() {
for child in self.iter_execution_list() {
if child.handle_clip_event(context, event) == ClipEventResult::Handled {