mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-28 04:55:12 +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);
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
for (RNSVGNode *node in self.subviews) {
|
||||
[node renderTo:context];
|
||||
|
||||
if (node.touchable && !svg.touchable) {
|
||||
self.touchable = YES;
|
||||
if (node.responsible && !svg.responsible) {
|
||||
self.responsible = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@interface RNSVGSvgView : UIView <RNSVGContainer>
|
||||
|
||||
@property (nonatomic, assign) BOOL touchable;
|
||||
@property (nonatomic, assign) BOOL responsible;
|
||||
|
||||
/**
|
||||
* define <ClipPath></ClipPath> content as clipPath template.
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
for (RNSVGNode *node in self.subviews) {
|
||||
[node renderTo:context];
|
||||
|
||||
if (node.touchable && !self.touchable) {
|
||||
self.touchable = YES;
|
||||
if (node.responsible && !self.responsible) {
|
||||
self.responsible = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
return self.touchable ? [super hitTest:point withEvent:event] : nil;
|
||||
return self.responsible ? [super hitTest:point withEvent:event] : nil;
|
||||
}
|
||||
|
||||
- (void)defineClipPath:(CGPathRef)clipPath clipPathId:(NSString *)clipPathId
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
@property (nonatomic, assign) RNSVGCGFCRule clipRule;
|
||||
@property (nonatomic, assign) CGPathRef clipPath; // convert clipPath="M0,0 L0,10 L10,10z" into path
|
||||
@property (nonatomic, strong) NSString *clipPathId; // use clipPath="url(#clip)" as ClipPath
|
||||
@property (nonatomic, assign) BOOL touchable;
|
||||
@property (nonatomic, assign) BOOL responsible;
|
||||
|
||||
- (void)invalidate;
|
||||
- (void)renderTo:(CGContextRef)context;
|
||||
|
||||
@@ -32,6 +32,6 @@ RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat)
|
||||
RCT_EXPORT_VIEW_PROPERTY(trans, CGAffineTransform)
|
||||
RCT_EXPORT_VIEW_PROPERTY(clipPathId, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(touchable, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(responsible, BOOL)
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user