refactor(commands): centralize command ids
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect, type RefObject } from "react";
|
||||
import type { Dispatch } from "@commands/dispatcher";
|
||||
import { commandIds } from "@commands/ids";
|
||||
|
||||
export function useCanvasResize(canvasRef: RefObject<HTMLCanvasElement | null>, dispatch: Dispatch) {
|
||||
useEffect(() => {
|
||||
@@ -11,7 +12,7 @@ export function useCanvasResize(canvasRef: RefObject<HTMLCanvasElement | null>,
|
||||
|
||||
const width = Math.floor(entry.contentRect.width);
|
||||
const height = Math.floor(entry.contentRect.height);
|
||||
dispatch("viewport.setSize", { w: width, h: height });
|
||||
dispatch(commandIds.viewportSetSize, { w: width, h: height });
|
||||
});
|
||||
|
||||
resizeObserver.observe(canvas);
|
||||
|
||||
Reference in New Issue
Block a user