Skip to content

Commit

Permalink
Fied #2145
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Oct 4, 2017
1 parent 7ea7b50 commit 4389e8f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/app/components/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@ export class Slider implements OnDestroy,ControlValueAccessor {

handleStepChange(newValue: number, oldValue: number) {
let diff = (newValue - oldValue);

if(diff < 0 && (-1 * diff) >= this.step / 2) {
newValue = oldValue - this.step;
this.updateValue(newValue);
this.updateHandleValue();
let val = oldValue;

if(diff < 0) {
val = oldValue + Math.ceil((newValue - oldValue) / this.step) * this.step;
}
else if(diff > 0 && diff >= this.step / 2) {
newValue = oldValue + this.step;
this.updateValue(newValue);
this.updateHandleValue();
else if(diff > 0) {
val = oldValue + Math.floor((newValue - oldValue) / this.step) * this.step;
}

this.updateValue(val);
this.updateHandleValue();
}

writeValue(value: any) : void {
Expand Down

0 comments on commit 4389e8f

Please sign in to comment.