mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 09:22:15 +00:00
8fd46c4c18
Small requests from the discussions, each built end to end: planner and map (cycling mode, date first headings, clear a day, stay times per day, off-route stops, map lock, compact unplanned markers, pending stays, cable car, transit quick picks), places (location filter, category from OSM, open in maps, geo: link, image from an attachment, enrichment on file import, places near a pin, place name language, Amap first in China), lists and costs (packed counter, inherited sharing, Markdown to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned places, travel only, without photos), journey (photo zoom, drafts, photo order, trip suggestion, day jump), atlas (region counter, region bucket list, places per country), vacay half company holidays, studio copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for a first start restore.
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
// FE-JOURNEY-ZOOM-001 to FE-JOURNEY-ZOOM-004 (#1484)
|
|
import { describe, it, expect } from 'vitest'
|
|
import { clampOffset, NO_ZOOM, panBy, toggleZoom, zoomAt } from './photoZoom'
|
|
|
|
describe('photoZoom', () => {
|
|
it('FE-JOURNEY-ZOOM-001: zooms into the point under the pointer and stays within 1x to 4x', () => {
|
|
expect(zoomAt(NO_ZOOM, 2, 50, 20, 400, 300)).toEqual({ scale: 2, x: -50, y: -20 })
|
|
expect(zoomAt(NO_ZOOM, 9, 0, 0, 400, 300).scale).toBe(4)
|
|
expect(zoomAt({ scale: 2, x: 30, y: 0 }, 0.5, 0, 0, 400, 300)).toEqual(NO_ZOOM)
|
|
})
|
|
|
|
it('FE-JOURNEY-ZOOM-002: never lets the photo slide off its own place', () => {
|
|
expect(clampOffset({ scale: 2, x: 999, y: -999 }, 400, 300)).toEqual({ scale: 2, x: 200, y: -150 })
|
|
expect(panBy({ scale: 2, x: 0, y: 0 }, 30, 40, 400, 300)).toEqual({ scale: 2, x: 30, y: 40 })
|
|
})
|
|
|
|
it('FE-JOURNEY-ZOOM-003: a double click goes in, and back out from anywhere', () => {
|
|
expect(toggleZoom(NO_ZOOM, 0, 0, 400, 300).scale).toBe(2.5)
|
|
expect(toggleZoom({ scale: 3.2, x: 10, y: 10 }, 0, 0, 400, 300)).toEqual(NO_ZOOM)
|
|
})
|
|
})
|