Add ability to modify rotation value of components in Flipper layout inspector plugin

Reviewed By: colriot

Differential Revision: D21526381

fbshipit-source-id: ed692cb9c1bf7d38bef156d2e808b55c76ed3e05
This commit is contained in:
Aziz Murtazaev
2020-06-02 02:33:59 -07:00
committed by Facebook GitHub Bot
parent 1644a15bac
commit b7c34d336a

View File

@@ -7,6 +7,7 @@
package com.facebook.flipper.plugins.litho; package com.facebook.flipper.plugins.litho;
import static com.facebook.flipper.plugins.inspector.InspectorValue.Type.Boolean;
import static com.facebook.flipper.plugins.inspector.InspectorValue.Type.Enum; import static com.facebook.flipper.plugins.inspector.InspectorValue.Type.Enum;
import static com.facebook.flipper.plugins.inspector.InspectorValue.Type.Number; import static com.facebook.flipper.plugins.inspector.InspectorValue.Type.Number;
@@ -256,6 +257,13 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
.put("vertical", fromYogaValue(layout.getPosition(YogaEdge.VERTICAL))) .put("vertical", fromYogaValue(layout.getPosition(YogaEdge.VERTICAL)))
.put("all", fromYogaValue(layout.getPosition(YogaEdge.ALL)))); .put("all", fromYogaValue(layout.getPosition(YogaEdge.ALL))));
data.put("hasViewOutput", InspectorValue.immutable(Boolean, layout.hasViewOutput()));
if (layout.hasViewOutput()) {
data.put("alpha", fromFloat(layout.getAlpha()));
data.put("scale", fromFloat(layout.getScale()));
data.put("rotation", fromFloat(layout.getRotation()));
}
return data.build(); return data.build();
} }
@@ -478,6 +486,15 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
case "position": case "position":
node.setPosition(edgeFromString(path[1]), YogaValue.parse(value.asString())); node.setPosition(edgeFromString(path[1]), YogaValue.parse(value.asString()));
break; break;
case "alpha":
node.setAlpha(value.asFloat());
break;
case "scale":
node.setScale(value.asFloat());
break;
case "rotation":
node.setRotation(value.asFloat());
break;
} }
} }