mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-22 23:25:20 +00:00
first step of TSpan
This commit is contained in:
@@ -17,30 +17,6 @@ function arrayDiffer(a, b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function fontAndLinesDiffer(a, b) {
|
||||
if (a === b) {
|
||||
return false;
|
||||
}
|
||||
if (a.font !== b.font) {
|
||||
if (a.font === null) {
|
||||
return true;
|
||||
}
|
||||
if (b.font === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
a.font.fontFamily !== b.font.fontFamily ||
|
||||
a.font.fontSize !== b.font.fontSize ||
|
||||
a.font.fontWeight !== b.font.fontWeight ||
|
||||
a.font.fontStyle !== b.font.fontStyle
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return arrayDiffer(a.lines, b.lines);
|
||||
}
|
||||
|
||||
const ViewBoxAttributes = {
|
||||
minX: true,
|
||||
minY: true,
|
||||
@@ -104,16 +80,22 @@ const PathAttributes = merge({
|
||||
}
|
||||
}, RenderableAttributes);
|
||||
|
||||
const TextAttributes = merge({
|
||||
alignment: true,
|
||||
frame: {
|
||||
diff: fontAndLinesDiffer
|
||||
},
|
||||
path: {
|
||||
diff: arrayDiffer
|
||||
}
|
||||
const FontAttributes = merge({
|
||||
fontFamily: true,
|
||||
fontSize: true,
|
||||
fontWeight: true,
|
||||
fontStyle: true
|
||||
}, RenderableAttributes);
|
||||
|
||||
const TSpanAttributes = merge({
|
||||
line: true
|
||||
}, FontAttributes);
|
||||
|
||||
|
||||
const TextAttributes = merge({
|
||||
alignment: true
|
||||
}, FontAttributes);
|
||||
|
||||
const ClipPathAttributes = {
|
||||
name: true
|
||||
};
|
||||
@@ -184,6 +166,7 @@ const RectAttributes = merge({
|
||||
export {
|
||||
PathAttributes,
|
||||
TextAttributes,
|
||||
TSpanAttributes,
|
||||
GroupAttributes,
|
||||
ClipPathAttributes,
|
||||
CircleAttributes,
|
||||
|
||||
Reference in New Issue
Block a user