Merge pull request #5469 from xyflow/chore/coordinate-extent
Chore/coordinate extent
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/system': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Allow null for extent
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -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: {
|
||||||
|
|||||||
@@ -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 = {
|
||||||
|
|||||||
Reference in New Issue
Block a user