From dfc8c32937c5cdb3623ff3be890d5e8e181a7382 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Sun, 16 May 2021 15:16:10 -0700 Subject: [PATCH] core: Do not include stage transform in DisplayObject::local_to_global_matrix TODO: Eventually we may want to include the stage transform here, and the deeper ActionScript APIs transform it to remove the stage scaling. --- core/src/display_object.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/display_object.rs b/core/src/display_object.rs index e27ba551c..9978b3a2e 100644 --- a/core/src/display_object.rs +++ b/core/src/display_object.rs @@ -554,6 +554,13 @@ pub trait TDisplayObject<'gc>: let mut node = self.parent(); let mut matrix = *self.matrix(); while let Some(display_object) = node { + // TODO: We don't want to include the stage transform because it includes the scale + // mode and alignemnt transform, but the AS APIs expect "global" to be relative to the + // Stage, not final view coordinates. + // I suspect we want this to include the stage transform eventually. + if display_object.as_stage().is_some() { + break; + } matrix = *display_object.matrix() * matrix; node = display_object.parent(); }