mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
17 lines
542 B
JavaScript
17 lines
542 B
JavaScript
import { clamp } from "@videojs/utils/number";
|
|
//#region src/dom/ui/wheel-step.ts
|
|
function createWheelStep(options) {
|
|
return { onWheel(event) {
|
|
if (options.isDisabled()) return;
|
|
const direction = Math.sign(event.deltaY);
|
|
if (direction === 0) return;
|
|
event.preventDefault();
|
|
const stepPercent = options.getStepPercent();
|
|
const newPercent = clamp(options.getPercent() - direction * stepPercent, 0, 100);
|
|
options.onValueChange?.(newPercent);
|
|
} };
|
|
}
|
|
//#endregion
|
|
export { createWheelStep };
|
|
|
|
//# sourceMappingURL=wheel-step.js.map
|