fix(elementsSelectable): still draggable if not selectable

This commit is contained in:
moklick
2022-05-19 12:49:35 +02:00
parent 0d3439903c
commit 94321613f2
5 changed files with 10 additions and 13 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ function useDrag({
}
const mousePos = getMousePosition(event);
dragItems.current = getDragItems(nodeInternals, mousePos);
dragItems.current = getDragItems(nodeInternals, mousePos, nodeId);
if (onStart && dragItems.current) {
const [currentNode, nodes] = getEventHandlerParams({
+2 -2
View File
@@ -44,9 +44,9 @@ export function selectorExistsTargetToNode(target: Element, selector: string, no
}
// looks for all selected nodes and created a NodeDragItem for each of them
export function getDragItems(nodeInternals: NodeInternals, mousePos: XYPosition): NodeDragItem[] {
export function getDragItems(nodeInternals: NodeInternals, mousePos: XYPosition, nodeId?: string): NodeDragItem[] {
return Array.from(nodeInternals.values())
.filter((n) => n.selected && (!n.parentNode || !isParentSelected(n, nodeInternals)))
.filter((n) => (n.selected || n.id === nodeId) && (!n.parentNode || !isParentSelected(n, nodeInternals)))
.map((n) => ({
id: n.id,
position: n.position,