mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 05:55:10 +00:00
refactor text render
Support G inherit props. Refactor text render. Text glyphs will perfectly draw along the path
This commit is contained in:
@@ -38,7 +38,7 @@ export default class SerializablePath {
|
||||
case 's': this.curve(p[i++], p[i++], null, null, p[i++], p[i++]); break;
|
||||
case 'q': this.curve(p[i++], p[i++], p[i++], p[i++]); break;
|
||||
case 't': this.curve(p[i++], p[i++]); break;
|
||||
case 'a': this.arc(p[i + 5], p[i + 6], p[i], p[i + 1], p[i + 3], !+p[i + 4], p[i + 2]); i += 7; break;
|
||||
case 'a': this.arc(p[i + 5], p[i + 6], p[i], p[i + 1], p[i + 3], !+p[i + 4], +p[i + 2]); i += 7; break;
|
||||
case 'h': this.line(p[i++], 0); break;
|
||||
case 'v': this.line(0, p[i++]); break;
|
||||
|
||||
@@ -48,7 +48,7 @@ export default class SerializablePath {
|
||||
case 'S': this.curveTo(p[i++], p[i++], null, null, p[i++], p[i++]); break;
|
||||
case 'Q': this.curveTo(p[i++], p[i++], p[i++], p[i++]); break;
|
||||
case 'T': this.curveTo(p[i++], p[i++]); break;
|
||||
case 'A': this.arcTo(p[i + 5], p[i + 6], p[i], p[i + 1], p[i + 3], !+p[i + 4], p[i + 2]); i += 7; break;
|
||||
case 'A': this.arcTo(p[i + 5], p[i + 6], p[i], p[i + 1], p[i + 3], !+p[i + 4], +p[i + 2]); i += 7; break;
|
||||
case 'H': this.lineTo(p[i++], this.penY); break;
|
||||
case 'V': this.lineTo(this.penX, p[i++]); break;
|
||||
|
||||
@@ -276,12 +276,9 @@ export default class SerializablePath {
|
||||
};
|
||||
|
||||
onArc = (sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation) => {
|
||||
if (rx !== ry || rotation) {
|
||||
return this._arcToBezier(
|
||||
sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation
|
||||
);
|
||||
}
|
||||
this.path.push(ARC, cx, cy, rx, sa, ea, ccw ? 0 : 1);
|
||||
return this._arcToBezier(
|
||||
sx, sy, ex, ey, cx, cy, rx, ry, sa, ea, ccw, rotation
|
||||
);
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
|
||||
Reference in New Issue
Block a user