import { PositionSchema } from '../../common/schema'; import { Rectangle } from '@gedit/math'; import type { EntityManager, Entity } from '../../common'; import type { PlaygroundConfigEntity } from '../layer/config'; export declare const ADSORB_DELTA_DEFAULT = 4; export declare class Adsorber { protected opts: Adsorber.Option; private _adsorbedX?; private _adsorbedY?; private _adsorbedDeltaX?; private _adsorbedDeltaY?; constructor(opts?: Partial); /** * 计算吸附偏移量 * @param target - 目标选择框 * @param refs - 参考节点 * @param lines - 参考线 * @return 吸附后的偏移量, 如果为undefined,则表示没有被吸住,不做偏移 */ calculateDelta(target: Rectangle, refs: Rectangle[], lines: Adsorber.Line[]): Partial; /** * 计算吸附 * @param target - 目标选择框 * @param refs - 参考节点 * @param lines - 参考线 * @return 吸附后的位置 */ calculate(target: Rectangle, refs: Rectangle[], lines: Adsorber.Line[]): PositionSchema; /** * 计算吸附后逃逸的偏移量 * @param newPos - 当前的位置 * @param type */ protected calculateEscape(newPos: number, type: Adsorber.Direction): number | undefined; /** * 吸附时候位置 */ protected getAbsorbedPos(type: Adsorber.Direction): number | undefined; /** * 清空吸附位置 * @param type */ clearAbsorbedPos(type?: Adsorber.Direction): void; } /** * 吸附计算 */ export declare namespace Adsorber { /** * 吸附配置数据 */ interface Option { adSorbDelta: number; } /** * 吸附参考线类型 */ interface Line { type: Adsorber.Direction; pos: number; } /** * 吸附类型 */ enum Direction { HORIZONTAL = 0, VERTICAL = 1 } const defaultOption: Option; function isHorizantal(direction: Adsorber.Direction): boolean; function getRefValues(target: Rectangle, direction: Adsorber.Direction): number[]; function getRefsFromEntities(entityManager: EntityManager, ignoreEntities: Entity[], configEntity?: PlaygroundConfigEntity): Rectangle[]; } //# sourceMappingURL=adsorber.d.ts.map