Update touch/measure/hotspot to all use same coordinate space

Reviewed By: astreet

Differential Revision: D2731165

fb-gh-sync-id: 729943233af66f139907cac2002fed4038b3fa6a
This commit is contained in:
Dave Miller
2015-12-10 02:57:33 -08:00
committed by facebook-github-bot-5
parent 423202072c
commit 5775d9e1d0
3 changed files with 35 additions and 20 deletions

View File

@@ -466,8 +466,15 @@ public class NativeViewHierarchyManager {
throw new NoSuchNativeViewException("No native view for " + tag + " currently exists");
}
// Puts x/y in outputBuffer[0]/[1]
v.getLocationOnScreen(outputBuffer);
View rootView = (View) RootViewUtil.getRootView(v);
rootView.getLocationInWindow(outputBuffer);
int rootX = outputBuffer[0];
int rootY = outputBuffer[1];
v.getLocationInWindow(outputBuffer);
outputBuffer[0] = outputBuffer[0] - rootX;
outputBuffer[1] = outputBuffer[1] - rootY;
outputBuffer[2] = v.getWidth();
outputBuffer[3] = v.getHeight();
}