Fix lock: block move/resize/rotate for locked nodes, skip locked in marquee, improve toggle icon visibility
This commit is contained in:
parent
bc85d73cc8
commit
6596702389
|
|
@ -423,10 +423,23 @@ function updateDropTarget(ev: PointerEvent) {
|
|||
@pointerdown.stop
|
||||
@click.stop="toggleNodeLock(item.value.id)"
|
||||
>
|
||||
<icon-lucide-lock v-if="item.value.locked" class="size-3 text-muted" />
|
||||
<icon-lucide-lock
|
||||
v-if="item.value.locked"
|
||||
class="size-3"
|
||||
:class="
|
||||
store.state.selectedIds.has(item.value.id)
|
||||
? 'text-white/80'
|
||||
: 'text-surface/70'
|
||||
"
|
||||
/>
|
||||
<icon-lucide-unlock
|
||||
v-else
|
||||
class="size-3 text-muted opacity-0 group-hover/row:opacity-50"
|
||||
class="size-3 opacity-0 group-hover/row:opacity-70"
|
||||
:class="
|
||||
store.state.selectedIds.has(item.value.id)
|
||||
? 'text-white/70'
|
||||
: 'text-surface/50'
|
||||
"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
|
|
@ -435,10 +448,23 @@ function updateDropTarget(ev: PointerEvent) {
|
|||
@pointerdown.stop
|
||||
@click.stop="toggleNodeVisibility(item.value.id)"
|
||||
>
|
||||
<icon-lucide-eye-off v-if="!item.value.visible" class="size-3 text-muted" />
|
||||
<icon-lucide-eye-off
|
||||
v-if="!item.value.visible"
|
||||
class="size-3"
|
||||
:class="
|
||||
store.state.selectedIds.has(item.value.id)
|
||||
? 'text-white/80'
|
||||
: 'text-surface/70'
|
||||
"
|
||||
/>
|
||||
<icon-lucide-eye
|
||||
v-else
|
||||
class="size-3 text-muted opacity-0 group-hover/row:opacity-50"
|
||||
class="size-3 opacity-0 group-hover/row:opacity-70"
|
||||
:class="
|
||||
store.state.selectedIds.has(item.value.id)
|
||||
? 'text-white/70'
|
||||
: 'text-surface/50'
|
||||
"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ export function useCanvasInput(
|
|||
if (store.state.selectedIds.size !== 1) return false
|
||||
const id = [...store.state.selectedIds][0]
|
||||
const node = store.graph.getNode(id)
|
||||
if (!node) return false
|
||||
if (!node || node.locked) return false
|
||||
const abs = store.graph.getAbsolutePosition(id)
|
||||
if (
|
||||
!hitTestCornerRotation(
|
||||
|
|
@ -371,7 +371,7 @@ export function useCanvasInput(
|
|||
function tryStartResize(sx: number, sy: number, cx: number, cy: number): boolean {
|
||||
for (const id of store.state.selectedIds) {
|
||||
const node = store.graph.getNode(id)
|
||||
if (!node) continue
|
||||
if (!node || node.locked) continue
|
||||
const abs = store.graph.getAbsolutePosition(id)
|
||||
const handle = hitTestHandle(
|
||||
sx,
|
||||
|
|
@ -477,6 +477,9 @@ export function useCanvasInput(
|
|||
store.select([hit.id], true)
|
||||
}
|
||||
|
||||
const allLocked = [...store.state.selectedIds].every((id) => store.graph.getNode(id)?.locked)
|
||||
if (allLocked) return
|
||||
|
||||
const originals = new Map<string, { x: number; y: number; parentId: string }>()
|
||||
for (const id of store.state.selectedIds) {
|
||||
const n = store.graph.getNode(id)
|
||||
|
|
@ -778,6 +781,7 @@ export function useCanvasInput(
|
|||
|
||||
const hits: string[] = []
|
||||
for (const node of store.graph.getChildren(store.state.currentPageId)) {
|
||||
if (!node.visible || node.locked) continue
|
||||
if (
|
||||
node.x + node.width > minX &&
|
||||
node.x < maxX &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue