thdoan / magnify

A lightweight jQuery magnifying glass zoom plugin.
https://thdoan.github.io/magnify/
MIT License
243 stars 63 forks source link

Uncaught TypeError Due to Missing Original Event #63

Open karthicks opened 5 years ago

karthicks commented 5 years ago

Every once in a while, when the mouse moves out of the image, the following error is seen:

jquery.magnify.js:87 Uncaught TypeError: Cannot read property '0' of undefined
    at HTMLUnknownElement.moveLens (jquery.magnify.js:87)
    at HTMLUnknownElement.dispatch (jquery.js:5237)
    at HTMLUnknownElement.elemData.handle (jquery.js:5044)

If we can maybe return from the moveLens method if the event doesn't have a originalEvent, then perhaps that might be a good enough workaround?

              // Save last coordinates in case we need to call this function directly (required when
              // updating magnifiedWidth/magnifiedHeight while the lens is visible).
              nPosX = e.pageX || e.originalEvent.touches[0].pageX;
              nPosY = e.pageY || e.originalEvent.touches[0].pageY;
sanjay-makwana-avidbrio commented 3 years ago

@karthicks I think you did not add the magnify.css add and check it