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

MapHilight v1.4.0 broken on Firefox when using SVG image (naturalWidth === 0) #94

Open
Kadigan opened this issue Mar 20, 2020 · 1 comment

Comments

@Kadigan
Copy link

Kadigan commented Mar 20, 2020

I traced the issue down to the canvas context, this bit:

if(typeof img.naturalWidth != "undefined" && img.naturalWidth === 0) {

Unfortunately, as per Mozilla Bug ID #700533 (funnily enough - opened 9 years ago, and still open...), Firefox returns a 0 on both naturalWidth and naturalHeight when using an SVG image.

As such, on Firefox and when using SVG, it's locked in a permanent "waiting for the image to load" loop. The image is, of course, loaded.

If I return true from there, everything else works as exepcted.

@Kadigan
Copy link
Author

Kadigan commented Mar 21, 2020

For now, I've fixed my local version by adding a check against SVG + Mozilla combo, and then returning true. I'm using Promises to load up the image, I'm pretty sure it's loaded by that point.

Perhaps it could be something I can switch off in the params? Something like

assumeImageLoaded: true /* skips testing whether the map image is loaded or not */

to add to my defaults on configuration.

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