test(client): drag through the camera transform after #69
Rebase #72 onto the map/pan-zoom lane. Drag e2e now converts world points to page points with the camera transform, drags at zoom 0.5 and 4, and proves a token drag leaves the camera alone while an empty-canvas gesture still pans. The camera publishes its x/y in `data-camera` for that (UI fact, like zoom). Also folds #69's duplicate viewport import in tiles.ts into one.
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
// so a pan is two numbers and never a redraw of the map.
|
||||
//
|
||||
// The module also owns the grid toggle button and the small `data-*` view contract the browser e2e
|
||||
// reads: `data-zoom` (the exact clamped number), `data-grid` (on/off) and `data-tiles` (the tile
|
||||
// reads: `data-zoom` (the exact clamped number), `data-camera` (the world container's `x,y`, so a
|
||||
// test can go screen <- world at any zoom), `data-grid` (on/off) and `data-tiles` (the tile
|
||||
// module marks `ready` when every wanted tile of the current viewport has settled). Those are UI
|
||||
// facts, not renderer internals.
|
||||
|
||||
@@ -51,6 +52,8 @@ export const renderModule: RenderModule = {
|
||||
world.scale.set(camera.zoom)
|
||||
world.position.set(camera.x, camera.y)
|
||||
canvas.dataset['zoom'] = String(camera.zoom)
|
||||
// Screen <- world for the browser e2e and drag tests: `screen = world * zoom + x,y`.
|
||||
canvas.dataset['camera'] = `${camera.x},${camera.y}`
|
||||
canvas.dataset['grid'] = grid ? 'on' : 'off'
|
||||
canvas.dataset['view'] = `${viewport.state.size.width}x${viewport.state.size.height}`
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
|
||||
import { Sprite, Texture } from 'pixi.js'
|
||||
import type { RenderModule } from '../stage.ts'
|
||||
import { viewport } from '../../viewport.ts'
|
||||
import { visibleTiles } from '../../viewport.ts'
|
||||
import { viewport, visibleTiles } from '../../viewport.ts'
|
||||
import { TileScheduler } from '../../tiles.ts'
|
||||
import type { TileLoadResult } from '../../tiles.ts'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user