mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-31 05:51:47 +00:00
fix crash when the text letter reaches the end of text-path
This commit is contained in:
@@ -106,7 +106,11 @@ static CGFloat Distance(CGPoint a, CGPoint b) {
|
||||
- (CGAffineTransform)transformAtDistance:(CGFloat)distance
|
||||
{
|
||||
if (_offset == 0) {
|
||||
[self setControlPoints];
|
||||
if (_bezierCurves.count == _bezierIndex) {
|
||||
return CGAffineTransformMakeScale(0, 0);
|
||||
} else {
|
||||
[self setControlPoints];
|
||||
}
|
||||
}
|
||||
|
||||
CGFloat offset = [self offsetAtDistance:distance - _lastX
|
||||
|
||||
@@ -112,6 +112,12 @@ static void RNSVGFreeTextFrame(RNSVGTextFrame frame)
|
||||
// draw glyphs along path
|
||||
if (self.path) {
|
||||
transform = [bezierPath transformAtDistance:point.x];
|
||||
|
||||
// break loop if line reaches the end of the Path.
|
||||
if (!transform.a || !transform.d) {
|
||||
CGPathRelease(letter);
|
||||
break;
|
||||
}
|
||||
transform = CGAffineTransformScale(transform, 1.0, -1.0);
|
||||
} else {
|
||||
transform = CGAffineTransformTranslate(upsideDown, point.x, point.y);
|
||||
|
||||
Reference in New Issue
Block a user