Replies: 2 comments 2 replies
-
http://fabricjs.com/docs/fabric.util.object.html#.extend Look at the extend docs: Does not clone or extend fabricJS objects. You have to use the clone method of the object itself if you want to clone a fabricJS object.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
for instancing you can use Object.FromObject, after you serialized it with ToObject() Object.clone is from instance to instance. They are all async with a callback, because if images or patterns are involved you need to wait the loading |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Im trying to deep clone an instance of simple objects and group with fabric using fabric.util.object.clone however, the behavours are not consistant and really strange.
heres an example link to jsfiddle
the clones are
A. when cloning the regular circle (red) if i then resize any of the clones:
When clicking the other clone its bounding box are not updating, until resizing it a bit.
The clone isnt updated until i click on the canvas.
B. when cloning the group:
Resizing gets even funkier, if i resize the new clone first it might just make all the clones disappear (as if they have clipping mask).
If resizing the OG first the bounding box of the clones are not updated as well but cant be fixed (because of B.1).
Also like before no RT update.
C. cached group cloning (objectCaching: false):
If i click the newly created one one the bounding box is way off.
If i move the original object, it moves also the clone.
I would appreciate any help. Thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions