|
@@ -4,9 +4,12 @@ import { objects as Objects } from "./core/application/objects";
|
|
import { state as State } from "./core/application/state";
|
|
import { state as State } from "./core/application/state";
|
|
import { selector as Selector } from "./core/application/selector";
|
|
import { selector as Selector } from "./core/application/selector";
|
|
import { menu as Menu } from "./core/application/menu";
|
|
import { menu as Menu } from "./core/application/menu";
|
|
|
|
+import Konva from "konva";
|
|
|
|
+import { COMPONENT_TYPE } from "./core/enums/component-type-enum";
|
|
export const app = (function() {
|
|
export const app = (function() {
|
|
let _selectedTool = [];
|
|
let _selectedTool = [];
|
|
function _bootstrap() {
|
|
function _bootstrap() {
|
|
|
|
+ Konva.showWarnings = false;
|
|
Selector.bootstrap();
|
|
Selector.bootstrap();
|
|
requireAll(require.context("./component-registry/", true, /\.js$/));
|
|
requireAll(require.context("./component-registry/", true, /\.js$/));
|
|
_refreshMenu();
|
|
_refreshMenu();
|
|
@@ -17,19 +20,22 @@ export const app = (function() {
|
|
}
|
|
}
|
|
|
|
|
|
function _setSelectedTool(tool) {
|
|
function _setSelectedTool(tool) {
|
|
- _clearSelectedTool();
|
|
|
|
|
|
+ _clearSelectedTool(tool != undefined);
|
|
_setState(APP_STATE.TOOL_SELECTED);
|
|
_setState(APP_STATE.TOOL_SELECTED);
|
|
- if (tool.id != undefined) {
|
|
|
|
- document.getElementById("btn-" + tool.id).disabled = true;
|
|
|
|
|
|
+ if (tool.options.id != undefined) {
|
|
|
|
+ document.getElementById("btn-" + tool.options.id).disabled = true;
|
|
}
|
|
}
|
|
_selectedTool.push(tool);
|
|
_selectedTool.push(tool);
|
|
}
|
|
}
|
|
|
|
|
|
- function _clearSelectedTool() {
|
|
|
|
|
|
+ function _clearSelectedTool(force) {
|
|
let tool = _getSelectedTool();
|
|
let tool = _getSelectedTool();
|
|
if (tool != undefined) {
|
|
if (tool != undefined) {
|
|
- if (tool.id != undefined) {
|
|
|
|
- document.getElementById("btn-" + tool.id).disabled = false;
|
|
|
|
|
|
+ if (!force && tool.options.type == COMPONENT_TYPE.SELECTOR) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (tool.options.id != undefined) {
|
|
|
|
+ document.getElementById("btn-" + tool.options.id).disabled = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_selectedTool = [];
|
|
_selectedTool = [];
|