mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 22:05:14 +00:00
Finish TextPath
Finish TextPath step two: add `dy` support
This commit is contained in:
@@ -8,8 +8,7 @@ const fontRegExp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm
|
||||
const fontFamilyPrefix = /^[\s"']*/;
|
||||
const fontFamilySuffix = /[\s"']*$/;
|
||||
const spaceReg = /\s+/;
|
||||
const deltaReg = /^((-?\d*(\.\d+)?)+\s*)+$/;
|
||||
const commaReg = /,/;
|
||||
const commaReg = /,/g;
|
||||
|
||||
const anchors = {
|
||||
auto: 0,
|
||||
@@ -70,8 +69,12 @@ function extractFont(props) {
|
||||
}
|
||||
|
||||
function parseDelta(delta) {
|
||||
if (typeof delta === 'string' && deltaReg.test(delta)) {
|
||||
return delta.trim().split(spaceReg).map(d => +d);
|
||||
if (typeof delta === 'string') {
|
||||
if (isNaN(+delta)) {
|
||||
return delta.trim().replace(commaReg, ' ').split(spaceReg).map(d => +d || 0);
|
||||
} else {
|
||||
return [+delta];
|
||||
}
|
||||
} else if (typeof delta === 'number') {
|
||||
return [delta];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user