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

Method setPressedKnob

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

Source from the content-addressed store, hash-verified

620 }
621
622 private setPressedKnob(currentX: number) {
623 const rect = (this.rect = this.rangeSlider!.getBoundingClientRect() as any);
624
625 // figure out which knob they started closer to
626 let ratio = clamp(0, (currentX - rect.left) / rect.width, 1);
627 if (isRTL(this.el)) {
628 ratio = 1 - ratio;
629 }
630 this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
631 }
632
633 private get valA() {
634 return ratioToValue(this.ratioA, this.min, this.max, this.step);

Callers 2

onMoveMethod · 0.95
onEndMethod · 0.95

Calls 2

clampFunction · 0.90
isRTLFunction · 0.90

Tested by

no test coverage detected