|
@@ -1,34 +1,71 @@
|
|
|
+/*
|
|
|
+ * iGeom by LInE
|
|
|
+ * Free software to student private data
|
|
|
+ *
|
|
|
+ * http://www.matematica.br/igeom
|
|
|
+ * http://www.usp.br/line
|
|
|
+ *
|
|
|
+ * ./app/core/drawers/drawer-manager.js
|
|
|
+ *
|
|
|
+ * @version 2020/06/14: now using app/core/models/application/actions/action.js
|
|
|
+ */
|
|
|
+
|
|
|
import { stageManager as Stages } from "../application/stage-manager";
|
|
|
|
|
|
class DrawerManager {
|
|
|
- constructor() {
|
|
|
+
|
|
|
+ constructor () {
|
|
|
this.currentStage = this._getCurrentStage();
|
|
|
- }
|
|
|
- _getCurrentStage() {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getCurrentStage () {
|
|
|
return Stages.getCurrentStage();
|
|
|
- }
|
|
|
- _getCurrentKonvaStage() {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getCurrentKonvaStage () {
|
|
|
return Stages.getCurrentKonvaStage();
|
|
|
- }
|
|
|
- getStages() {
|
|
|
+ }
|
|
|
+
|
|
|
+ getStages () {
|
|
|
return Stages.getStages();
|
|
|
- }
|
|
|
- draw(object) {
|
|
|
+ }
|
|
|
+
|
|
|
+ draw (object) {
|
|
|
this.currentStage.draw(object);
|
|
|
- }
|
|
|
- addAggregator(aggregator) {
|
|
|
+ }
|
|
|
+
|
|
|
+ addAggregator (aggregator) {
|
|
|
this.currentStage.addAggregator(aggregator);
|
|
|
- }
|
|
|
- batchDraw() {
|
|
|
- Stages.getCurrentStage()
|
|
|
- .getCurrentKonvaLayer()
|
|
|
- .batchDraw();
|
|
|
- }
|
|
|
- addAction(action) {
|
|
|
- Stages.getCurrentLayer().actionManager.push(action);
|
|
|
- }
|
|
|
- removeAction(action) {
|
|
|
+ }
|
|
|
+
|
|
|
+ batchDraw () {
|
|
|
+ // Old: Stages.getCurrentStage().getCurrentKonvaLayer().batchDraw();
|
|
|
+ var currentStage, currentKonvaLayer;
|
|
|
+ currentStage = Stages.getCurrentStage();
|
|
|
+ currentKonvaLayer = currentStage.getCurrentKonvaLayer();
|
|
|
+ currentKonvaLayer.batchDraw();
|
|
|
+ }
|
|
|
+
|
|
|
+ addAction (action) { // drawer-manager.js!addAction(action): error TypeError: cyclic object value: actionManager, action(id,type)=(9,1)
|
|
|
+ // Old: Stages.getCurrentLayer().actionManager.push(action);
|
|
|
+ var currentLayer, actionManager, auxE = "";
|
|
|
+ try {
|
|
|
+ currentLayer = Stages.getCurrentLayer(); // app/core/drawers/stage.js: getCurrentLayer(): return this.layer;
|
|
|
+ auxE += "currentLayer, ";
|
|
|
+ actionManager = currentLayer.actionManager; // app/core/drawers/layer.js: "this.actionManager = new ActionManager();", with ./app/core/models/application/actions/action-manager.js
|
|
|
+ auxE += "actionManager, ";
|
|
|
+ actionManager.push(action); // app/core/models/application/actions/action-manager.js: push(action): this.actions.push(action);
|
|
|
+ } catch (error) {
|
|
|
+ if (action && action!=undefined) auxE += "action(id,type)=(" + action.id + "," + action.type + ")";
|
|
|
+ else auxE += "action(id,type)=" + action;
|
|
|
+ console.log("drawer-manager.js!addAction(action): error '" + error + "': " + auxE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ removeAction (action) {
|
|
|
Stages.getCurrentLayer().actionManager.remove(action);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-}
|
|
|
-export const drawerManager = new DrawerManager();
|
|
|
+
|
|
|
+export const drawerManager = new DrawerManager();
|