GithubHelp home page GithubHelp logo

Comments (8)

ovidiuch avatar ovidiuch commented on June 16, 2024

Is there a way to have a listener listen for when the user lets go of the handle and the animation ends on one of the steps?

The animationCallback gives you the exact value of handle as long as the handle is moving. You can detect the current step either by calling getStep() or by calculating it yourself using the value and the number of steps you have.

Is there a listener for when the user is dragging the handle and pauses whiles still holding down the handle?

No direct solution at the moment, can't think of an idea.

from dragdealer.

lsdoodle avatar lsdoodle commented on June 16, 2024

Yes I am aware of the animationCallback, however I am looking for when the handle animation is complete.

lindsey siehda

lsdoodle.com
WhimInspiration.com

On Nov 24, 2014, at 4:49 PM, Ovidiu Cherecheș [email protected] wrote:

Is there a way to have a listener listen for when the user lets go of the handle and the animation ends on one of the steps?

The animationCallback gives you the exact value of handle as long as the handle is moving. You can detect the current step either by calling getStep() or by calculating it yourself using the value and the number of steps you have.

Is there a listener for when the user is dragging the handle and pauses whiles still holding down the handle?

No direct solution at the moment, can't think of an idea.


Reply to this email directly or view it on GitHub.

from dragdealer.

ovidiuch avatar ovidiuch commented on June 16, 2024

Yes I am aware of the animationCallback, however I am looking for when the handle animation is complete.

Maybe I'm missing something, but wouldn't this do it?

var waitingForAnimation = true,
    prevX = null;

// ...

animationCallback: function(x) {
  if (!waitingForAnimation) {
    return;
  }
  if (x == prevX) {
    console.log('animation finished');
    waitingForAnimation = false;
    prevX = null;
  } else {
    prevX = x;
  }
}

Sorry for the hackish solution, no out-of-the-box one comes to mind.

from dragdealer.

lsdoodle avatar lsdoodle commented on June 16, 2024

Better than mine, using a timer. Thanks!

Sent from my iPhone

On Dec 6, 2014, at 12:34 PM, Ovidiu Cherecheș [email protected] wrote:

Yes I am aware of the animationCallback, however I am looking for when the handle animation is complete.

Maybe I'm missing something, but wouldn't this do it?

var waitingForAnimation = true,
prevX = null;

// ...

animationCallback: function(x) {
if (!waitingForAnimation) {
return;
}
if (x == prevX) {
console.log('animation finished');
waitingForAnimation = false;
prevX = null;
} else {
prevX = x;
}
}
Sorry for the hackish solution, no out-of-the-box one comes to mind.


Reply to this email directly or view it on GitHub.

from dragdealer.

lsdoodle avatar lsdoodle commented on June 16, 2024

I am working with your solution and the only problem is, is that prevX never ends up equaling x, so it will never call when animation is finished?

lindsey siehda

lsdoodle.com
WhimInspiration.com

On Dec 6, 2014, at 12:34 PM, Ovidiu Cherecheș [email protected] wrote:

if (!waitingForAnimation) {
return;
}
if (x == prevX) {
console.log('animation finished');
waitingForAnimation = false;
prevX = null;
} else {
prevX = x;
}

from dragdealer.

ovidiuch avatar ovidiuch commented on June 16, 2024

Are you using the latest version of Dragdealer, I know this was an issue at some point but was fixed in #21

from dragdealer.

lsdoodle avatar lsdoodle commented on June 16, 2024

Yes I am 0.9.7 , If you test your code you provided you will see it never gets called.

Also, is there a tween on the slider animation? Any way to set that tween?

lindsey siehda

lsdoodle.com
WhimInspiration.com

On Dec 10, 2014, at 3:17 PM, Ovidiu Cherecheș [email protected] wrote:

Are you using the latest version of Dragdealer, I know this was an issue at some point but was fixed in #21


Reply to this email directly or view it on GitHub.

from dragdealer.

ovidiuch avatar ovidiuch commented on June 16, 2024

You're right, the animationCallback will never be called with the same value twice. I'm sorry, I don't think you can achieve the desired effect out of the box. If you have the time and will you might be able to fork Dragdealer and add some extra callbacks to server your needs. Some cues:

Also, is there a tween on the slider animation? Any way to set that tween?

No. This has been a long wish of mine from the beginning, but it would mean refactoring most of the original code so it never happened. What Dragdealer does is eat up part (based on speed option) of the remaining delta distance with every animation frame, until it reaches the target position

from dragdealer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.