fix: separate desktop wheel and mobile pinch zoom
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
timelinePositionPercent,
|
||||
timelineRange,
|
||||
zoomFromWheel,
|
||||
zoomFromPinch,
|
||||
} from './boardDomain'
|
||||
|
||||
const folder: Evidence = {
|
||||
@@ -53,11 +54,15 @@ describe('board coordinate math', () => {
|
||||
expect(panViewport(state.viewport, { x: 25, y: -10 })).toEqual({ x: 35, y: 10, zoom: 0.5 })
|
||||
})
|
||||
|
||||
it('clamps toolbar and pinch zoom to the same limits', () => {
|
||||
it('clamps toolbar, wheel, and touch pinch zoom to the same limits', () => {
|
||||
expect(clampBoardZoom(-10)).toBe(MIN_BOARD_ZOOM)
|
||||
expect(clampBoardZoom(10)).toBe(MAX_BOARD_ZOOM)
|
||||
expect(zoomFromWheel(1, 10_000)).toBe(MIN_BOARD_ZOOM)
|
||||
expect(zoomFromWheel(1, -10_000)).toBe(MAX_BOARD_ZOOM)
|
||||
expect(zoomFromWheel(1, 100)).toBeCloseTo(0.85)
|
||||
expect(zoomFromPinch(1, 100, 125)).toBeCloseTo(1.25)
|
||||
expect(zoomFromPinch(1, 100, 50)).toBeCloseTo(0.5)
|
||||
expect(zoomFromPinch(1, 0, 120)).toBe(1)
|
||||
})
|
||||
|
||||
it('places new exhibits in deterministic open slots', () => {
|
||||
|
||||
Reference in New Issue
Block a user