fix(core): avoid undraggable selected nodes being dragged

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-05 22:22:16 +01:00
committed by Braks
parent aaf46dc22c
commit c7e8bd7630
3 changed files with 28 additions and 19 deletions
+7 -1
View File
@@ -16,12 +16,18 @@ export function hasSelector(target: Element, selector: string, node: Element): b
export function getDragItems(
nodes: GraphNode[],
nodesDraggable: boolean,
mousePos: XYPosition,
findNode: Actions['findNode'],
nodeId?: string,
): NodeDragItem[] {
return nodes
.filter((n) => (n.selected || n.id === nodeId) && (!n.parentNode || !isParentSelected(n, findNode)))
.filter(
(n) =>
(n.selected || n.id === nodeId) &&
(!n.parentNode || !isParentSelected(n, findNode)) &&
(n.draggable || (nodesDraggable && typeof n.draggable === 'undefined')),
)
.map((n) =>
markRaw({
id: n.id,