fix: Prevent layer interactions when not editing
Guard layer selection, cursor, and resize interactions behind the editing state to avoid unintended modifications in view mode.
This commit is contained in:
@@ -87,6 +87,8 @@ export function useLayerInteraction(
|
||||
const handleLayerClick = (index: number, e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
|
||||
if (!store.state.isEditing || store.state.fixed) return;
|
||||
|
||||
const currentlySelected = store.state.selectedLayer;
|
||||
|
||||
if (currentlySelected === index) {
|
||||
@@ -100,6 +102,7 @@ export function useLayerInteraction(
|
||||
|
||||
const handleCardClick = (e: MouseEvent, cardEl: HTMLElement) => {
|
||||
if (store.state.draggingState) return;
|
||||
if (!store.state.isEditing || store.state.fixed) return;
|
||||
|
||||
const { gridX, gridY } = calculateGridCoords(e, cardEl);
|
||||
const overlapping = getOverlappingLayers(gridX, gridY);
|
||||
@@ -147,6 +150,7 @@ export function useLayerInteraction(
|
||||
edge?: "n" | "s" | "e" | "w",
|
||||
e?: MouseEvent,
|
||||
) => {
|
||||
if (!store.state.isEditing || store.state.fixed) return;
|
||||
if (store.state.selectedLayer === null) return;
|
||||
if (e) e.stopPropagation();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user