How to use the @better-scroll/shared-utils.Direction.Default function in @better-scroll/shared-utils

To help you get started, we’ve selected a few @better-scroll/shared-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ustbhuangyi / better-scroll / packages / core / src / scroller / Behavior.ts View on Github external
move(delta: number) {
    delta = this.hasScroll ? delta : 0
    this.movingDirection =
      delta > 0
        ? Direction.Negative
        : delta < 0
        ? Direction.Positive
        : Direction.Default

    let newPos = this.currentPos + delta

    // Slow down or stop if outside of the boundaries
    if (newPos > this.minScrollPos || newPos < this.maxScrollPos) {
      if (
        (newPos > this.minScrollPos && this.options.bounces[0]) ||
        (newPos < this.maxScrollPos && this.options.bounces[1])
      ) {
        newPos = this.currentPos + delta / 3
      } else {
        newPos =
          newPos > this.minScrollPos ? this.minScrollPos : this.maxScrollPos
      }
    }
    return newPos
github ustbhuangyi / better-scroll / packages / core / src / scroller / Behavior.ts View on Github external
updateDirection() {
    const absDist = Math.round(this.currentPos) - this.absStartPos
    this.direction =
      absDist > 0
        ? Direction.Negative
        : absDist < 0
        ? Direction.Positive
        : Direction.Default
  }
github ustbhuangyi / better-scroll / packages / core / src / scroller / Behavior.ts View on Github external
start() {
    this.direction = Direction.Default
    this.movingDirection = Direction.Default
    this.dist = 0
  }
github ustbhuangyi / better-scroll / packages / core / src / scroller / Behavior.ts View on Github external
start() {
    this.direction = Direction.Default
    this.movingDirection = Direction.Default
    this.dist = 0
  }