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

Raphael.setWindow + drawing in iframe breaks gradient fill #1096

Open
Jouzer opened this issue Apr 6, 2018 · 1 comment
Open

Raphael.setWindow + drawing in iframe breaks gradient fill #1096

Jouzer opened this issue Apr 6, 2018 · 1 comment

Comments

@Jouzer
Copy link

Jouzer commented Apr 6, 2018

Hello, I wanted to report something I found, hope it's not a fail at my end.

I load the Raphael in a parent window and use it in same-origin iframe because I'm trying to optimize for a low-performance device I have and I want to load the library just once even if I "switch pages" (the src of the iframe)

It's working quite well, but a problem I came across is that the linear gradients don't work anymore. I think it's because in the generated SVG code the fill reference points to the parent window, in my case main.html, maybe it should point to the iframe html..?

Clip from dev tools view

<rect x="0" y="0" width="98.5" height="205.5" rx="0" ry="0" fill="url('file:///C:/Users/mk/generator/main.html#lyis490-rgba_255_255_255_0.8_-rgba_255_0_0_0.8_')" stroke="#000" style="opacity: 1; fill-opacity: 1;" opacity="1" fill-opacity="1" transform="matrix(1,0,0,1,188.317,587.622)">

I use it like this
parent.Raphael.setWindow(window);
var paper = parent.Raphael(0,0,1700.734,1017.337);

if I reverse the order of thse two lines, the paper won't be in the iframe (but it works then)
I also tried paper.setWindow(window); but it just errors.

Thanks for all the great work you've done!

@Jouzer
Copy link
Author

Jouzer commented May 1, 2018

I just wanted to drop by and add that I did test to change the fill attribute from the main.html to the iframe.html in the browser and it worked, so it seems to be a problem in referencing to the right html indeed. I'll try to fix it with my noob powers some day when it's relevant if no-one else is interested in checking it out.

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

No branches or pull requests

1 participant