Wrapping text inside non-rectangular shape properly #1709
-
Hi, is it possible to wrap text inside a non-rectangular shape so that it does not overlap the shape? By default textWrap on the label ignores the shape (which makes sense but is ugly): |
Beta Was this translation helpful? Give feedback.
Answered by
kumilingus
Jun 27, 2022
Replies: 1 comment 2 replies
-
You will have to wrap the text inside an inscribed rectangle instead. const ellipse = new joint.shapes.standard.Ellipse({
size: { width: 200, height: 100 },
attrs: {
label: {
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec elit viverra, dapibus massa nec, pretium tortor. Duis id velit ultrices, efficitur tortor vitae, tristique erat. Donec tristique imperdiet facilisis. Pellentesque id tincidunt justo, in lobortis dui. Fusce nec dolor quis ligula egestas porttitor a porttitor mauris. Quisque tincidunt, arcu id dictum tempor, felis augue varius arcu, ac aliquet elit nibh dapibus erat. Nunc urna mauris, viverra vitae ullamcorper ac, mattis dapibus enim. Proin sed congue odio.',
textWrap: {
width: '70%',
height: '70%',
ellipsis: true
}
}
}
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
igo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will have to wrap the text inside an inscribed rectangle instead.