* The value should be updated while dragging the * bar or knob. * * While the user is dragging, the view * should not scroll. This is to prevent the user from * feeling disoriented while dragging. * * The user can scroll on the view if the knob or * bar is not being dragged.
(detail: GestureDetail)
| 518 | * @param detail The details of the gesture event. |
| 519 | */ |
| 520 | private onMove(detail: GestureDetail) { |
| 521 | const { contentEl, pressedKnob } = this; |
| 522 | const currentX = detail.currentX; |
| 523 | |
| 524 | /** |
| 525 | * Since the user is dragging on the bar or knob, the view should not scroll. |
| 526 | * |
| 527 | * This only needs to be done once. |
| 528 | */ |
| 529 | if (contentEl && this.pressedKnob === undefined) { |
| 530 | this.initialContentScrollY = disableContentScrollY(contentEl); |
| 531 | } |
| 532 | |
| 533 | /** |
| 534 | * The `pressedKnob` can be undefined if the user just |
| 535 | * started dragging the knob. |
| 536 | * |
| 537 | * This is necessary to determine which knob the user is dragging, |
| 538 | * especially when using dual knobs. |
| 539 | * Plus, it determines when to apply certain styles. |
| 540 | * |
| 541 | * This only needs to be done once since the knob won't change |
| 542 | * while the user is dragging. |
| 543 | */ |
| 544 | if (pressedKnob === undefined) { |
| 545 | this.setPressedKnob(currentX); |
| 546 | } |
| 547 | |
| 548 | this.update(currentX); |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * The value should be updated on touch end: |
no test coverage detected