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.

117 lines
3.7 KiB

4 months ago
import type { ContourStyleProps } from '../../elements/shapes';
import type { RuntimeContext } from '../../runtime/types';
import type { ID } from '../../types';
import type { BasePluginOptions } from '../base-plugin';
import { BasePlugin } from '../base-plugin';
/**
* <zh/> Hull
*
* <en/> Hull options
*/
export interface HullOptions extends BasePluginOptions, ContourStyleProps {
/**
* <zh/> Hull
*
* <en/> Elements in Hull
*/
members?: ID[];
/**
* <zh/> Infinity Convex Hull
*
* <en/> Concavity. Default is Infinity, which means Convex Hull
* @defaultValue Infinity
*/
concavity?: number;
/**
* <zh/>
*
* <en/> Padding
* @defaultValue 10
*/
padding?: number;
/**
* <zh/>
*
* <en/> Corner type
* @defaultValue 'rounded'
*/
corner?: 'rounded' | 'smooth' | 'sharp';
}
/**
* <zh/>
*
* <en/> Hull
* @remarks
* <zh/> Hull
*
* <zh/> Convex Hull
*
* <zh/> Concave Hull concavity concavity concavity Infinity
*
* <en/> Hull is used to process and represent the convex polygon bounding box of a set of points. Hull has two forms: convex hull and concave hull.
*
* <en/> Convex Hull: This is a convex polygon that contains all points and has no concave. You can think of it as the smallest bounding box of a set of points, with no points outside the polygon.
*
* <en/> Concave Hull: This is a concave polygon that also contains all points, but may have concave. The concavity of the concave hull is controlled by the concavity parameter. The larger the concavity, the smaller the concave. When concavity is Infinity, the concave hull becomes a convex hull.
*/
export declare class Hull extends BasePlugin<HullOptions> {
private shape;
/**
* <zh/> Hull
*
* <en/> Element Ids on Hull
*/
private hullMemberIds;
/**
* <zh/> Hull
*
* <en/> Hull path
*/
private path;
private optionsCache;
static defaultOptions: Partial<HullOptions>;
constructor(context: RuntimeContext, options: HullOptions);
private bindEvents;
private unbindEvents;
private getHullStyle;
private drawHull;
private updateHullPath;
private getHullPath;
private getPadding;
/**
* <zh/> Hull
*
* <en/> Add Hull member
* @param members - <zh/> Ids | <en/> Element Ids
*/
addMember(members: ID | ID[]): void;
/**
* <zh/> Hull
*
* <en/> Remove Hull member
* @param members - <zh/> Ids | <en/> Element Ids
*/
removeMember(members: ID | ID[]): void;
/**
* <zh/> Hull
*
* <en/> Update Hull member
* @param members - <zh/> Ids | <en/> Element Ids
*/
updateMember(members: ID[] | ((prev: ID[]) => ID[])): void;
/**
* <zh/> Hull
*
* <en/> Get Hull member
* @returns <zh/> Ids | <en/> Element Ids
*/
getMember(): string[];
/**
* <zh/> Hull
*
* <en/> Destroy Hull
* @internal
*/
destroy(): void;
}