Jump to content
Search Community

Inertia plugin end prop double firing

Martin Shuttleworth TM test
Moderator Tag

Recommended Posts

Hey - I'm trying to get the inertia plugin to only ever land on the next notch, after enough digging it seems like I want a function in the inertia prop for end - my issue is that it seems to be double firing, which makes my life a little harder.

 

I've just added a quick console log to the prop in the draggable demo pen - I'm seeing the double fire on every drag end.

See the Pen bGVamMx by fr1n63 (@fr1n63) on CodePen

Link to comment
Share on other sites

It's fine if you add a function for the y component, but I would just use the function in snap.

 

@GreenSock @ZachSaucier How about changing the inertia section in the Draggable docs? This is SOOOOOooooooooo confusing.

 

image.thumb.png.4709da2b600b7e1ff0283fe1c7409d20.png

 

Just list those properties like every other property, but make a note that they require the inertia plugin to work.

 

  • Like 1
Link to comment
Share on other sites

Sorry about that, @Martin Shuttleworth TM. I see what you mean. It was indeed getting called once to calculate the duration, and again when calculating final values. I've reworked some of the guts to avoid that 2nd call in the upcoming release which you can preview (on codepen) at https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/InertiaPlugin.min.js

 

Better? 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Ok, tried it this morning, not sure if I've done something wrong compared to your setup, but I'm getting the warning about it being a 'special' version so I'm pretty convinced I'm running the updated version.

 

I'm still seeing the double firing both in the initial inertia:{ x: {end: func}}} and also the inertia: true, snap: func,

Link to comment
Share on other sites

7 hours ago, Martin Shuttleworth TM said:

I'm getting the warning about it being a 'special' version so I'm pretty convinced I'm running the updated version.

Are you trying to use it locally or on codepen? And did you clear your cache?

 

7 hours ago, Martin Shuttleworth TM said:

I'm still seeing the double firing both in the initial inertia:{ x: {end: func}}} and also the inertia: true, snap: func,

Is there any way you could provide a reduced test case in codepen? I tried your original codepen and I'm not seeing the double-call. I wonder if maybe you just forgot to clear your cache? 

  • Like 1
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.
×
×
  • Create New...