-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG images not working #3
Comments
You may use |
Thanks for your reply.
The path data is the part of the path tag and from between the d="" |
I seem to be able to make it kinda work (not via the svg.insert part), but using the new Konva.Image() part The only issue I have is that I have 2 options for the same svg image (color options), when I switch between the colors, the code just adds the svg (keeping the previous one), how can I remove the previous added and replace it by the new one? |
Essentially, you can preserve a reference to your produced shape in your state and then delete it. 'editor.board.shapes' also provides access to all produced shapes. Is this what you're looking for? |
hi @raminious, sorry for the late reply. Let me explain what I am trying to do. I have a selection of images which people can select as background image, added as image and not as background image, as they still need to be able to manipulate the image. So here is the issue: When they select an image as background, it is added as it should. But when they select a different image, what happens is that an extra image is added, while it should replace the current background image. This is how background image gets added:
I've also checked the "editor.board.shapes" in the console.log, but not sure how I can replace an item in the object. |
check this https://pikaso.app/#/core/background Also I provided a basic dummy codesandbox for you that shows how you can update an image after creating that https://codesandbox.io/s/pikaso-update-image-gdygq8?file=/src/App.tsx |
Hi @raminious, sorry for the late reply. Thanks for the dummy, but that still seems to add an extra image. What I want is to replace the current (if existing) background image. |
please provide a working Codesandbox (like what I did) so I can help you to debug your snippet |
Hi @raminious, hereby the sandbox: https://codesandbox.io/s/thirsty-sinoussi-jyqhz5 If you click the button, you see it adds another image, instead of replacing the current (drag the new image to see the previous behind it). |
It's happening because changing the url will call ps: I provided an example for you: https://codesandbox.io/s/priceless-leftpad-kldrkt?file=/src/Canvas.js |
Hi @raminious, Thanks for the reply, but reason why I do not want to use the board.background, is that I need to be able to drag the background image around. So setting it as board.background is not working for me. |
got it. I'll do my best to give you an example with Image by tomorrow. |
Hi @raminious, were you able to find a solution? Thanks for looking into this. |
Hi @udarts have you checked this before https://codesandbox.io/s/pikaso-update-image-gdygq8 |
Thanks @raminious, will have a look. |
I am trying to use svg images (using data base64 part), but I am unable to make it to work.
Is anyone able to use svg images?
The text was updated successfully, but these errors were encountered: