Jump to content
GreenSock

midimid

Clicking stops 'snapped' Throw

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

When I throw a Draggable and then click it before it finishes, the snapping doesn't complete. Is there a setting I'm missing?

 

the attached example is a typical slideshow, fixed at -100 to 100, three 100px images within a single '.slide' container.

 

If I 'throw' the container and click it before the throw is complete, it doesn't complete the snap, the tween just stops.

Draggable.create('.slide'),{
	type:"x", lockAxis:true, zIndexBoost: false, cursor: "pointer", 
	maxDuration: 0.5, throwResistance: 0, dragResistance: 0.5, edgeResistance: 0.9,
	bounds:{minX:-100, maxX:100}, throwProps: true, 
	snap:{
		x: function(endValue) {
			return Math.round(endValue / 100) * 100;
		}
	},
	onClick: function(evt) {
		console.log('click!');
	},
	onDrag: function(evt) {
		fadeInOut(this.x);
	},
	onThrowComplete: function(evt) {
		console.log('onThrowComplete')
	},
	onThrowUpdate: function(evt) {
		fadeInOut(this.x);
	},
	onDragEnd: function(evt) {
        console.log('onDragEnd');
	}
});
Link to comment
Share on other sites

Good catch. We're looking into this and should have a fix in the next release. I do see the behavior you're talking about (clicking on an in-progress tweening element without moving it results in it not snapping upon release). 

Link to comment
Share on other sites

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