(client) Change Litho Descriptor

Summary: Similar to previous diff but for Litho component

Reviewed By: mweststrate

Differential Revision: D21040426

fbshipit-source-id: 32e997269bbda472917c8ff6f176d05cf502b9dc
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-05-07 03:37:49 -07:00
committed by Facebook GitHub Bot
parent c3bc168216
commit f06dc46c06
2 changed files with 8 additions and 8 deletions

View File

@@ -367,6 +367,7 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
@Override @Override
public void hitTest(DebugComponent node, Touch touch) { public void hitTest(DebugComponent node, Touch touch) {
boolean finish = true;
for (int i = getChildCount(node) - 1; i >= 0; i--) { for (int i = getChildCount(node) - 1; i >= 0; i--) {
final Object child = getChildAt(node, i); final Object child = getChildAt(node, i);
if (child instanceof DebugComponent) { if (child instanceof DebugComponent) {
@@ -375,17 +376,17 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
if (touch.containedIn(bounds.left, bounds.top, bounds.right, bounds.bottom)) { if (touch.containedIn(bounds.left, bounds.top, bounds.right, bounds.bottom)) {
touch.continueWithOffset(i, bounds.left, bounds.top); touch.continueWithOffset(i, bounds.left, bounds.top);
return; finish = false;
} }
} else if (child instanceof View || child instanceof Drawable) { } else if (child instanceof View || child instanceof Drawable) {
// Components can only mount one view or drawable and its bounds are the same as the // Components can only mount one view or drawable and its bounds are the same as the
// hosting component. // hosting component.
touch.continueWithOffset(i, 0, 0); touch.continueWithOffset(i, 0, 0);
return; finish = false;
} }
} }
touch.finish(); if (finish) touch.finish();
} }
@Override @Override

View File

@@ -171,7 +171,7 @@ public class DebugSectionDescriptor extends NodeDescriptor<DebugSection> {
// For a DiffSectionSpec, check if child view to see if the touch is in its bounds. // For a DiffSectionSpec, check if child view to see if the touch is in its bounds.
// For a GroupSectionSpec, check the bounds of the entire section. // For a GroupSectionSpec, check the bounds of the entire section.
boolean finish = true;
if (node.isDiffSectionSpec()) { if (node.isDiffSectionSpec()) {
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View child = (View) getChildAt(node, i); View child = (View) getChildAt(node, i);
@@ -183,10 +183,9 @@ public class DebugSectionDescriptor extends NodeDescriptor<DebugSection> {
final boolean hit = touch.containedIn(left, top, right, bottom); final boolean hit = touch.containedIn(left, top, right, bottom);
if (hit) { if (hit) {
touch.continueWithOffset(i, left, top); touch.continueWithOffset(i, left, top);
return; finish = false;
} }
} }
touch.finish();
} else { } else {
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
DebugSection child = (DebugSection) getChildAt(node, i); DebugSection child = (DebugSection) getChildAt(node, i);
@@ -194,11 +193,11 @@ public class DebugSectionDescriptor extends NodeDescriptor<DebugSection> {
final boolean hit = touch.containedIn(bounds.left, bounds.top, bounds.right, bounds.bottom); final boolean hit = touch.containedIn(bounds.left, bounds.top, bounds.right, bounds.bottom);
if (hit) { if (hit) {
touch.continueWithOffset(i, 0, 0); touch.continueWithOffset(i, 0, 0);
return; finish = false;
} }
} }
touch.finish();
} }
if (finish) touch.finish();
} }
@Override @Override