refactor(internals): use non enumerable props
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
Transform,
|
||||
XYPosition,
|
||||
} from '../../types';
|
||||
import { rectToBox } from '../../utils';
|
||||
import { handleBoundsSymbol, rectToBox } from '../../utils';
|
||||
|
||||
export type CreateEdgeTypes = (edgeTypes: EdgeTypes) => EdgeTypesWrapped;
|
||||
|
||||
@@ -168,10 +168,11 @@ export function isEdgeVisible({
|
||||
|
||||
export function getNodeData(nodeInternals: NodeInternals, nodeId: string): [Rect, NodeHandleBounds | null, boolean] {
|
||||
const node = nodeInternals.get(nodeId);
|
||||
const handleBounds = node?.handleBounds;
|
||||
const handleBounds = node?.[handleBoundsSymbol] || null;
|
||||
|
||||
const isInvalid =
|
||||
!node ||
|
||||
!node.handleBounds ||
|
||||
!handleBounds ||
|
||||
!node.width ||
|
||||
!node.height ||
|
||||
typeof node.positionAbsolute?.x === 'undefined' ||
|
||||
@@ -184,7 +185,7 @@ export function getNodeData(nodeInternals: NodeInternals, nodeId: string): [Rect
|
||||
width: node?.width || 0,
|
||||
height: node?.height || 0,
|
||||
},
|
||||
handleBounds || null,
|
||||
handleBounds,
|
||||
!isInvalid,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
ReactFlowState,
|
||||
WrapNodeProps,
|
||||
} from '../../types';
|
||||
import { isParentSymbol, zSymbol } from '../../utils';
|
||||
|
||||
interface NodeRendererProps {
|
||||
nodeTypes: NodeTypesWrapped;
|
||||
@@ -117,8 +118,8 @@ const NodeRenderer = (props: NodeRendererProps) => {
|
||||
isConnectable={isConnectable}
|
||||
resizeObserver={resizeObserver}
|
||||
dragHandle={node.dragHandle}
|
||||
zIndex={node.z ?? 0}
|
||||
isParent={!!node.isParent}
|
||||
zIndex={node[zSymbol] ?? 0}
|
||||
isParent={!!node[isParentSymbol]}
|
||||
noDragClassName={props.noDragClassName}
|
||||
noPanClassName={props.noPanClassName}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user