Skip to content

Commit

Permalink
use wrapping svg for dx and dy
Browse files Browse the repository at this point in the history
  • Loading branch information
sto3psl committed Apr 18, 2018
1 parent b6b0d82 commit 95186b1
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions packages/vx-text/src/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,22 @@ class Text extends Component {
}

return (
<text
{...textProps}
textAnchor={textAnchor}
style={{
transform: `translate(${dx}, ${dy})`,
...textProps.style
}}
>
{
wordsByLines.map((line, index) => (
<tspan x={x} dy={index === 0 ? startDy : lineHeight} key={index}>
{line.words.join(' ')}
</tspan>
))
}
</text>
<svg x={dx} y={dy} fontSize={textProps.fontSize} style={{ overflow: 'visible' }}>
<text
{...textProps}
textAnchor={textAnchor}
>
{
wordsByLines.map((line, index) => (
<tspan x={x} dy={index === 0 ? startDy : lineHeight} key={index}>
{line.words.join(' ')}
</tspan>
))
}
</text>
</svg>
);
}
}

export default Text;
export default Text;

0 comments on commit 95186b1

Please sign in to comment.