mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-31 13:52:58 +00:00
touchable => responsible
This commit is contained in:
@@ -35,7 +35,7 @@ public class RNSVGGroupShadowNode extends RNSVGVirtualNode {
|
||||
child.setupDimensions(canvas);
|
||||
child.draw(canvas, paint, opacity);
|
||||
|
||||
if (child.isTouchable()) {
|
||||
if (child.isResponsible()) {
|
||||
svg.enableTouchEvents();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
|
||||
|
||||
private boolean mTouchable = false;
|
||||
private boolean mResponsible = false;
|
||||
|
||||
private static final Map<String, Path> mDefinedClipPaths = new HashMap<>();
|
||||
|
||||
@@ -58,20 +58,20 @@ public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
|
||||
child.setupDimensions(canvas);
|
||||
child.draw(canvas, paint, 1f);
|
||||
|
||||
if (child.isTouchable() && !mTouchable) {
|
||||
mTouchable = true;
|
||||
if (child.isResponsible() && !mResponsible) {
|
||||
mResponsible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void enableTouchEvents() {
|
||||
if (!mTouchable) {
|
||||
mTouchable = true;
|
||||
if (!mResponsible) {
|
||||
mResponsible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hitTest(Point point, ViewGroup view) {
|
||||
if (!mTouchable) {
|
||||
if (!mResponsible) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class RNSVGVirtualNode extends LayoutShadowNode {
|
||||
private int mClipRule;
|
||||
private boolean mClipRuleSet;
|
||||
private boolean mClipDataSet;
|
||||
protected boolean mTouchable;
|
||||
protected boolean mResponsible;
|
||||
protected int mWidth;
|
||||
protected int mHeight;
|
||||
|
||||
@@ -146,9 +146,9 @@ public abstract class RNSVGVirtualNode extends LayoutShadowNode {
|
||||
markUpdated();
|
||||
}
|
||||
|
||||
@ReactProp(name = "touchable", defaultBoolean = false)
|
||||
public void setTouchable(boolean touchable) {
|
||||
mTouchable = touchable;
|
||||
@ReactProp(name = "responsible", defaultBoolean = false)
|
||||
public void setResponsible(boolean responsible) {
|
||||
mResponsible = responsible;
|
||||
markUpdated();
|
||||
}
|
||||
|
||||
@@ -278,8 +278,8 @@ public abstract class RNSVGVirtualNode extends LayoutShadowNode {
|
||||
|
||||
abstract public int hitTest(Point point, View view);
|
||||
|
||||
public boolean isTouchable() {
|
||||
return mTouchable;
|
||||
public boolean isResponsible() {
|
||||
return mResponsible;
|
||||
}
|
||||
|
||||
abstract protected Path getPath(Canvas canvas, Paint paint);
|
||||
|
||||
Reference in New Issue
Block a user