Implement TextNodeRegion

Summary: NodeRegion is only able to describe a rectangular region for touch, which is not good enough for text, where we want to be able to assign different touch ids to individual words (and those can span more than one line and in general have non-rectangular structure). This diff adds TextNodeRegion which inserts additional markers into text Layout to allow individual words to have unique react tags.

Reviewed By: ahmedre

Differential Revision: D2757387
This commit is contained in:
Denis Koroskin
2015-12-17 13:52:12 -08:00
committed by Ahmed El-Helw
parent 85cdfcd1f7
commit 381bf1b76f
10 changed files with 143 additions and 45 deletions

View File

@@ -171,14 +171,21 @@ import com.facebook.react.uimanager.ViewProps;
mNodeRegions = nodeRegion;
}
/* package */ final NodeRegion getNodeRegion() {
return mNodeRegion;
/* package */ void updateNodeRegion(float left, float top, float right, float bottom) {
if (mNodeRegion.mLeft != left || mNodeRegion.mTop != top ||
mNodeRegion.mRight != right || mNodeRegion.mBottom != bottom) {
setNodeRegion(new NodeRegion(left, top, right, bottom, getReactTag()));
}
}
/* package */ final void setNodeRegion(NodeRegion nodeRegion) {
protected final void setNodeRegion(NodeRegion nodeRegion) {
mNodeRegion = nodeRegion;
}
/* package */ final NodeRegion getNodeRegion() {
return mNodeRegion;
}
/**
* Sets boundaries of the View that this node maps to relative to the parent left/top coordinate.
*/