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

Filters is not working when image is inside an group. #4813

Closed
CrackerakiUA opened this issue Mar 13, 2018 · 5 comments · Fixed by #4828
Closed

Filters is not working when image is inside an group. #4813

CrackerakiUA opened this issue Mar 13, 2018 · 5 comments · Fixed by #4828
Labels

Comments

@CrackerakiUA
Copy link

Version

1.7.22

Test Case

http://jsfiddle.net/rok1yupd/10/

Steps to reproduce

When I apply filter to an image which is inside an group, that filter is not taking place directly, only when i save that image and loadFromJson the saved data.

Expected Behavior

Filters to apply directly.

Actual Behavior

Filters show up only when I do loadFromJson

@CrackerakiUA CrackerakiUA changed the title Filter is not working when image is inside an group. Filters is not working when image is inside an group. Mar 13, 2018
@asturur
Copy link
Member

asturur commented Mar 14, 2018

After you apply a filter, set the image as dirty, so the group knows that he has to rerender.
This could be handled a fabricLevel too anyway.

@CrackerakiUA
Copy link
Author

dirty is simply oImg.dirty = true; ?
here it's not working http://jsfiddle.net/rok1yupd/15/

@scriptspry
Copy link
Contributor

Setting the group as dirty seems to do the job.

Also another underlying issue here is that the filtering was not working because of CORS and tainting of the canvas on loading img from external domain.

Using imageOpts for the fabric.Image.fromURL fixed the CORS issue.

Working fiddle: http://jsfiddle.net/rok1yupd/23/

@CrackerakiUA
Copy link
Author

@scriptspry thank you

@asturur
Copy link
Member

asturur commented Mar 16, 2018

img.set('dirty', true) is going to update the group to dirty automatically.

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

Successfully merging a pull request may close this issue.

3 participants