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