| 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); |