Skip to content

Conversation

KristjanESPERANTO
Copy link

I always had a shift on the X-axis. This adjustment fixes the issue.

I always had a shift on the X-axis. This adjustment fixes the issue.
@mast4461
Copy link

I also noticed incorrect horizontal positioning of an icon, and I think the cause of the problem is that anchorRef.x matches the original size of the image, and isn't changed according to the icon size. I think the margin needs to account for the different sizes of the image and the icon, maybe like:

img.style.marginLeft = (-options.anchorRef.x / img.width * width) + 'px';

With this, if you had a 64px wide image (img.width) and an icon width of 32px (width), you'd get -options.anchorRef.x / 64 * 32 = -options.anchorRef.x * 32 / 64 = -options.anchorRef.x / 2.

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

Successfully merging this pull request may close these issues.

2 participants