27 lines
548 B
JavaScript
27 lines
548 B
JavaScript
|
|
import { Command } from "./Command.js";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 部件绘制命令
|
||
|
|
*/
|
||
|
|
export class PartDrawCommand extends Command {
|
||
|
|
constructor(options) {
|
||
|
|
super({
|
||
|
|
name: "部件绘制命令",
|
||
|
|
saveState: false,
|
||
|
|
});
|
||
|
|
|
||
|
|
this.canvas = options.canvas;
|
||
|
|
this.partManager = options.partManager;
|
||
|
|
this.partCanvas = options.partCanvas;
|
||
|
|
this.oldPartCanvas = this.partManager.partCanvas;
|
||
|
|
}
|
||
|
|
execute() {
|
||
|
|
this.partManager.drawPartCanvas(this.partCanvas);
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
undo() {
|
||
|
|
this.partManager.drawPartCanvas(this.oldPartCanvas);
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|