refactor(commands): centralize command ids
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Dispatch } from "@commands/dispatcher";
|
||||
import { commandIds } from "@commands/ids";
|
||||
import type { GlobalPointerConsumer, GlobalWheelConsumer, PointerInputEvent, WheelInputEvent } from "./pointer";
|
||||
|
||||
export type ViewportPointerPanHandler = {
|
||||
@@ -37,7 +38,7 @@ export function createViewportPointerPanHandler(options: {
|
||||
};
|
||||
|
||||
lastPosition = event.position;
|
||||
options.dispatch("viewport.pan", {
|
||||
options.dispatch(commandIds.viewportPan, {
|
||||
delta: {
|
||||
x: -screenDelta.x / zoom,
|
||||
y: -screenDelta.y / zoom,
|
||||
@@ -69,7 +70,7 @@ export function handleViewportWheel(options: {
|
||||
if (options.globalConsumer(options.event)) return true;
|
||||
|
||||
const zoomFactor = Math.exp(-options.event.delta.y * 0.001);
|
||||
options.dispatch("viewport.zoomAroundPoint", {
|
||||
options.dispatch(commandIds.viewportZoomAroundPoint, {
|
||||
zoom: options.currentZoom * zoomFactor,
|
||||
point: options.event.position,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user