diff --git a/cfb-web/src/plugins/shortcuts.ts b/cfb-web/src/plugins/shortcuts.ts index 2d08b95..ce8faf8 100644 --- a/cfb-web/src/plugins/shortcuts.ts +++ b/cfb-web/src/plugins/shortcuts.ts @@ -14,7 +14,7 @@ export class WebShortcutsPlugin implements IPlugin { if (checkKeys(e, ["control", "z"])) { const executer = e.world.getPlugin(ExecuterPlugin); if (!executer) { - Logger.warn("`undo` failed: `ExecuterPlugin` is not found in the world"); + Logger.error("`undo` failed: `ExecuterPlugin` is not found in the world"); } else { if (executer.canUndo()) { executer.undo(); @@ -23,7 +23,7 @@ export class WebShortcutsPlugin implements IPlugin { } else if (checkKeys(e, ["control", "shift", "z"])) { const executer = e.world.getPlugin(ExecuterPlugin); if (!executer) { - Logger.warn("`redo` failed: `ExecuterPlugin` is not found in the world"); + Logger.error("`redo` failed: `ExecuterPlugin` is not found in the world"); } else { if (executer.canRedo()) { executer.redo(); diff --git a/cfb-web/src/plugins/zoom.ts b/cfb-web/src/plugins/zoom.ts index 034f3c4..cd56e94 100644 --- a/cfb-web/src/plugins/zoom.ts +++ b/cfb-web/src/plugins/zoom.ts @@ -1,7 +1,7 @@ import type { IPlugin } from "@carefree0910/cfb-core"; import type { WebWorld } from "../world.ts"; -import { Point, wheelEvent } from "@carefree0910/cfb-core"; +import { Logger, Point, wheelEvent } from "@carefree0910/cfb-core"; import { getNormalizedWheelDelta } from "./utils.ts"; import { WebKeyboardPlugin } from "./keyboard.ts"; @@ -10,7 +10,9 @@ export class WebZoomPlugin implements IPlugin { wheelEvent.on((e) => { const world = e.world as WebWorld; const keyboard = world.getPlugin(WebKeyboardPlugin); - if (keyboard) { + if (!keyboard) { + Logger.error("cannot find `keyboard` plugin, `zoom` plugin will not work"); + } else { const status = keyboard.getStatus(); if (status.ctrlKey || status.metaKey) { const deltaY = getNormalizedWheelDelta(e.e, 25).y;