Skip to content

Commit

Permalink
[fuchsia][SCN-1054] Map elevation onto -Z in Scenic (flutter#7834)
Browse files Browse the repository at this point in the history
Note: the SetTranslationRH function is temporary and part of the smooth
transition plan for Scenics handedness inversion. See SCN-1054 for details.

We will follow this will a change to migrate back off SetTranslationRH
Submit after https://fuchsia-review.googlesource.com/c/fuchsia/+/255056
lands in fuchsia.git
  • Loading branch information
freiling authored and cbracken committed Feb 15, 2019
1 parent 163a2fd commit f37b09a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion flow/export_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ExportNode::Bind(SceneUpdateContext& context,

if (node_) {
container.AddChild(*node_);
node_->SetTranslation(offset.x(), offset.y(), 0.f);
node_->SetTranslationRH(offset.x(), offset.y(), 0.f);
node_->SetHitTestBehavior(
hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault
: fuchsia::ui::gfx::HitTestBehavior::kSuppress);
Expand Down
26 changes: 13 additions & 13 deletions flow/scene_update_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ void SceneUpdateContext::CreateFrame(
);
scenic::ShapeNode shape_node(session_);
shape_node.SetShape(shape);
shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(),
shape_bounds.height() * 0.5f + shape_bounds.top(),
0.f);
shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(),
shape_bounds.height() * 0.5f + shape_bounds.top(),
0.f);
// TODO(SCN-1274): AddPart() and SetClip() will be deleted.
entity_node->AddPart(shape_node);

Expand Down Expand Up @@ -141,9 +141,9 @@ void SceneUpdateContext::CreateFrame(
inner_bounds.height());
scenic::ShapeNode inner_node(session_);
inner_node.SetShape(inner_shape);
inner_node.SetTranslation(inner_bounds.width() * 0.5f + inner_bounds.left(),
inner_bounds.height() * 0.5f + inner_bounds.top(),
0.f);
inner_node.SetTranslationRH(
inner_bounds.width() * 0.5f + inner_bounds.left(),
inner_bounds.height() * 0.5f + inner_bounds.top(), 0.f);
entity_node->AddPart(inner_node);
SetShapeTextureOrColor(inner_node, color, scale_x, scale_y, inner_bounds,
std::move(paint_layers), layer,
Expand Down Expand Up @@ -282,9 +282,9 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context,
: Entity(context) {
scenic::ShapeNode shape_node(context.session());
shape_node.SetShape(shape);
shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(),
shape_bounds.height() * 0.5f + shape_bounds.top(),
0.f);
shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(),
shape_bounds.height() * 0.5f + shape_bounds.top(),
0.f);

// TODO(SCN-1274): AddPart() and SetClip() will be deleted.
entity_node().AddPart(shape_node);
Expand All @@ -305,9 +305,9 @@ SceneUpdateContext::Transform::Transform(SceneUpdateContext& context,
// are not handled correctly.
MatrixDecomposition decomposition(transform);
if (decomposition.IsValid()) {
entity_node().SetTranslation(decomposition.translation().x(), //
decomposition.translation().y(), //
decomposition.translation().z() //
entity_node().SetTranslationRH(decomposition.translation().x(), //
decomposition.translation().y(), //
decomposition.translation().z() //
);

entity_node().SetScale(decomposition.scale().x(), //
Expand Down Expand Up @@ -356,7 +356,7 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context,
paint_bounds_(SkRect::MakeEmpty()),
layer_(layer) {
if (elevation != 0.0)
entity_node().SetTranslation(0.f, 0.f, elevation);
entity_node().SetTranslationRH(0.f, 0.f, -elevation);
}

SceneUpdateContext::Frame::~Frame() {
Expand Down

0 comments on commit f37b09a

Please sign in to comment.