auto: 2026-08-29 17:09 (EOMSANGDON-HOME)

This commit is contained in:
2026-08-29 17:09:22 +09:00
parent b3e6f01eb4
commit beb6e15f27
3 changed files with 55 additions and 9 deletions
@@ -1,5 +1,5 @@
import { Point, type Vector } from '@flatten-js/core';
import { MOUSE_ZOOM_MULTIPLIER } from '../App.consts';
import { WHEEL_ZOOM_EXPONENT } from '../App.consts';
import { getAngleWithXAxis } from '../helpers/get-angle-with-x-axis.ts';
import { getBoundingBoxOfMultipleEntities } from '../helpers/get-bounding-box-of-multiple-entities.ts';
import { mapNumberRange } from '../helpers/map-number-range.ts';
@@ -107,13 +107,14 @@ 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 exponent 델타 한 단위당 확대 지수 (휠·핀치가 서로 다른 값을 쓴다)
*/
public zoomScreen(deltaY: number) {
public zoomScreen(deltaY: number, exponent: number = WHEEL_ZOOM_EXPONENT) {
const worldMouseLocationBeforeZoom = this.getWorldMouseLocation();
const oldScreenScale = this.getScreenScale();
const newScreenScale =
oldScreenScale * (1 - MOUSE_ZOOM_MULTIPLIER * (deltaY / Math.abs(deltaY)));
// 부호가 아니라 크기까지 본다 — 트랙패드의 잔 델타는 그만큼만 움직인다.
const newScreenScale = oldScreenScale * Math.exp(-deltaY * exponent);
this.setScreenScale(newScreenScale);
// now get the location of the cursor in world space again