Skip to content

Commit

Permalink
avm2: Do not fire roll over events on focus change (yet)
Browse files Browse the repository at this point in the history
This patch bypasses AVM2 conditionally when firing roll over events
triggered by a focus change until a proper support for AVM2 events
is implemented.
  • Loading branch information
kjarosh committed Jun 21, 2024
1 parent 43b2cce commit 6a379b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/focus_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@ impl<'gc> FocusTracker<'gc> {

fn roll_over(context: &mut UpdateContext<'_, 'gc>, new: Option<InteractiveObject<'gc>>) {
let old = context.mouse_data.hovered;

// TODO It seems that AVM2 has a slightly different behavior here.
// It may be related to the fact that AVM2 handles key and mouse focus differently.
// AVM2 is being bypassed here conditionally until
// a proper support for AVM2 events is implemented.
// See https://github.com/ruffle-rs/ruffle/issues/16789
if new.is_some_and(|int| int.as_displayobject().movie().is_action_script_3())
|| old.is_some_and(|int| int.as_displayobject().movie().is_action_script_3())
{
return;
}

context.mouse_data.hovered = new;
if let Some(old) = old {
old.handle_clip_event(context, ClipEvent::RollOut { to: new });
Expand Down

0 comments on commit 6a379b1

Please sign in to comment.