You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.2 KiB

4 months ago
import type { AABB } from '@antv/g';
import type { Anchor, NodeLikeData, Placement, Point, RelativePlacement } from '../types';
/**
* <zh/> / combo
*
* <en/> Get the position of node/combo
* @param datum - <zh/> / combo | <en/> data of node/combo
* @returns - <zh/> | <en/> position
*/
export declare function positionOf(datum: NodeLikeData): Point;
/**
* <zh/>
*
* <en/> Check if the data has a position coordinate
* @param datum - <zh/> / combo | <en/> data of node/combo
* @returns - <zh/> | <en/> Whether there is a position coordinate
*/
export declare function hasPosition(datum: NodeLikeData): boolean;
/**
* <zh/>
*
* <en/> Get position by relative placement
* @param bbox - <zh/> | <en/> element bounding box
* @param placement - <zh/> | <en/> Point relative to element
* @returns - <zh/> | <en/> position
*/
export declare function getXYByRelativePlacement(bbox: AABB, placement: RelativePlacement): Point;
/**
* <zh/>
*
* <en/> Get position by placement
* @param bbox - <zh/> | <en/> element bounding box
* @param placement - <zh/> | <en/> Point relative to element
* @returns - <zh/> | <en/> position
*/
export declare function getXYByPlacement(bbox: AABB, placement?: Placement): Point;
/**
* <zh/>
*
* <en/> Get anchor position
* @param bbox - <zh/> | <en/> element bounding box
* @param anchor - <zh/> | <en/> Anchor
* @returns - <zh/> | <en/> position
*/
export declare function getXYByAnchor(bbox: AABB, anchor: Anchor): Point;
/**
* <zh/> rect points position .
*
* <en/> The rect points command is used to obtain the position and orientation configuration.
* @param points Points
* @returns `{ left: number; right: number; top: number; bottom: number }`
*/
export declare const getPositionByRectPoints: (points: Point[]) => {
left: number;
right: number;
top: number;
bottom: number;
};