Jump to content
Search Community

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Posted

Hi everybody,

 

I met an issue that is when I set the Top/Left position manually in onPress function that position values are rounded down even I tried using autoRound: false.

 

I created an example via codepen. Is there any way to prevent that issue, please share me.

Thanks in advance!

 

See the Pen EmvOmw by duytan (@duytan) on CodePen.

Posted

Thanks for the clear demo. We will look into this and get back to you. 

  • Like 1
GreenSock
Posted

Can you help us understand why you'd want to do that? Browsers always round the values anyway for display (unlike x/y transforms). I'm struggling to see any up-side to offering the ability to set top/left to sub-pixel values. And you're right, currently Draggable rounds those values. 

GreenSock
Posted

Interesting. Hm, do you have a reduced test case that shows the "lightly vibrated" effect? My understanding was that browsers simply won't display top/left in anything bug whole pixel values anyway (regardless of if it's %-based or px-based), so I'm curious to see this in action. 

 

One other approach you could take is to use type:"x,y" instead of "left,top" and just change your conversion math that gets it to the %-based top/left values. Just an idea. The x/y can definitely do sub-pixel rendering, and it'd probably perform slightly faster too. 

  • Like 1
Posted

Thanks for your feedback. That is clearer test case: 

See the Pen eWGRXE by duytan (@duytan) on CodePen.

which using Draggable latest ver 1.19.1. The element is slightly vibrated when checking on Safari.

I can't use "x,y" type in my case because of the consistency.

 

By the way, I found the solution in my case by just using Draggable ver 1.18.0. 

In my opinion, I think you should keep previous behavior, should not round position values maybe it can cause some problems like my case.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...