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

View File

@@ -57,7 +57,7 @@ export type NodeBase<
* Boundary a node can be moved in.
* @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
* the parent node's bounds.
@@ -151,12 +151,7 @@ export type NodeDragItem = {
internals: {
positionAbsolute: XYPosition;
};
extent?: 'parent' | CoordinateExtent;
parentId?: string;
dragging?: boolean;
origin?: NodeOrigin;
expandParent?: boolean;
};
} & Pick<InternalNodeBase, 'extent' | 'parentId' | 'origin' | 'expandParent' | 'dragging'>;
/**
* The origin of a Node determines how it is placed relative to its own coordinates.

View File

@@ -335,8 +335,8 @@ export const getViewportForBounds = (
export const isMacOs = () => typeof navigator !== 'undefined' && navigator?.userAgent?.indexOf('Mac') >= 0;
export function isCoordinateExtent(extent?: CoordinateExtent | 'parent'): extent is CoordinateExtent {
return extent !== undefined && extent !== 'parent';
export function isCoordinateExtent(extent?: CoordinateExtent | 'parent' | null): extent is CoordinateExtent {
return extent !== undefined && extent !== null && extent !== 'parent';
}
export function getNodeDimensions(node: {

View File

@@ -41,7 +41,7 @@ export type XYResizerChange = {
export type XYResizerChildChange = {
id: string;
position: XYPosition;
extent?: 'parent' | CoordinateExtent;
extent?: NodeBase['extent'];
};
type XYResizerParams = {