Move areSetsEqual to system
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
'@xyflow/react': patch
|
'@xyflow/react': patch
|
||||||
|
'@xyflow/system': patch
|
||||||
---
|
---
|
||||||
|
|
||||||
Optimize selections and take into account if edges connected to selected nodes are actually selectable.
|
Optimize selections and take into account if edges connected to selected nodes are actually selectable.
|
||||||
@@ -10,7 +10,14 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import { shallow } from 'zustand/shallow';
|
import { shallow } from 'zustand/shallow';
|
||||||
import cc from 'classcat';
|
import cc from 'classcat';
|
||||||
import { getNodesInside, getEventPosition, SelectionMode, type NodeChange, type EdgeChange } from '@xyflow/system';
|
import {
|
||||||
|
getNodesInside,
|
||||||
|
getEventPosition,
|
||||||
|
SelectionMode,
|
||||||
|
areSetsEqual,
|
||||||
|
type NodeChange,
|
||||||
|
type EdgeChange,
|
||||||
|
} from '@xyflow/system';
|
||||||
|
|
||||||
import { UserSelection } from '../../components/UserSelection';
|
import { UserSelection } from '../../components/UserSelection';
|
||||||
import { containerStyle } from '../../styles/utils';
|
import { containerStyle } from '../../styles/utils';
|
||||||
@@ -39,20 +46,6 @@ type PaneProps = {
|
|||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
function areSetsEqual(a: Set<string>, b: Set<string>) {
|
|
||||||
if (a.size !== b.size) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const item of a) {
|
|
||||||
if (!b.has(item)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wrapHandler = (
|
const wrapHandler = (
|
||||||
handler: React.MouseEventHandler | undefined,
|
handler: React.MouseEventHandler | undefined,
|
||||||
containerRef: React.MutableRefObject<HTMLDivElement | null>
|
containerRef: React.MutableRefObject<HTMLDivElement | null>
|
||||||
|
|||||||
@@ -263,3 +263,17 @@ export function evaluateAbsolutePosition(
|
|||||||
|
|
||||||
return positionAbsolute;
|
return positionAbsolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function areSetsEqual(a: Set<string>, b: Set<string>) {
|
||||||
|
if (a.size !== b.size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of a) {
|
||||||
|
if (!b.has(item)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user