feat(svelte): add connectionline and connection functionality

This commit is contained in:
moklick
2023-02-27 18:01:18 +01:00
parent 1dd5613482
commit 7a879f3c54
9 changed files with 707 additions and 28 deletions
+2 -10
View File
@@ -22,7 +22,6 @@ export type NodeDragItem = {
};
type UseDragParams = {
noDragClassName?: string;
handleSelector?: string;
nodeId?: string;
updateNodePositions: (dragItems: NodeDragItem[], d: boolean, p: boolean) => void;
@@ -32,14 +31,7 @@ type UseDragParams = {
export default function drag(
nodeRef: Element,
{
noDragClassName,
handleSelector,
nodeId,
updateNodePositions,
nodesStore,
transformStore
}: UseDragParams
{ handleSelector, nodeId, updateNodePositions, nodesStore, transformStore }: UseDragParams
) {
let dragging = false;
let dragItems: NodeDragItem[] = [];
@@ -119,7 +111,7 @@ export default function drag(
const target = event.target as HTMLDivElement;
const isDraggable =
!event.button &&
(!noDragClassName || !hasSelector(target, `.${noDragClassName}`, nodeRef)) &&
!hasSelector(target, '.nodrag', nodeRef) &&
(!handleSelector || hasSelector(target, handleSelector, nodeRef));
return isDraggable;