jqEye icon indicating copy to clipboard operation
jqEye copied to clipboard

Issue with positioning changing on initial mouse interaction

Open EnriqueArmani opened this issue 5 years ago • 1 comments

I have the pupil positioned using percentages on the initial interaction with the mouse it jumps position upon reloading it works fine. http://138.68.18.223/static-test/

EnriqueArmani avatar Oct 12 '20 17:10 EnriqueArmani

Hi Enrique,

I think the issue on this case is that the position of the "eye" isn't defined until the .svg file has been loaded (in other words: when you first open the page, the "eye" is on the top of the screen, but when the .svg file is loaded then the "eye" is pushed at the bottom; when you reload the page this doesn't happens because the .svg has already been loaded), and this is a problem because the library uses the initial position of the "eye" to calculate the center (from which the "eye" moves).

I have made an update to the library, so the center is calculated when the user moves the mouse for the first time, instead of being calculated when you call $(".pupil-center").jqEye(), however this will only partially fix the issue.
For fully fix this issue you should call $(".pupil-center").jqEye() once the .svg file has been loaded (right now you are calling it once the page has been loaded, and you should wait a bit more).

jfmdev avatar Oct 14 '20 17:10 jfmdev