Files
nissefolk/src/test/main.ts
tekki mariani 7f0ef0554e add ZoomMouseScene with zoom-to-mouse correction
Implements scroll correction after cam.setZoom() so the world point
under the mouse stays fixed. Formula accounts for Phaser's
center-based zoom: scrollX += (mouseX - cw/2) * (1/zBefore - 1/zAfter).
Tab switches between the two test scenes in both directions.
Also fixes centerWorld formula in ZoomTestScene overlay and logs.
2026-03-21 11:49:39 +00:00

23 lines
523 B
TypeScript

import Phaser from 'phaser'
import { ZoomTestScene } from './ZoomTestScene'
import { ZoomMouseScene } from './ZoomMouseScene'
const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO,
width: window.innerWidth,
height: window.innerHeight,
backgroundColor: '#0d1a0d',
scene: [ZoomTestScene, ZoomMouseScene],
scale: {
mode: Phaser.Scale.RESIZE,
autoCenter: Phaser.Scale.CENTER_BOTH,
},
render: {
pixelArt: false,
antialias: true,
roundPixels: true,
},
}
new Phaser.Game(config)