-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Deep clone transformMatrix, strokeDashArray and styles properties #2407
Conversation
Added clone for the iText style. |
Added failing tests for the modified properties. |
@@ -1121,8 +1121,16 @@ | |||
* @return {Object} object representation of an instance | |||
*/ | |||
toObject: function(propertiesToInclude) { | |||
var newStyle = { }, i, j, row; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newStyle
→ clonedStyles
if it happens with styles it will happen with array also. |
But |
I do not understand what you mean, but the bug is there.
then run this code
|
@asturur not sure I understand the bug here... in your last example, you're changing values of transformMatrix and seeing result rendered, no? Isn't this expected behavior? |
i m changing the transformatrix of one rect, and all three are changing. |
Oh, I didn't realize it's cloned. Of course, you're right. |
One last thing — we don't want to use extend for arrays since it does for..in iteration and that kind of iteration doesn't just iterate over indices (0..n) but also anything in Array.prototype, etc. Just do transformMatrix.concat() to create a clone of array. |
@kangax done. |
Deep clone transformMatrix, strokeDashArray and styles properties
+changelog |
This will be hardly noticed by anyone.
But still is a bug.
closes #2396.