fix(tools): respect pan while painting

This commit is contained in:
syntaxbullet
2026-07-03 17:56:41 +02:00
parent 64aebbe23a
commit 29c0d1eafd
2 changed files with 21 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import type { Vec2D } from "@core/geometry";
import type { Layer } from "@core/layer";
import type { RasterLayer } from "@core/raster-layer";
import type { EditorState } from "@editor/state";
import { isPanInteractionMode } from "@editor/tools";
import type { AppStore } from "@editor/store";
export type BrushSession = {
@@ -13,7 +14,7 @@ export type BrushSession = {
};
export function beginBrushSession(document: ImageDocument, editor: EditorState, point: Vec2D): BrushSession | undefined {
if (editor.tools.activeTool !== "brush" && editor.tools.activeTool !== "eraser") return undefined;
if (isPanInteractionMode(editor.tools.interactionMode) || (editor.tools.activeTool !== "brush" && editor.tools.activeTool !== "eraser")) return undefined;
const layerId = editor.selection.layerIds[0];
if (!layerId) return undefined;
const layer = findRasterLayer(document.artboards.flatMap((artboard) => artboard.layers), layerId);