mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Add pointer-driven camera scripts with Cesium goldens, and count wheel lines as Cesium does
Five new camera conformance scripts move the camera by user input: a left drag that coasts, thirty pixel-mode and thirty line-mode wheel notches from 5 km, a middle-drag tilt, and Shift and Ctrl drags held too long to coast. The runner turns input steps into pointer events for a driver: a move starts where the pointer last pressed or moved and carries the held button. The golden recorder now drives Cesium's own screen-space camera controller on a stand-in canvas, with Date on the virtual clock so inertia is deterministic. The existing goldens are unchanged. A harness that answers pointer input sets cameraInput and a pointer hook. Harnesses without it, such as the stub, skip the input scripts. The input port reported a line-mode wheel at 33 1/3 pixels a line. It now counts lines as the reference does, 40 pixels a line and 3 lines a page, so a pixel or line wheel converts back to the same pixels.
This commit is contained in:
1 parent
ef616b7905
commit
90499762f5
16 files changed
+1055
-38
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @module render/input/wheel
|
||||
* @description A DOM wheel event as the input port's `wheel` delta: lines
|
||||
* scrolled, counted as the reference renderer counts them, so a camera
|
||||
* controller that turns lines back into pixels at `WHEEL_PX_PER_LINE`
|
||||
* zooms exactly as the reference does in every browser.
|
||||
*
|
||||
* The reference takes a pixel-mode wheel as its pixels, a line-mode one at
|
||||
* 40 px a line and a page-mode one at 120 px a page. Lines are those
|
||||
* pixels over 40: a line-mode wheel is its own lines, a page is 3 lines,
|
||||
* and a pixel-mode wheel (Chrome's notch is 100 px) is its pixels over 40
|
||||
* (2.5 lines a notch).
|
||||
*/
|
||||
|
||||
/** Pixels a wheel line stands for: the reference renderer's own count. */
|
||||
export const WHEEL_PX_PER_LINE = 40;
|
||||
/** Lines a wheel page stands for: the reference's 120 px a page. */
|
||||
export const WHEEL_LINES_PER_PAGE = 3;
|
||||
|
||||
/**
|
||||
* Lines scrolled by a DOM wheel event, down positive (as `deltaY`).
|
||||
* @param {{deltaY: number, deltaMode?: number}} event
|
||||
* @returns {number}
|
||||
*/
|
||||
export function wheelLines({ deltaY, deltaMode = 0 }) {
|
||||
if (deltaMode === 1) return deltaY;
|
||||
if (deltaMode === 2) return deltaY * WHEEL_LINES_PER_PAGE;
|
||||
return deltaY / WHEEL_PX_PER_LINE;
|
||||
}
|
||||
Reference in new issue
Block a user