mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-09 17:30:58 +00:00
add dashoffset support
This commit is contained in:
+1
-2
@@ -59,9 +59,8 @@
|
||||
CGContextSetLineJoin(context, self.strokeLinejoin);
|
||||
RNSVGCGFloatArray dash = self.strokeDash;
|
||||
|
||||
// TODO: render as web svgs do
|
||||
if (dash.count) {
|
||||
CGContextSetLineDash(context, 0, dash.array, dash.count);
|
||||
CGContextSetLineDash(context, self.strokeDashoffset, dash.array, dash.count);
|
||||
}
|
||||
|
||||
if (!fillColor) {
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
@property (nonatomic, assign) CGLineCap strokeLinecap;
|
||||
@property (nonatomic, assign) CGLineJoin strokeLinejoin;
|
||||
@property (nonatomic, assign) RNSVGCGFloatArray strokeDash;
|
||||
@property (nonatomic, assign) CGFloat strokeDashoffset;
|
||||
|
||||
@end
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
_strokeDash = strokeDash;
|
||||
}
|
||||
|
||||
- (void)setStrokeDashoffset:(CGFloat)strokeDashoffset
|
||||
{
|
||||
[self invalidate];
|
||||
_strokeDashoffset = strokeDashoffset;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_strokeDash.array) {
|
||||
|
||||
+2
-1
@@ -84,8 +84,9 @@ static void RNSVGFreeTextFrame(RNSVGTextFrame frame)
|
||||
CGContextSetLineCap(context, self.strokeLinecap);
|
||||
CGContextSetLineJoin(context, self.strokeLinejoin);
|
||||
RNSVGCGFloatArray dash = self.strokeDash;
|
||||
|
||||
if (dash.count) {
|
||||
CGContextSetLineDash(context, 0, dash.array, dash.count);
|
||||
CGContextSetLineDash(context, self.strokeDashoffset, dash.array, dash.count);
|
||||
}
|
||||
|
||||
if (![self.stroke applyStrokeColor:context]) {
|
||||
|
||||
@@ -26,8 +26,9 @@ RCT_EXPORT_VIEW_PROPERTY(stroke, RNSVGBrush)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeLinecap, CGLineCap)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeLinejoin, CGLineJoin)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeDash, RNSVGCGFloatArray)
|
||||
RCT_EXPORT_VIEW_PROPERTY(clipPath, CGPath)
|
||||
RCT_EXPORT_VIEW_PROPERTY(clipRule, RNSVGCGFCRule)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeDash, RNSVGCGFloatArray)
|
||||
RCT_EXPORT_VIEW_PROPERTY(strokeDashoffset, CGFloat)
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user