Include positionOnScreen in layout data
Summary: Context: https://fb.workplace.com/groups/flippersupport/permalink/804152663398727/ This gives flipper the location of every node, in relation to the entire screen. This allows it to visualize the position of each node on it's own diagram, overlayed over a screenshot for example. The use case in mind is after importing flipper data, you'll still be able to see layout nodes overlayed over a screenshot taken during export. Currently this is only added to Android Views, meaning we don't get it for Litho views or anything on iOS. This is basically to get something working end-to-end, and if it's all good, then I'll add the other types of views. Reviewed By: passy Differential Revision: D19747691 fbshipit-source-id: 8ba3aae6b7685de6faaf55b9628c200802801db4
This commit is contained in:
committed by
Facebook Github Bot
parent
60dab0d59e
commit
9280b3178d
@@ -101,6 +101,8 @@ public class ViewDescriptor extends NodeDescriptor<View> {
|
||||
|
||||
@Override
|
||||
public List<Named<FlipperObject>> getData(View node) {
|
||||
final int[] positionOnScreen = new int[2];
|
||||
node.getLocationOnScreen(positionOnScreen);
|
||||
final FlipperObject.Builder viewProps =
|
||||
new FlipperObject.Builder()
|
||||
.put("height", InspectorValue.mutable(node.getHeight()))
|
||||
@@ -147,7 +149,13 @@ public class ViewDescriptor extends NodeDescriptor<View> {
|
||||
"pivot",
|
||||
new FlipperObject.Builder()
|
||||
.put("x", InspectorValue.mutable(node.getPivotX()))
|
||||
.put("y", InspectorValue.mutable(node.getPivotY())));
|
||||
.put("y", InspectorValue.mutable(node.getPivotY())))
|
||||
.put(
|
||||
"positionOnScreen",
|
||||
new FlipperObject.Builder()
|
||||
.put("x", positionOnScreen[0])
|
||||
.put("y", positionOnScreen[1])
|
||||
.build());
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
viewProps
|
||||
|
||||
Reference in New Issue
Block a user