MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / update

Method update

core/src/components/range/range.tsx:597–620  ·  view source on GitHub ↗
(currentX: number)

Source from the content-addressed store, hash-verified

595 }
596
597 private update(currentX: number) {
598 // figure out where the pointer is currently at
599 // update the knob being interacted with
600 const rect = this.rect;
601 let ratio = clamp(0, (currentX - rect.left) / rect.width, 1);
602 if (isRTL(this.el)) {
603 ratio = 1 - ratio;
604 }
605
606 if (this.snaps) {
607 // snaps the ratio to the current value
608 ratio = valueToRatio(ratioToValue(ratio, this.min, this.max, this.step), this.min, this.max);
609 }
610
611 // update which knob is pressed
612 if (this.pressedKnob === 'A') {
613 this.ratioA = ratio;
614 } else {
615 this.ratioB = ratio;
616 }
617
618 // Update input value
619 this.updateValue();
620 }
621
622 private setPressedKnob(currentX: number) {
623 const rect = (this.rect = this.rangeSlider!.getBoundingClientRect() as any);

Callers 2

onMoveMethod · 0.95
onEndMethod · 0.95

Calls 5

updateValueMethod · 0.95
clampFunction · 0.90
isRTLFunction · 0.90
valueToRatioFunction · 0.85
ratioToValueFunction · 0.85

Tested by

no test coverage detected