graphic-pixi/lib/plugins/GraphicTransformPlugin.d.ts

208 lines
5.6 KiB
TypeScript
Raw Normal View History

2023-12-12 17:31:07 +08:00
import { Container, DisplayObject, Graphics, IDestroyOptions, Point } from 'pixi.js';
import { AppDragEvent, InteractionPluginBase, KeyListener } from '.';
import { IGraphicScene } from '../app';
import { AbsorbablePosition, VectorText } from '../graphic';
import { DraggablePoint } from '../graphic/DraggablePoint';
import { DebouncedFunction } from '../utils';
export declare class ShiftData {
/**
*
*/
startPosition: Point;
/**
*
*/
lastPosition?: Point;
/**
*
*/
currentPosition?: Point;
constructor(startPosition: Point, currentPosition?: Point, lastPosition?: Point);
static new(startPosition: Point, currentPosition?: Point, lastPosition?: Point): ShiftData;
get dx(): number;
get dy(): number;
get dsx(): number;
get dsy(): number;
}
export declare class ScaleData {
start: Point;
current?: Point;
last?: Point;
constructor(start: Point, current?: Point, last?: Point);
static new(start: Point, current?: Point, last?: Point): ScaleData;
}
export type TransformData = ShiftData | null;
/**
*
*/
export declare class GraphicTransformEvent {
/**
*
*/
target: DisplayObject;
type: 'shift' | 'rotate' | 'scale' | 'skew';
data: TransformData;
constructor(target: DisplayObject, type: 'shift' | 'rotate' | 'scale' | 'skew', data: TransformData);
getData<D extends TransformData>(): D;
static shift(target: DisplayObject, data: ShiftData): GraphicTransformEvent;
static scale(target: DisplayObject): GraphicTransformEvent;
static rotate(target: DisplayObject): GraphicTransformEvent;
static skew(target: DisplayObject): GraphicTransformEvent;
isShift(): boolean;
isRotate(): boolean;
isScale(): boolean;
isSkew(): boolean;
}
export declare class GraphicTransformPlugin extends InteractionPluginBase {
static Name: string;
/**
*
*/
absorbablePositions?: AbsorbablePosition[];
apContainer: Container;
static AbsorbablePosisiontsName: string;
constructor(app: IGraphicScene);
/**
*
* @param positions
* @returns
*/
filterAbsorbablePositions(positions: AbsorbablePosition[]): AbsorbablePosition[];
static new(app: IGraphicScene): GraphicTransformPlugin;
bind(): void;
unbind(): void;
getDraggedTargets(e: AppDragEvent): DisplayObject[];
onDragStart(e: AppDragEvent): void;
onDragMove(e: AppDragEvent): void;
onDragEnd(e: AppDragEvent): void;
/**
*
*/
clearCache(): void;
onGraphicSelectedChange(g: DisplayObject, selected: boolean): void;
}
/**
*
*/
export declare class TransformPoints extends Container {
static Name: string;
static MinLength: number;
static LeftTopName: string;
static TopName: string;
static RightTopName: string;
static RightName: string;
static RightBottomName: string;
static BottomName: string;
static LeftBottomName: string;
static LeftName: string;
static RotateName: string;
obj: DisplayObject;
ltScalePoint: DraggablePoint;
ltLocal: Point;
tScalePoint: DraggablePoint;
tLocal: Point;
tCanvas: Point;
rtScalePoint: DraggablePoint;
rtLocal: Point;
rScalePoint: DraggablePoint;
rLocal: Point;
rbScalePoint: DraggablePoint;
rbLocal: Point;
bScalePoint: DraggablePoint;
bLocal: Point;
lbScalePoint: DraggablePoint;
lbLocal: Point;
lScalePoint: DraggablePoint;
lLocal: Point;
originScale: Point;
scalePivot: Point;
/**
*
*/
rotatePoint: DraggablePoint;
/**
*
*/
rotatePivot: Point;
/**
*
*/
rotateLastPoint: Point;
/**
*
*/
startAngle: number;
/**
*
*/
angleAssistantText: VectorText;
/**
*
*/
angleStep: number;
/**
*
*/
rotateAngleStepKeyListeners: KeyListener[];
constructor(obj: DisplayObject);
onObjTransformStart(): void;
onObjTransformEnd(): void;
onGraphicRepaint(): void;
/**
*
* @param de
*/
onRotateStart(de: GraphicTransformEvent): void;
updateAngleAssistantText(de: GraphicTransformEvent): void;
/**
*
* @param de
*/
onRotateMove(de: GraphicTransformEvent): void;
/**
*
* @param de
*/
onRotateEnd(): void;
/**
*
*/
onScaleDragStart(): void;
onScaleDragMove(e: GraphicTransformEvent): void;
onScaleDragEnd(): void;
hideOthers(dg: DisplayObject): void;
hideAll(): void;
showAll(): void;
getObjBounds(): {
width: number;
height: number;
};
/**
* cursor
* @returns
*/
update(): void;
updateRotatePoint(): void;
updateScalePoints(): void;
}
/**
* 使
*/
export declare class BoundsGraphic extends Graphics {
static Name: string;
static BoundsLineStyle: {
width: number;
color: string;
alpha: number;
};
obj: DisplayObject;
debouncedRedraw: DebouncedFunction<() => void>;
constructor(graphic: DisplayObject);
onObjTransformStart(): void;
onObjTransformEnd(): void;
onGraphicRepaint(): void;
destroy(options?: boolean | IDestroyOptions | undefined): void;
redraw(): void;
doRedraw(): void;
}