Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ordering of transforms on a reference frame. #3154

Merged
merged 1 commit into from Oct 2, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -256,12 +256,20 @@ impl SpatialNode {
.pre_mul(&source_transform.into())
.pre_mul(&info.source_perspective);

// The transformation for this viewport in world coordinates is the transformation for
// our parent reference frame, plus any accumulated scrolling offsets from nodes
// between our reference frame and this node. Finally, we also include
// whatever local transformation this reference frame provides.
// In order to compute a transformation to world coordinates, we need to apply the
// following transforms in order:
// state.parent_accumulated_scroll_offset
// info.source_perspective
// info.source_transform
// info.origin_in_parent_reference_frame
// state.parent_reference_frame_transform
// The first one incorporates the scrolling effect of any scrollframes/sticky nodes
// between this reference frame and the parent reference frame. The middle three
// transforms (which are combined into info.resolved_transform) do the conversion
// into the parent reference frame's coordinate space, and then the last one
// applies the parent reference frame's transform to the world space.
let relative_transform = info.resolved_transform
.post_translate(state.parent_accumulated_scroll_offset)
.pre_translate(&state.parent_accumulated_scroll_offset)
.to_transform()
.with_destination::<LayoutPixel>();
self.world_viewport_transform =
@@ -540,6 +540,7 @@ impl<Src, Dst> FastTransform<Src, Dst> {
}
}

#[allow(dead_code)]
pub fn post_translate(&self, new_offset: TypedVector2D<f32, Dst>) -> Self {
match *self {
FastTransform::Offset(offset) => {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.