fix(svelte) improved type
This commit is contained in:
@@ -27,12 +27,12 @@ export function useSvelteFlow(): {
|
|||||||
getViewport: () => Viewport;
|
getViewport: () => Viewport;
|
||||||
fitView: (options?: FitViewOptions) => void;
|
fitView: (options?: FitViewOptions) => void;
|
||||||
getIntersectingNodes: (
|
getIntersectingNodes: (
|
||||||
nodeOrRect: Partial<Node<any>> | Rect,
|
nodeOrRect: (Partial<Node<any>> & { id: Node['id'] }) | Rect,
|
||||||
partially?: boolean,
|
partially?: boolean,
|
||||||
nodesToIntersect?: Node[]
|
nodesToIntersect?: Node[]
|
||||||
) => Node[];
|
) => Node[];
|
||||||
isNodeIntersecting: (
|
isNodeIntersecting: (
|
||||||
nodeOrRect: Partial<Node<any>> | Rect,
|
nodeOrRect: (Partial<Node<any>> & { id: Node['id'] }) | Rect,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
partially?: boolean
|
partially?: boolean
|
||||||
) => boolean;
|
) => boolean;
|
||||||
@@ -56,7 +56,7 @@ export function useSvelteFlow(): {
|
|||||||
} = useStore();
|
} = useStore();
|
||||||
|
|
||||||
const getNodeRect = (
|
const getNodeRect = (
|
||||||
nodeOrRect: Partial<Node<any>> | Rect
|
nodeOrRect: (Partial<Node<any>> & { id: Node['id'] }) | Rect
|
||||||
): [Rect | null, Node<any> | null | undefined, boolean] => {
|
): [Rect | null, Node<any> | null | undefined, boolean] => {
|
||||||
const isRect = isRectObject(nodeOrRect);
|
const isRect = isRectObject(nodeOrRect);
|
||||||
const node = isRect ? null : get(nodes).find((n) => n.id === nodeOrRect.id);
|
const node = isRect ? null : get(nodes).find((n) => n.id === nodeOrRect.id);
|
||||||
@@ -108,7 +108,7 @@ export function useSvelteFlow(): {
|
|||||||
},
|
},
|
||||||
fitView,
|
fitView,
|
||||||
getIntersectingNodes: (
|
getIntersectingNodes: (
|
||||||
nodeOrRect: Partial<Node<any>> | Rect,
|
nodeOrRect: (Partial<Node<any>> & { id: Node['id'] }) | Rect,
|
||||||
partially = true,
|
partially = true,
|
||||||
nodesToIntersect?: Node[]
|
nodesToIntersect?: Node[]
|
||||||
) => {
|
) => {
|
||||||
@@ -130,7 +130,11 @@ export function useSvelteFlow(): {
|
|||||||
return partiallyVisible || overlappingArea >= nodeOrRect.width! * nodeOrRect.height!;
|
return partiallyVisible || overlappingArea >= nodeOrRect.width! * nodeOrRect.height!;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
isNodeIntersecting: (nodeOrRect: Partial<Node<any>> | Rect, area: Rect, partially = true) => {
|
isNodeIntersecting: (
|
||||||
|
nodeOrRect: (Partial<Node<any>> & { id: Node['id'] }) | Rect,
|
||||||
|
area: Rect,
|
||||||
|
partially = true
|
||||||
|
) => {
|
||||||
const [nodeRect] = getNodeRect(nodeOrRect);
|
const [nodeRect] = getNodeRect(nodeOrRect);
|
||||||
|
|
||||||
if (!nodeRect) {
|
if (!nodeRect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user