Merge pull request #5469 from xyflow/chore/coordinate-extent

Chore/coordinate extent
This commit is contained in:
Moritz Klack
2025-08-19 16:06:52 +02:00
committed by GitHub
4 changed files with 10 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/system': patch
---
Allow null for extent
+2 -7
View File
@@ -57,7 +57,7 @@ export type NodeBase<
* Boundary a node can be moved in. * Boundary a node can be moved in.
* @example 'parent' or [[0, 0], [100, 100]] * @example 'parent' or [[0, 0], [100, 100]]
*/ */
extent?: 'parent' | CoordinateExtent; extent?: 'parent' | CoordinateExtent | null;
/** /**
* When `true`, the parent node will automatically expand if this node is dragged to the edge of * When `true`, the parent node will automatically expand if this node is dragged to the edge of
* the parent node's bounds. * the parent node's bounds.
@@ -151,12 +151,7 @@ export type NodeDragItem = {
internals: { internals: {
positionAbsolute: XYPosition; positionAbsolute: XYPosition;
}; };
extent?: 'parent' | CoordinateExtent; } & Pick<InternalNodeBase, 'extent' | 'parentId' | 'origin' | 'expandParent' | 'dragging'>;
parentId?: string;
dragging?: boolean;
origin?: NodeOrigin;
expandParent?: boolean;
};
/** /**
* The origin of a Node determines how it is placed relative to its own coordinates. * The origin of a Node determines how it is placed relative to its own coordinates.
+2 -2
View File
@@ -335,8 +335,8 @@ export const getViewportForBounds = (
export const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0; export const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
export function isCoordinateExtent(extent?: CoordinateExtent | 'parent'): extent is CoordinateExtent { export function isCoordinateExtent(extent?: CoordinateExtent | 'parent' | null): extent is CoordinateExtent {
return extent !== undefined && extent !== 'parent'; return extent !== undefined && extent !== null && extent !== 'parent';
} }
export function getNodeDimensions(node: { export function getNodeDimensions(node: {
+1 -1
View File
@@ -41,7 +41,7 @@ export type XYResizerChange = {
export type XYResizerChildChange = { export type XYResizerChildChange = {
id: string; id: string;
position: XYPosition; position: XYPosition;
extent?: 'parent' | CoordinateExtent; extent?: NodeBase['extent'];
}; };
type XYResizerParams = { type XYResizerParams = {