Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly disable needle animation ? #3

Closed
lgodard opened this issue Aug 24, 2018 · 1 comment
Closed

Possibly disable needle animation ? #3

lgodard opened this issue Aug 24, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@lgodard
Copy link
Contributor

lgodard commented Aug 24, 2018

in some use cases (eg. server-side convert to png) the needle animation has to be disabled

passing config.animationDuration = 0 is not a possibility as the constructor test evaluates it to false and then uses the CONSTANT.NEEDLE_ANIMATION_DURATION

many possibilities

  1. using config.animationDuration = 0.001 works (hackish though)
  2. change CONSTANT.NEEDLE_ANIMATION_DURATION default value to 0 - the animation will be defined but with instant evaluation
  3. creates a boolean deactivateAnimation and modify Needleclass accordingly
  4. creates an animation object property and only set the animation if defined
animation: {
  duration: 3000,
  delay: 0
}

I personally would prefer option 4. (or 2.)

Any opinion ?

@antoinebeland antoinebeland added the bug Something isn't working label Aug 24, 2018
@antoinebeland
Copy link
Owner

Hi @lgodard,

I think the easier and more elegant solution is to change condition in the constructor. Instead to do the following condition to set the animation duration,

this._animationDuration = config.animationDuration || CONSTANTS.NEEDLE_ANIMATION_DURATION;

It will be better if I changed this condition by the following:

this._animationDuration = (config.animationDuration !== undefined) 
  ?  config.animationDuration 
  : CONSTANTS.NEEDLE_ANIMATION_DURATION;

Thus, it will be possible to set the animationDuration to 0 without any other changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants