GithubHelp home page GithubHelp logo

Comments (4)

pschuegr avatar pschuegr commented on August 26, 2024

And I just noticed that if I use safeLoad: true && scaleMap: false, then it doesn't recalculate the coords. Thanks again!

from imagemapster.

jamietre avatar jamietre commented on August 26, 2024

No worries. Is this safari or a different browser? It will try to recalculate the areas whenever it thinks that the image isn't being shown in its native size. it sounds like this is related to an early-binding problem and the width/height are zero. It shouldn't be even checking that yet, as it should still be in the load loop. In my attempts to fix this before, I am not sure I even realized it was recalculating the areas - this could be a key to a way around this. It sounds like the "load" event is being fired, or some other indicator that the image is loading, is presenting before the effective height/width are available, so maybe I can check for those too (in addition to "complete", "onload", "naturalWidth.." .. it's a little ridiculous how hard this it to do :)

Anyway the safeLoad thing will not work for dynamic loads because it simply waits for window.onload which has already come and gone in that situation. The actual demo page on the web site suffers from this exact problem on Safari, as it too is loaded dynamically. I have hacked it to simply reload itself (so the inner content is loaded with the page instead of through ajax) when it detects Safari as a workaround. Not a great solution but I still haven't been able to figure out something that works reliably on Safari as yet.

I would love to be able to figure out a robust solution for this problem, if you have looked at the change log, you can see it has been a huge thorn in my side.

Anyway -- can you post a link to an example where you're having this problem? Maybe it will give me some more information that I'm not seeing in my own use case.

from imagemapster.

jamietre avatar jamietre commented on August 26, 2024

Just saw your update - yeah scaleMap: false will stop that - but still sounds like it's binding early, could cause other problems. If you have a public link to the broken version I'd be interested in looking at it.

from imagemapster.

jamietre avatar jamietre commented on August 26, 2024

Just figured out one part of the safari problem: even for cached images, it doesn't necessarily let you access a copy right away, so I set up a callback for that, too, when testing the native size. This should fix the "infinity" issue.

However there is a separate issue when loading asynchronously, at least in my use case:

http://www.outsharked.com/test/imagemapster/default.aspx?demos.html

Direct load works now (it used to not work before the images were cached). Navigate away & back, though, and it doesn't bind properly when loading async, but no errors. Only in safari.

I would be interested to know if this code (beta 23) solves your problem with scaleMap: true

from imagemapster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.