Skip to content
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

WIP Patternload #3598

Merged
merged 21 commits into from Dec 30, 2016
Merged

WIP Patternload #3598

merged 21 commits into from Dec 30, 2016

Conversation

asturur
Copy link
Member

@asturur asturur commented Dec 30, 2016

close #935

create a fromObject function that can wait for patterns in stroke and fill to be loaded.
Make all objects able to be loaded with a callback

@asturur asturur merged commit edb90be into master Dec 30, 2016
@asturur asturur deleted the patternload branch January 1, 2017 09:49
@mariotacke
Copy link

mariotacke commented Jan 26, 2017

This is a breaking change from 1.7.2 to 1.7.3. We had the following code:

fabric.Image.filters.Thresholding.fromObject = function (object) {
  return new fabric.Image.filters.Thresholding(object);
};

This no longer works. Is the required callback documented anywhere? I was not able to see this change via the release changelog.

We had to change the code to:

fabric.Image.filters.Thresholding.fromObject = function (object, callback) {
  var instance = new fabric.Image.filters.Thresholding(object);
  callback(instance);
};

@asturur
Copy link
Member Author

asturur commented Jan 26, 2017

oh well, i think you are right. for custom saved json this may be a problem. you can also return the instance for normal restoring.
I should have switched to 1.8.0 for this change at least.

i will.come back with more example and docs

@asturur
Copy link
Member Author

asturur commented Jan 26, 2017

for example the base filter fromObject will serve the purpose of any filter restore unless you have some special code.

So in your case if the Thresholding filter is of type Thresholding

fabric.Image.filters.Thresholding.fromObject = fabric.Image.filters.BaseFilter.fromObject;

would be enough.

I will add this notice in the changelog, not doing it was a fault.

@mariotacke
Copy link

I appreciate the transparency! Will adjust our code to your suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load from JSON is not working with Patterns in the latest version of Fabric.js
2 participants