Replies: 5 comments 2 replies
-
It should work the same way as here: https://codepen.io/jointjs/pen/gOEqqQW Did you miss to set the size of the image element? const standardImage = new shapes.standard.Image({
size: { width: 100, height: 100 },
attrs: {
image: {
href: `${getImage('dog')}`,
},
},
}); If that's not the case, please setup a functional example that could be debugged. |
Beta Was this translation helpful? Give feedback.
-
Hi Kumilingus - thanks for the reply. Still does not work. Here is a codesandbox.io link to it. It works when the SVG is a variable, but not when pulled from an svg file (even without using a sprite). You will see the working image:href code commented out. |
Beta Was this translation helpful? Give feedback.
-
So in individual SVG file works now-- thanks! However, I still cannot get a sprite to render a specific element. New example to show the issue. It works when using the sprite as a link, but as an imported file it displays all elements of the sprite. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I tried with that included before but it doesn't compile, so I took it out.
|
Beta Was this translation helpful? Give feedback.
-
It works when I take out the
|
Beta Was this translation helpful? Give feedback.
-
Introduction
I want to use the React native SVG rendering capability with an SVG sprite as input to the Joint.js shape image:xlinkHref. React returns the correct image using the getImage() function below, but Joint.JS does not. The output of React's xlinkHref is not a string SVG definition, but a React pointer to the individual 'dog' SVG like this.
/static/media/sprite.d5c2218c941c0589a4791b8bbda46fc2.svg#dog
Any ideas how to make this work?
Steps to reproduce
No response
Restrictions & Constraints
No response
Does your question relate to JointJS or JointJS+. Select both if applicable.
JointJS
Beta Was this translation helpful? Give feedback.
All reactions