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

Add setBackgroundFromUrl method #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

karlvr
Copy link
Contributor

@karlvr karlvr commented Feb 2, 2019

This allows loading of cross origin images by adding crossOrigin: 'anonymous' to the options object. Using the existing setBackgroundFromDataUrl method it is not possible to use cross origin images as that implementation loads the Image first, and doesn't include a crossOrigin setting.

The same cross origin issue probably exists in addImg but I have not had a chance to investigate yet!

This allows loading of crossOrigin images by adding crossOrigin: ‘anonymous’ to the options object.
@karlvr
Copy link
Contributor Author

karlvr commented Feb 5, 2019

I've taken the liberty of adding a setBackgroundFromImage method too. This refactors the existing setBackgroundFromDataURL method to load the Image and then use the new method. I've used this form when I load the Image first in order to get things like its width and height, and then it's nice just to pass it directly to react-sketch.

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.

1 participant