Jump to content
Search Community

draggable bounds object not based on the entire page's coordinate system

annam test
Moderator Tag

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

Hello,

 

We recently updated to the latest version of Draggable and there's seems to have been a change in functionality regarding bounds:

 

Even though the docs

 

 

 

you can define bounds as a rectangle instead, like bounds:{top:100, left:0, width:1000, height:800} which is based on the entire page's coordinate system (top/left would be from the upper left corner of the unscrolled page)

 

this seems to no longer be the case. 

 

If the draggable element is inside an absolutely positioned element, the bounds are relative to the parent element and not the entire page.

 

here's a jsfiddle: http://jsfiddle.net/annam/Y9Y3D/

 

This definitely worked as described in the docs prior to the latest draggable update. 

 

Has this behaviour been changed and the docs are out of date, or is this a bug?

 

Thanks,

Anna

Link to comment
Share on other sites

I apologize for any confusion there - yes, the rectangle is relative to the parent's coordinate system. The reason this is important in newer versions of Draggable is because it now accommodates transforms in the chain (like if the parent is rotated) which wouldn't work properly if the bounds had a different axis rotation. I have updated the docs accordingly. 

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

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...