-
-
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
Fix for when toObjects is called on a canvas with a clipPath #5556
Fix for when toObjects is called on a canvas with a clipPath #5556
Conversation
src/static_canvas.class.js
Outdated
@@ -1177,7 +1177,7 @@ | |||
objects: this._toObjects(methodName, propertiesToInclude), | |||
}; | |||
if (clipPath) { | |||
data.clipPath = this._toObjectMethod(clipPath, methodName, propertiesToInclude); | |||
data.clipPath = this.clipPath; |
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.
wait, this should call _toOject anyway no?
In this way we are exporting the instance itself.
We want it's object representation.
…sentation of clipPath object, without the klass prototype
… fix a seemingly unknown issue at the time attributed to the QUnit, but was in fact to do with the clipPath not having _toObject applied to it, thus it keeping the klass prototype, and not a plain JS object
…the toObject method of the clipPath
@asturur changes to the test have been made now |
thanks! |
Hey guys, I just ran a quick test of this fix. While this does seem to resolve the issue with serializing a canvas with a clipPath, there appears to be a new bug when running Is this worth opening up a new issue? |
i think there is a pr open for the load fix |
ah thanks, I missed that - #5641 |
Details
Regarding issue: #5549
Bugs
_toObjectMethod
is calling itself recursively if a clipPath is present on the root canvas.klass
object itself, instead of the expected argumentString
methodName
, which breaks the subsequent totoObject
method. The reason it breaks is because it's trying to find a method withmethodName
, but because it's anobject
it fails and throws an error.Fix
_toObjectMethod
and instead apply the clipPath to the scoped variabledata
ifclipPath
exists, and returns that instead. This results in the expected behaviour when applying a clipPath with no errors.