mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
feat(studio): support trackpad timeline pinch zoom
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
clampTimelineZoomPercent,
|
||||
getNextTimelineZoomPercent,
|
||||
getPinchTimelineZoomPercent,
|
||||
getTimelinePixelsPerSecond,
|
||||
getTimelineZoomPercent,
|
||||
MAX_TIMELINE_ZOOM_PERCENT,
|
||||
@@ -60,3 +61,23 @@ describe("getNextTimelineZoomPercent", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getPinchTimelineZoomPercent", () => {
|
||||
it("zooms in for upward pinch wheel deltas", () => {
|
||||
expect(getPinchTimelineZoomPercent(-80, "fit", 100)).toBeGreaterThan(100);
|
||||
});
|
||||
|
||||
it("zooms out for downward pinch wheel deltas", () => {
|
||||
expect(getPinchTimelineZoomPercent(80, "manual", 200)).toBeLessThan(200);
|
||||
});
|
||||
|
||||
it("keeps the current zoom for zero or invalid deltas", () => {
|
||||
expect(getPinchTimelineZoomPercent(0, "manual", 180)).toBe(180);
|
||||
expect(getPinchTimelineZoomPercent(Number.NaN, "manual", 180)).toBe(180);
|
||||
});
|
||||
|
||||
it("clamps pinch zoom to the supported range", () => {
|
||||
expect(getPinchTimelineZoomPercent(10000, "manual", 100)).toBe(MIN_TIMELINE_ZOOM_PERCENT);
|
||||
expect(getPinchTimelineZoomPercent(-10000, "manual", 100)).toBe(MAX_TIMELINE_ZOOM_PERCENT);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user