复制插件增加更多的移动限制
This commit is contained in:
parent
9a4a307efa
commit
d75e16db82
@ -1185,6 +1185,13 @@ class GraphicCopyPlugin {
|
||||
this.container.position.y = dy;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.graphicControlers.length; i++) {
|
||||
if (this.graphicControlers[i].moveLimitOption?.moveLimitName ==
|
||||
this.moveLimit) {
|
||||
this.graphicControlers[i].moveLimitOption?.moveLimit(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
onFinish() {
|
||||
console.log('复制确认');
|
||||
|
8
lib/plugins/CopyPlugin.d.ts
vendored
8
lib/plugins/CopyPlugin.d.ts
vendored
@ -5,6 +5,10 @@ import { KeyListener } from './KeyboardPlugin';
|
||||
interface GraphicControler {
|
||||
controlerList: KeyListener[];
|
||||
check: () => boolean;
|
||||
moveLimitOption?: {
|
||||
moveLimitName: string;
|
||||
moveLimit: (e: FederatedPointerEvent) => void;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 图形复制插件
|
||||
@ -17,9 +21,9 @@ export declare class GraphicCopyPlugin {
|
||||
copys: JlGraphic[];
|
||||
start?: Point;
|
||||
running: boolean;
|
||||
moveLimit?: 'x' | 'y';
|
||||
moveLimit?: string;
|
||||
constructor(scene: IGraphicScene);
|
||||
updateMoveLimit(limit?: 'x' | 'y'): void;
|
||||
updateMoveLimit(limit?: string): void;
|
||||
init(): void;
|
||||
addGraphicControlers(graphicControlers: GraphicControler[]): void;
|
||||
clear(): void;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "graphic-pixi",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.8",
|
||||
"description": "基于pixijs的图形应用、绘制应用框架",
|
||||
"productName": "Graphic-pixi",
|
||||
"author": "walker <shengxuqiang@joylink.club>",
|
||||
|
@ -6,6 +6,10 @@ import { KeyListener } from './KeyboardPlugin';
|
||||
interface GraphicControler {
|
||||
controlerList: KeyListener[];
|
||||
check: () => boolean;
|
||||
moveLimitOption?: {
|
||||
moveLimitName: string;
|
||||
moveLimit: (e: FederatedPointerEvent) => void;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -19,7 +23,7 @@ export class GraphicCopyPlugin {
|
||||
copys: JlGraphic[];
|
||||
start?: Point;
|
||||
running = false;
|
||||
moveLimit?: 'x' | 'y';
|
||||
moveLimit?: string;
|
||||
constructor(scene: IGraphicScene) {
|
||||
this.scene = scene;
|
||||
this.container = new Container();
|
||||
@ -57,7 +61,7 @@ export class GraphicCopyPlugin {
|
||||
);
|
||||
}
|
||||
|
||||
updateMoveLimit(limit?: 'x' | 'y'): void {
|
||||
updateMoveLimit(limit?: string): void {
|
||||
if (this.moveLimit === limit) {
|
||||
this.moveLimit = undefined;
|
||||
} else {
|
||||
@ -136,6 +140,15 @@ export class GraphicCopyPlugin {
|
||||
this.container.position.y = dy;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.graphicControlers.length; i++) {
|
||||
if (
|
||||
this.graphicControlers[i].moveLimitOption?.moveLimitName ==
|
||||
this.moveLimit
|
||||
) {
|
||||
this.graphicControlers[i].moveLimitOption?.moveLimit(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onFinish(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user