Skip to content

Commit

Permalink
fix(range): bar width works as expected
Browse files Browse the repository at this point in the history
fixes  #10150
  • Loading branch information
manucorporat committed Mar 3, 2017
1 parent c0b9cb8 commit 6100400
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/components/range/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,32 +428,28 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O

// update which knob is pressed
this._pressed = isPressed;

let valChanged = false;
if (this._activeB) {
// when the pointer down started it was determined
// that knob B was the one they were interacting with
this._pressedB = isPressed;
this._pressedA = false;
this._ratioB = ratio;

if (val === this._valB) {
// hasn't changed
return false;
}
valChanged = val === this._valB;
this._valB = val;

} else {
// interacting with knob A
this._pressedA = isPressed;
this._pressedB = false;
this._ratioA = ratio;

if (val === this._valA) {
// hasn't changed
return false;
}
valChanged = val === this._valA;
this._valA = val;
}
this._updateBar();
if (valChanged) {
return false;
}

// value has been updated
if (this._dual) {
Expand All @@ -478,8 +474,6 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O
this.ionChange.emit(this);
});

this._updateBar();

return true;
}

Expand Down Expand Up @@ -572,8 +566,7 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O

/** @internal */
_valueToRatio(value: number) {
value = Math.round((value - this._min) / this._step) * this._step;
value = value / (this._max - this._min);
value = (value - this._min) / (this._max - this._min);
return clamp(0, value, 1);
}

Expand Down

0 comments on commit 6100400

Please sign in to comment.