auto: 2026-08-29 16:53 (EOMSANGDON-HOME)
This commit is contained in:
@@ -69,6 +69,7 @@ export class ScreenCanvasDrawController implements DrawController {
|
||||
}
|
||||
|
||||
public setScreenScale(newScreenScale: number) {
|
||||
console.log(`set screen scale: ${newScreenScale}`);
|
||||
this.screenScale = newScreenScale;
|
||||
triggerReactUpdate(StateVariable.screenZoom);
|
||||
}
|
||||
@@ -106,14 +107,13 @@ export class ScreenCanvasDrawController implements DrawController {
|
||||
* This function takes the deltaY from the mouse wheel event and zooms the screen in or out
|
||||
* The location of the mouse in world space is preserved
|
||||
* @param deltaY
|
||||
* @param strength 한 번에 얼마나 확대할지(휠 한 칸 = 1). 트랙패드의 잔 델타용.
|
||||
*/
|
||||
public zoomScreen(deltaY: number, strength = 1) {
|
||||
public zoomScreen(deltaY: number) {
|
||||
const worldMouseLocationBeforeZoom = this.getWorldMouseLocation();
|
||||
const oldScreenScale = this.getScreenScale();
|
||||
|
||||
const newScreenScale =
|
||||
oldScreenScale * (1 - MOUSE_ZOOM_MULTIPLIER * strength * (deltaY / Math.abs(deltaY)));
|
||||
oldScreenScale * (1 - MOUSE_ZOOM_MULTIPLIER * (deltaY / Math.abs(deltaY)));
|
||||
this.setScreenScale(newScreenScale);
|
||||
|
||||
// now get the location of the cursor in world space again
|
||||
|
||||
@@ -232,14 +232,9 @@ export class InputController {
|
||||
return; // We can't zoom by zero delta
|
||||
}
|
||||
const drawController = getScreenCanvasDrawController();
|
||||
// 휠 한 칸(deltaY 100, 줄 단위면 3)을 세기 1로 본다. 트랙패드는 잔 델타를
|
||||
// 초당 수십 번 보내므로 세기를 델타에 비례시켜야 한 번에 튀지 않는다.
|
||||
const notch = evt.deltaMode === 0 ? 100 : 3;
|
||||
const strength = Math.min(1, Math.max(0.12, Math.abs(evt.deltaY) / notch));
|
||||
// Aislo: wheel direction is inverted on purpose - pulling the wheel zooms in, pushing
|
||||
// zooms out, matching the B04/B05 maps and the B06 cross sections (2026-08-02).
|
||||
// 다만 트랙패드 핀치(ctrl+휠)는 OS 관행대로 — 손가락을 벌리면 커진다.
|
||||
drawController.zoomScreen(evt.ctrlKey ? evt.deltaY : -evt.deltaY, strength);
|
||||
drawController.zoomScreen(-evt.deltaY);
|
||||
}
|
||||
|
||||
public handleMouseDown(evt: MouseEvent) {
|
||||
|
||||
Reference in New Issue
Block a user