Jump to content
GreenSock

chriswyl

Draggable update bounds attribute

Go to solution Solved by Diaco,

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,

 

How can I update bounds attribute, without creating new instance?

 

 

 Draggable.create("#elmnt", {
        edgeResistance:1,
        force3d:false,
        bounds:{minX:-200, maxX:0, minY:-200, maxY:0},
        throwProps:true,
        type:"x,y"});
 
 
It it would look like this ;)
 
Draggable.update("#elmnt",{ bounds:{minX:-100, maxX:0, minY:-150, maxY:0}});
 
 
 
Link to comment
Share on other sites

  • Solution

Hi chriswyl :)

 

you need .applyBounds() : 

 

http://greensock.com/docs/#/HTML5/GSAP/Utils/Draggable/applyBounds/

 

var draggable =  Draggable.create("#elmnt", {
   type:"x,y" ,
   bounds:{minX:-200, maxX:0, minY:-200, maxY:0}
});

draggable[0].applyBounds({minX:-100, maxX:0, minY:-150, maxY:0});// Immediately updates and applies bounds
  • Like 5
Link to comment
Share on other sites

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