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

Fix X shift #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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