Skip to content

Commit c6841a6

Browse files
authored
Merge pull request vault-development#100 from nesc58/master
Fix: Text elements / transform + clipPath attribute added
2 parents 19f443a + 7b05a57 commit c6841a6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

index.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ const RADIALG_ATTS = CIRCLE_ATTS.concat(['id', 'gradientUnits']);
5454
const STOP_ATTS = ['offset'];
5555
const ELLIPSE_ATTS = ['cx', 'cy', 'rx', 'ry'];
5656

57-
const TEXT_ATTS = ['fontFamily', 'fontSize', 'fontWeight']
57+
const TEXT_ATTS = ['fontFamily', 'fontSize', 'fontWeight', 'textAnchor']
5858

5959
const POLYGON_ATTS = ['points'];
6060
const POLYLINE_ATTS = ['points'];
6161

6262
const COMMON_ATTS = ['fill', 'fillOpacity', 'stroke', 'strokeWidth', 'strokeOpacity', 'opacity',
6363
'strokeLinecap', 'strokeLinejoin',
64-
'strokeDasharray', 'strokeDashoffset', 'x', 'y', 'rotate', 'scale', 'origin', 'originX', 'originY'];
64+
'strokeDasharray', 'strokeDashoffset', 'x', 'y', 'rotate', 'scale', 'origin', 'originX', 'originY', 'transform', 'clipPath'];
6565

6666
let ind = 0;
6767

@@ -150,8 +150,8 @@ class SvgUri extends Component{
150150
// Remove empty strings from children array
151151
trimElementChilden(children) {
152152
for (child of children) {
153-
if (typeof child === 'string') {
154-
if (child.trim.length === 0)
153+
if (typeof child === 'string') {
154+
if (child.trim().length === 0)
155155
children.splice(children.indexOf(child), 1);
156156
}
157157
}
@@ -209,9 +209,6 @@ class SvgUri extends Component{
209209
return <Polyline key={i} {...componentAtts}>{childs}</Polyline>;
210210
case 'text':
211211
componentAtts = this.obtainComponentAtts(node, TEXT_ATTS);
212-
if (componentAtts.y) {
213-
componentAtts.y = fixYPosition(componentAtts.y, node)
214-
}
215212
return <Text key={i} {...componentAtts}>{childs}</Text>;
216213
case 'tspan':
217214
componentAtts = this.obtainComponentAtts(node, TEXT_ATTS);

0 commit comments

Comments
 (0)