CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-better-scroll--mouse-wheel

A TypeScript plugin for BetterScroll that provides enhanced mouse wheel scrolling capabilities with configurable speed, direction, easing, and boundary damping on PC platforms.

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-9/

Dynamic Scroll Boundary Controller

A utility that creates a scrollable container with customizable scroll boundaries using BetterScroll's boundary computation hooks.

Capabilities

Initializes scroll with boundary hooks

  • Creates a BetterScroll instance with vertical scrolling and registers boundary modification hooks @test

Modifies scroll boundaries using multiplier

  • When multiplier is set to 0.5, the maximum scroll position is limited to 50% of the content height @test
  • When multiplier is set to 0.75, the maximum scroll position is limited to 75% of the content height @test

Modifies scroll boundaries using offset

  • When offset is set to -100, the scroll range shifts by 100 pixels @test

Retrieves current boundaries

  • getBoundaries() returns an object with maxScrollY and minScrollY properties reflecting current boundary state @test

Implementation

@generates

API

export interface BoundaryModifier {
  multiplier?: number;
  offset?: number;
}

export class DynamicScrollController {
  /**
   * Creates a new scroll controller with dynamic boundary modification
   * @param wrapperEl - The wrapper element selector or HTMLElement
   * @param contentEl - The content element selector or HTMLElement (optional)
   * @param options - BetterScroll options (optional)
   */
  constructor(wrapperEl: string | HTMLElement, contentEl?: string | HTMLElement, options?: any);

  /**
   * Sets boundary modification parameters
   * @param modifier - Object containing multiplier and/or offset for boundary modification
   */
  setBoundaryModifier(modifier: BoundaryModifier): void;

  /**
   * Refreshes the scroll instance to recalculate boundaries
   */
  refresh(): void;

  /**
   * Gets the current scroll boundaries
   * @returns Object with maxScrollY and minScrollY
   */
  getBoundaries(): { maxScrollY: number; minScrollY: number };

  /**
   * Gets the underlying BetterScroll instance
   */
  getScrollInstance(): any;

  /**
   * Destroys the scroll instance and cleans up
   */
  destroy(): void;
}

Dependencies { .dependencies }

@better-scroll/core { .dependency }

Provides the core scrolling functionality with hook system for boundary computation.

{
  "@better-scroll/core": "^2.5.0"
}

Install with Tessl CLI

npx tessl i tessl/npm-better-scroll--mouse-wheel

tile.json