2023-12-12 17:31:07 +08:00
|
|
|
import { DisplayObject, FederatedMouseEvent, Graphics, Point } from 'pixi.js';
|
|
|
|
import { IGraphicScene } from '../app';
|
|
|
|
import { JlGraphic } from '../core';
|
|
|
|
import { AppDragEvent, AppInteractionPlugin } from './InteractionPlugin';
|
|
|
|
type GraphicSelectFilter = (graphic: JlGraphic) => boolean;
|
|
|
|
export interface IMouseToolOptions {
|
|
|
|
/**
|
|
|
|
* 是否启用框选,默认启用
|
|
|
|
*/
|
|
|
|
boxSelect?: boolean;
|
|
|
|
/**
|
|
|
|
* 是否启用视口拖拽(默认右键),默认启用
|
|
|
|
*/
|
|
|
|
viewportDrag?: boolean;
|
|
|
|
/**
|
|
|
|
* 是否启用左键视口拖拽
|
|
|
|
*/
|
|
|
|
viewportDragLeft?: boolean;
|
|
|
|
/**
|
|
|
|
* 是否启用鼠标滚轮缩放,默认启用
|
|
|
|
*/
|
|
|
|
wheelZoom?: boolean;
|
|
|
|
/**
|
|
|
|
* 可选择图形过滤器
|
|
|
|
*/
|
|
|
|
selectFilter?: GraphicSelectFilter;
|
|
|
|
}
|
|
|
|
declare class CompleteMouseToolOptions implements IMouseToolOptions {
|
|
|
|
boxSelect: boolean;
|
|
|
|
viewportDrag: boolean;
|
|
|
|
viewportDragLeft: boolean;
|
|
|
|
wheelZoom: boolean;
|
|
|
|
selectFilter?: GraphicSelectFilter | undefined;
|
|
|
|
constructor();
|
|
|
|
update(options: IMouseToolOptions): void;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 通用交互工具
|
|
|
|
*/
|
|
|
|
export declare class CommonMouseTool extends AppInteractionPlugin {
|
|
|
|
static Name: string;
|
|
|
|
static SelectBox: string;
|
|
|
|
options: CompleteMouseToolOptions;
|
|
|
|
box: Graphics;
|
|
|
|
leftDownTarget: DisplayObject | null;
|
|
|
|
drag: boolean;
|
|
|
|
graphicSelect: boolean;
|
|
|
|
rightTarget: DisplayObject | null;
|
|
|
|
constructor(scene: IGraphicScene);
|
|
|
|
static new(app: IGraphicScene): CommonMouseTool;
|
|
|
|
bind(): void;
|
|
|
|
unbind(): void;
|
|
|
|
onDragStart(event: AppDragEvent): void;
|
|
|
|
onDragMove(event: AppDragEvent): void;
|
|
|
|
onDragEnd(event: AppDragEvent): void;
|
|
|
|
setLeftCursor(e: FederatedMouseEvent): void;
|
|
|
|
resumeLeftCursor(): void;
|
|
|
|
setCursor(e: FederatedMouseEvent): void;
|
|
|
|
resumeCursor(): void;
|
|
|
|
onMouseDown(e: FederatedMouseEvent): void;
|
|
|
|
/**
|
|
|
|
* 选中处理
|
|
|
|
* @param e
|
|
|
|
*/
|
|
|
|
onMouseUp(e: FederatedMouseEvent): void;
|
|
|
|
/**
|
|
|
|
* 清理缓存
|
|
|
|
*/
|
|
|
|
clearCache(): void;
|
|
|
|
get boxSelect(): boolean | undefined;
|
|
|
|
get selectFilter(): GraphicSelectFilter | undefined;
|
|
|
|
/**
|
|
|
|
* 框选图形绘制并检查
|
|
|
|
*/
|
|
|
|
boxSelectDraw(start: Point, end: Point): void;
|
|
|
|
/**
|
|
|
|
* 框选图形判断
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
boxSelectGraphicCheck(): void;
|
|
|
|
}
|
|
|
|
export {};
|
2023-12-13 13:59:09 +08:00
|
|
|
//# sourceMappingURL=CommonMousePlugin.d.ts.map
|