92 lines
2.5 KiB
TypeScript
92 lines
2.5 KiB
TypeScript
import { Container, DisplayObject, Graphics, IPointData, Point } from 'pixi.js';
|
||
import { VectorGraphic } from './VectorGraphic';
|
||
/**
|
||
* 抽象可吸附位置
|
||
*/
|
||
export interface AbsorbablePosition extends Container {
|
||
/**
|
||
* 是否与另一个可吸附位置重叠(相似,但可能范围不同)
|
||
* @param other
|
||
*/
|
||
isOverlapping(other: AbsorbablePosition): boolean;
|
||
/**
|
||
* 与另一个相似的吸附位置比较范围大小
|
||
* @param other
|
||
* @returns >0此吸附范围大,<0另一个吸附范围大,=0两个吸附范围一样大
|
||
*/
|
||
compareTo(other: AbsorbablePosition): number;
|
||
/**
|
||
* 尝试吸附图形对象
|
||
* @param objs 图形对象列表
|
||
* @returns 如果吸附成功,返回true,否则false
|
||
*/
|
||
tryAbsorb(...objs: DisplayObject[]): void;
|
||
}
|
||
/**
|
||
* 可吸附点图形参数
|
||
*/
|
||
export declare const AbsorbablePointParam: {
|
||
lineWidth: number;
|
||
lineColor: string;
|
||
fillColor: string;
|
||
radius: number;
|
||
};
|
||
/**
|
||
* 可吸附点
|
||
*/
|
||
export declare class AbsorbablePoint extends Graphics implements AbsorbablePosition, VectorGraphic {
|
||
_point: Point;
|
||
absorbRange: number;
|
||
scaledListenerOn: boolean;
|
||
/**
|
||
*
|
||
* @param point 画布坐标
|
||
* @param absorbRange
|
||
*/
|
||
constructor(point: IPointData, absorbRange?: number);
|
||
compareTo(other: AbsorbablePosition): number;
|
||
isOverlapping(other: AbsorbablePosition): boolean;
|
||
tryAbsorb(...objs: DisplayObject[]): void;
|
||
updateOnScaled(): void;
|
||
}
|
||
/**
|
||
* 可吸附线
|
||
*/
|
||
export declare class AbsorbableLine extends Graphics implements AbsorbablePosition {
|
||
p1: Point;
|
||
p2: Point;
|
||
absorbRange: number;
|
||
_color: string;
|
||
/**
|
||
*
|
||
* @param p1 画布坐标
|
||
* @param p2 画布坐标
|
||
* @param absorbRange
|
||
*/
|
||
constructor(p1: IPointData, p2: IPointData, absorbRange?: number);
|
||
isOverlapping(other: AbsorbablePosition): boolean;
|
||
compareTo(other: AbsorbablePosition): number;
|
||
redraw(): void;
|
||
tryAbsorb(...objs: DisplayObject[]): void;
|
||
}
|
||
/**
|
||
* 可吸附圆
|
||
*/
|
||
export declare class AbsorbableCircle extends Graphics implements AbsorbablePosition {
|
||
absorbRange: number;
|
||
p0: Point;
|
||
radius: number;
|
||
_color: string;
|
||
/**
|
||
*
|
||
* @param p 画布坐标
|
||
* @param radius
|
||
* @param absorbRange
|
||
*/
|
||
constructor(p: IPointData, radius: number, absorbRange?: number);
|
||
isOverlapping(other: AbsorbablePosition): boolean;
|
||
compareTo(other: AbsorbablePosition): number;
|
||
redraw(): void;
|
||
tryAbsorb(...objs: DisplayObject[]): void;
|
||
}
|