重新打包
This commit is contained in:
parent
b5f2a9c1df
commit
dd9c5b528a
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
/// <reference path="../global.d.ts" />
|
||||
/// <reference types="global" />
|
||||
export * as GraphicsExtras from '@pixi/graphics-extras';
|
||||
export * from './app';
|
||||
export * from './core';
|
||||
|
12
lib/index.js
12
lib/index.js
@ -1068,6 +1068,7 @@ class GraphicCopyPlugin {
|
||||
container;
|
||||
scene;
|
||||
keyListeners;
|
||||
graphicKeyListenercMap;
|
||||
copys;
|
||||
start;
|
||||
running = false;
|
||||
@ -1075,6 +1076,7 @@ class GraphicCopyPlugin {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
this.container = new Container();
|
||||
this.graphicKeyListenercMap = new Map();
|
||||
this.copys = [];
|
||||
this.keyListeners = [];
|
||||
this.keyListeners.push(new KeyListener({
|
||||
@ -1130,6 +1132,10 @@ class GraphicCopyPlugin {
|
||||
this.container.addChild(clone);
|
||||
clone.repaint();
|
||||
});
|
||||
const addGraphicTypeKeyListener = this.graphicKeyListenercMap.get(app.selectedGraphics[0].type);
|
||||
if (addGraphicTypeKeyListener) {
|
||||
this.keyListeners.push(...addGraphicTypeKeyListener);
|
||||
}
|
||||
this.scene.canvas.on('mousemove', this.onPointerMove, this);
|
||||
this.scene.canvas.on('mouseup', this.onFinish, this);
|
||||
this.scene.canvas.on('rightup', this.cancle, this);
|
||||
@ -1150,6 +1156,7 @@ class GraphicCopyPlugin {
|
||||
this.keyListeners.forEach((kl) => {
|
||||
this.scene.app.removeKeyboardListener(kl);
|
||||
});
|
||||
this.keyListeners = this.keyListeners.splice(0, 3);
|
||||
}
|
||||
onPointerMove(e) {
|
||||
const cp = this.scene.toCanvasCoordinates(e.global);
|
||||
@ -1182,10 +1189,13 @@ class GraphicCopyPlugin {
|
||||
g.position.x += this.container.position.x;
|
||||
g.position.y += this.container.position.y;
|
||||
});
|
||||
this.saveCopyGraphic();
|
||||
this.clear();
|
||||
}
|
||||
saveCopyGraphic() {
|
||||
this.scene.app.addGraphicAndRecord(...this.copys);
|
||||
this.scene.detectRelations();
|
||||
this.scene.updateSelected(...this.copys);
|
||||
this.clear();
|
||||
}
|
||||
cancle() {
|
||||
console.log('复制操作取消');
|
||||
|
2
lib/plugins/CopyPlugin.d.ts
vendored
2
lib/plugins/CopyPlugin.d.ts
vendored
@ -9,6 +9,7 @@ export declare class GraphicCopyPlugin {
|
||||
container: Container;
|
||||
scene: IGraphicScene;
|
||||
keyListeners: KeyListener[];
|
||||
graphicKeyListenercMap: Map<string, KeyListener[]>;
|
||||
copys: JlGraphic[];
|
||||
start?: Point;
|
||||
running: boolean;
|
||||
@ -19,5 +20,6 @@ export declare class GraphicCopyPlugin {
|
||||
clear(): void;
|
||||
onPointerMove(e: FederatedPointerEvent): void;
|
||||
onFinish(): void;
|
||||
saveCopyGraphic(): void;
|
||||
cancle(): void;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user