@node-projects/web-component-designer 0.0.95 → 0.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Constants.js +0 -1
- package/dist/elements/services/DefaultServiceBootstrap.js +10 -0
- package/dist/elements/services/GlobalContext.d.ts +4 -1
- package/dist/elements/services/GlobalContext.js +8 -3
- package/dist/elements/services/ServiceContainer.d.ts +2 -0
- package/dist/elements/services/ServiceContainer.js +1 -0
- package/dist/elements/widgets/designerView/Snaplines.js +1 -1
- package/dist/elements/widgets/designerView/designerView.d.ts +1 -2
- package/dist/elements/widgets/designerView/designerView.js +15 -12
- package/dist/elements/widgets/designerView/extensions/contextMenu/SelectAllChildrenContextMenu.d.ts +8 -0
- package/dist/elements/widgets/designerView/extensions/contextMenu/SelectAllChildrenContextMenu.js +12 -0
- package/dist/elements/widgets/designerView/toolBar/DrawElementTool.d.ts +19 -0
- package/dist/elements/widgets/designerView/toolBar/DrawElementTool.js +79 -0
- package/dist/elements/widgets/designerView/toolBar/DrawEllipsisTool.d.ts +16 -0
- package/dist/elements/widgets/designerView/toolBar/DrawEllipsisTool.js +94 -0
- package/dist/elements/widgets/designerView/toolBar/DrawLineTool.d.ts +14 -0
- package/dist/elements/widgets/designerView/toolBar/DrawLineTool.js +79 -0
- package/dist/elements/widgets/designerView/toolBar/DrawPathTool.d.ts +20 -0
- package/dist/elements/widgets/designerView/toolBar/DrawPathTool.js +128 -0
- package/dist/elements/widgets/designerView/toolBar/DrawRectTool.d.ts +19 -0
- package/dist/elements/widgets/designerView/toolBar/DrawRectTool.js +109 -0
- package/dist/elements/widgets/designerView/toolBar/ITool.d.ts +9 -0
- package/dist/elements/widgets/designerView/toolBar/ITool.js +1 -0
- package/dist/elements/widgets/designerView/toolBar/MagicWandSelectorTool.d.ts +12 -0
- package/dist/elements/widgets/designerView/toolBar/MagicWandSelectorTool.js +64 -0
- package/dist/elements/widgets/designerView/toolBar/NamedTools.d.ts +15 -0
- package/dist/elements/widgets/designerView/toolBar/NamedTools.js +16 -0
- package/dist/elements/widgets/designerView/toolBar/PanTool.d.ts +10 -0
- package/dist/elements/widgets/designerView/toolBar/PanTool.js +26 -0
- package/dist/elements/widgets/designerView/toolBar/PickColorTool.d.ts +10 -0
- package/dist/elements/widgets/designerView/toolBar/PickColorTool.js +20 -0
- package/dist/elements/widgets/designerView/toolBar/PointerTool.d.ts +24 -0
- package/dist/elements/widgets/designerView/toolBar/PointerTool.js +283 -0
- package/dist/elements/widgets/designerView/toolBar/RectangleSelectorTool.d.ts +12 -0
- package/dist/elements/widgets/designerView/toolBar/RectangleSelectorTool.js +84 -0
- package/dist/elements/widgets/designerView/toolBar/TextTool.d.ts +11 -0
- package/dist/elements/widgets/designerView/toolBar/TextTool.js +33 -0
- package/dist/elements/widgets/designerView/toolBar/ZoomTool.d.ts +17 -0
- package/dist/elements/widgets/designerView/toolBar/ZoomTool.js +79 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolRenderer.d.ts +5 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolRenderer.js +19 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolbarPopup.d.ts +8 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolbarPopup.js +41 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolbarPopupToolSelect.d.ts +9 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolbarPopupToolSelect.js +42 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolsButtons.d.ts +36 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolsButtons.js +96 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/DrawToolPopup.d.ts +5 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/DrawToolPopup.js +21 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/SelectorToolsPopup.d.ts +8 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/SelectorToolsPopup.js +23 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolsDock.d.ts +24 -0
- package/dist/elements/widgets/designerView/toolBar/designerToolsDock.js +115 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolRenderer.js +1 -1
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolbarPopup.js +4 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolbarPopupToolSelect.d.ts +1 -4
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolbarPopupToolSelect.js +4 -6
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolsButtons.d.ts +4 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolsButtons.js +31 -40
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/DrawToolPopup copy.d.ts +8 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/DrawToolPopup copy.js +25 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/DrawToolPopup.d.ts +0 -3
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/DrawToolPopup.js +6 -10
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/SelectorToolsPopup.d.ts +8 -0
- package/dist/elements/widgets/designerView/tools/designerToolbarPopups/SelectorToolsPopup.js +23 -0
- package/dist/elements/widgets/designerView/tools/designerToolsDock.d.ts +1 -0
- package/dist/elements/widgets/designerView/tools/designerToolsDock.js +7 -7
- package/dist/elements/widgets/designerView/tools/toolBar/AbstractDesignerToolbarButton.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/AbstractDesignerToolbarButton.js +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/DesignerToolbar.d.ts +16 -0
- package/dist/elements/widgets/designerView/tools/toolBar/DesignerToolbar.js +68 -0
- package/dist/elements/widgets/designerView/tools/toolBar/DesignerToolbarButton.d.ts +19 -0
- package/dist/elements/widgets/designerView/tools/toolBar/DesignerToolbarButton.js +62 -0
- package/dist/elements/widgets/designerView/tools/toolBar/IDesignViewConfigButtonsProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/IDesignViewConfigButtonsProvider.js +1 -0
- package/dist/elements/widgets/designerView/tools/toolBar/IDesignViewToolbarButtonProvider.d.ts +4 -0
- package/dist/elements/widgets/designerView/tools/toolBar/IDesignViewToolbarButtonProvider.js +1 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/DrawToolButtonProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/DrawToolButtonProvider.js +16 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/PointerToolButtonProvider copy.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/PointerToolButtonProvider copy.js +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/PointerToolButtonProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/PointerToolButtonProvider.js +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SelectorToolButtonProvider copy.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SelectorToolButtonProvider copy.js +10 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SelectorToolButtonProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SelectorToolButtonProvider.js +10 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SeperatorToolProvider.d.ts +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/SeperatorToolProvider.js +11 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/TextToolButtonProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/TextToolButtonProvider.js +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/ZoomToolButtonProvider.d.ts +5 -0
- package/dist/elements/widgets/designerView/tools/toolBar/buttons/ZoomToolButtonProvider.js +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/designerToolsDock.d.ts +24 -0
- package/dist/elements/widgets/designerView/tools/toolBar/designerToolsDock.js +115 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/DrawToolPopup.d.ts +6 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/DrawToolPopup.js +50 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectorToolsPopup.d.ts +7 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectorToolsPopup.js +23 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/designerToolbarPopup.d.ts +8 -0
- package/dist/elements/widgets/designerView/tools/toolBar/popups/designerToolbarPopup.js +41 -0
- package/dist/elements/widgets/treeView/treeViewExtended.js +6 -4
- package/dist/index.d.ts +12 -1
- package/dist/index.js +11 -1
- package/package.json +42 -42
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
export class DesignerToolbarPopupToolSelect extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
+
static style = css `
|
|
4
|
+
.popup-tool-select {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
gap: 3px;
|
|
8
|
+
margin: 0 3px;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.tool {
|
|
13
|
+
height: 32px;
|
|
14
|
+
width: 32px;
|
|
15
|
+
background-color: rgb(255, 255, 255);
|
|
16
|
+
background-size: 65%;
|
|
17
|
+
background-repeat: no-repeat;
|
|
18
|
+
background-position: center center;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
border-bottom: 1px solid black;
|
|
21
|
+
}`;
|
|
22
|
+
static template = html `
|
|
23
|
+
<div id="popup-tool-select" class="popup-tool-select"></div>`;
|
|
24
|
+
_popupToolSelected;
|
|
25
|
+
//TODO: remove this element. it only contains a div, and binds events.
|
|
26
|
+
// this could also be done by the user of this
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this._popupToolSelected = this._getDomElement("popup-tool-select");
|
|
30
|
+
}
|
|
31
|
+
async insertToolContent(template) {
|
|
32
|
+
this._popupToolSelected.appendChild(template.content.cloneNode(true));
|
|
33
|
+
await this._waitForChildrenReady();
|
|
34
|
+
this._setupEventHandler();
|
|
35
|
+
}
|
|
36
|
+
_setupEventHandler() {
|
|
37
|
+
for (let tool of [...this._popupToolSelected.querySelectorAll("div.tool")]) {
|
|
38
|
+
tool.addEventListener("click", () => this._toolSelected(tool));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
customElements.define('node-projects-designer-tools-popup-select', DesignerToolbarPopupToolSelect);
|
package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolsButtons.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { NamedTools } from "../NamedTools.js";
|
|
3
|
+
export interface ToolTypeAsArg {
|
|
4
|
+
command_parameter: string;
|
|
5
|
+
open_popup?: boolean;
|
|
6
|
+
popup_category?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolPopupCategoryCollection {
|
|
9
|
+
category: string;
|
|
10
|
+
command: string;
|
|
11
|
+
command_parameter: string;
|
|
12
|
+
title: string;
|
|
13
|
+
tool: NamedTools;
|
|
14
|
+
background_url: string;
|
|
15
|
+
margin?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Seperator {
|
|
18
|
+
tool: 'seperator';
|
|
19
|
+
}
|
|
20
|
+
export declare class DesignerToolsButtons extends BaseCustomWebComponentConstructorAppend {
|
|
21
|
+
static readonly style: CSSStyleSheet;
|
|
22
|
+
static readonly template: HTMLTemplateElement;
|
|
23
|
+
readonly toolActivated: TypedEvent<[ToolPopupCategoryCollection, boolean]>;
|
|
24
|
+
private _toolButtons;
|
|
25
|
+
private _toolCollection;
|
|
26
|
+
private _toolbarhost;
|
|
27
|
+
ready(): void;
|
|
28
|
+
setToolsExternal(tools: ChildNode[]): void;
|
|
29
|
+
private _initToolCategories;
|
|
30
|
+
private _createToolEventListeners;
|
|
31
|
+
private _toolSelected;
|
|
32
|
+
markToolAsSelected(id: string): void;
|
|
33
|
+
private _unselectTools;
|
|
34
|
+
externalToolChange(command_name: string): void;
|
|
35
|
+
get toolCollection(): ToolPopupCategoryCollection[];
|
|
36
|
+
}
|
package/dist/elements/widgets/designerView/toolBar/designerToolbarGenerics/designerToolsButtons.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html, TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { assetsPath } from "../../../../../Constants.js";
|
|
3
|
+
import { NamedTools } from "../NamedTools.js";
|
|
4
|
+
import { DesignerToolRenderer } from "./designerToolRenderer.js";
|
|
5
|
+
export class DesignerToolsButtons extends BaseCustomWebComponentConstructorAppend {
|
|
6
|
+
static style = css `
|
|
7
|
+
.toolbar-host{
|
|
8
|
+
width: calc(100% - 2px);
|
|
9
|
+
height: calc(100% - 2px);
|
|
10
|
+
border: 1px solid black;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
align-items: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tool {
|
|
18
|
+
height: 22px;
|
|
19
|
+
width: 22px;
|
|
20
|
+
background-color: rgb(255, 255, 255);
|
|
21
|
+
background-size: 65%;
|
|
22
|
+
background-repeat: no-repeat;
|
|
23
|
+
background-position: center center;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
border-bottom: 1px solid black;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tool[selected] {
|
|
29
|
+
background-color: darkgreen;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tool:hover {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
static template = html `
|
|
37
|
+
<div id="toolbar-host" class="toolbar-host"></div>`;
|
|
38
|
+
toolActivated = new TypedEvent();
|
|
39
|
+
_toolButtons;
|
|
40
|
+
_toolCollection;
|
|
41
|
+
_toolbarhost;
|
|
42
|
+
ready() {
|
|
43
|
+
this._initToolCategories();
|
|
44
|
+
this._toolbarhost = this._getDomElement("toolbar-host");
|
|
45
|
+
}
|
|
46
|
+
setToolsExternal(tools) {
|
|
47
|
+
for (let tool of tools) {
|
|
48
|
+
this._toolbarhost.appendChild(tool);
|
|
49
|
+
}
|
|
50
|
+
this._createToolEventListeners();
|
|
51
|
+
}
|
|
52
|
+
_initToolCategories() {
|
|
53
|
+
let toolCollection = [];
|
|
54
|
+
toolCollection.push({ tool: NamedTools.Pointer, category: "pointer", command: "setTool", command_parameter: NamedTools.Pointer, title: "Pointer Tool", background_url: "url(" + assetsPath + "images/layout/PointerTool.svg)", margin: '0 0 5px 0' });
|
|
55
|
+
toolCollection.push({ tool: NamedTools.RectangleSelector, category: "selector", command: "setTool", command_parameter: NamedTools.RectangleSelector, title: "Rectangle Selector", background_url: "url(" + assetsPath + "images/layout/SelectRectTool.svg)" });
|
|
56
|
+
toolCollection.push({ tool: NamedTools.MagicWandSelector, category: "selector", command: "setTool", command_parameter: NamedTools.MagicWandSelector, title: "Magic Wand Selector", background_url: "url(" + assetsPath + "images/layout/MagicWandTool.svg)" });
|
|
57
|
+
toolCollection.push({ tool: NamedTools.Zoom, category: "zoom", command: "setTool", command_parameter: NamedTools.Zoom, title: "Zoom Tool", background_url: "url(" + assetsPath + "images/layout/ZoomTool.svg)" });
|
|
58
|
+
toolCollection.push({ tool: NamedTools.PickColor, category: "pick", command: "setTool", command_parameter: NamedTools.PickColor, title: "Color Picker", background_url: "url(" + assetsPath + "images/layout/ColorPickerTool.svg)", margin: '0 0 5px 0' });
|
|
59
|
+
toolCollection.push({ tool: NamedTools.DrawLine, category: "draw", command: "setTool", command_parameter: NamedTools.DrawLine, title: "Draw Line", background_url: "url(" + assetsPath + "images/layout/DrawLineTool.svg)" });
|
|
60
|
+
toolCollection.push({ tool: NamedTools.DrawPath, category: "draw", command: "setTool", command_parameter: NamedTools.DrawPath, title: "Draw Path", background_url: "url(" + assetsPath + "images/layout/DrawPathTool.svg)" });
|
|
61
|
+
toolCollection.push({ tool: NamedTools.DrawRect, category: "draw", command: "setTool", command_parameter: NamedTools.DrawRect, title: "Draw Rectangle", background_url: "url(" + assetsPath + "images/layout/DrawRectTool.svg)" });
|
|
62
|
+
toolCollection.push({ tool: NamedTools.DrawEllipsis, category: "draw", command: "setTool", command_parameter: NamedTools.DrawEllipsis, title: "Draw Ellipsis", background_url: "url(" + assetsPath + "images/layout/DrawEllipTool.svg)" });
|
|
63
|
+
toolCollection.push({ tool: NamedTools.Text, category: "text", command: "setTool", command_parameter: NamedTools.Text, title: "Text Tool", background_url: "url(" + assetsPath + "images/layout/TextTool.svg)" });
|
|
64
|
+
toolCollection.push({ tool: NamedTools.TextBoc, category: "text", command: "setTool", command_parameter: NamedTools.TextBoc, title: "Textbox Tool", background_url: "url(" + assetsPath + "images/layout/TextBoxTool.svg)" });
|
|
65
|
+
this._toolCollection = toolCollection;
|
|
66
|
+
}
|
|
67
|
+
_createToolEventListeners() {
|
|
68
|
+
this._toolButtons = [...this._toolbarhost.querySelectorAll('div.tool')];
|
|
69
|
+
for (let tool of this._toolButtons) {
|
|
70
|
+
tool.addEventListener("click", () => this._toolSelected(tool, false));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_toolSelected(tool, external) {
|
|
74
|
+
this.toolActivated.emit([DesignerToolRenderer.createObjectFromTool(tool), external]);
|
|
75
|
+
}
|
|
76
|
+
markToolAsSelected(id) {
|
|
77
|
+
this._unselectTools();
|
|
78
|
+
let selectedElement = this._toolButtons.find(t => t.getAttribute("data-command-parameter") == id);
|
|
79
|
+
selectedElement?.setAttribute("selected", "");
|
|
80
|
+
}
|
|
81
|
+
_unselectTools() {
|
|
82
|
+
for (let tool of this._toolButtons) {
|
|
83
|
+
tool.removeAttribute("selected");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
externalToolChange(command_name) {
|
|
87
|
+
let tool = this._toolButtons.find(x => x.getAttribute("data-command-parameter") == command_name);
|
|
88
|
+
if (tool != null) {
|
|
89
|
+
this._toolSelected(tool, true);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
get toolCollection() {
|
|
93
|
+
return this._toolCollection;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
customElements.define('node-projects-designer-tools-buttons', DesignerToolsButtons);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { html } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { assetsPath } from "../../../../../Constants";
|
|
3
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
4
|
+
import { DesignerToolbarPopupToolSelect } from "../designerToolbarGenerics/designerToolbarPopupToolSelect";
|
|
5
|
+
export class DrawToolPopup extends DesignerToolbarPopup {
|
|
6
|
+
templateToolSelect = html `
|
|
7
|
+
<div class="tool" data-command="setTool" popup="draw" data-command-parameter="DrawLine" title="Draw Line" style="background-image: url('${assetsPath}images/layout/DrawLineTool.svg');"></div>
|
|
8
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawPath" title="Pointer Tool" style="background-image: url('${assetsPath}images/layout/DrawPathTool.svg');"></div>
|
|
9
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawRect" title="Draw Rectangle" style="background-image: url('${assetsPath}images/layout/DrawRectTool.svg');"></div>
|
|
10
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawEllipsis" title="Draw Ellipsis" style="background-image: url('${assetsPath}images/layout/DrawEllipTool.svg');"></div>
|
|
11
|
+
`;
|
|
12
|
+
ready() {
|
|
13
|
+
this._setTitle(this.getAttribute("title"));
|
|
14
|
+
let toolSelect = new DesignerToolbarPopupToolSelect();
|
|
15
|
+
toolSelect.insertToolContent(this.templateToolSelect);
|
|
16
|
+
let content = [];
|
|
17
|
+
content.push(toolSelect);
|
|
18
|
+
this._setContent(content);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
customElements.define('node-projects-designer-popup-drawtool', DrawToolPopup);
|
package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/SelectorToolsPopup.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
3
|
+
import { ToolPopupCategoryCollection } from "../designerToolbarGenerics/designerToolsButtons";
|
|
4
|
+
export declare class SelectorToolsPopup extends DesignerToolbarPopup {
|
|
5
|
+
private readonly templateToolSelect;
|
|
6
|
+
readonly toolActivated: TypedEvent<ToolPopupCategoryCollection>;
|
|
7
|
+
ready(): void;
|
|
8
|
+
}
|
package/dist/elements/widgets/designerView/toolBar/designerToolbarPopups/SelectorToolsPopup.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html, TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { assetsPath } from "../../../../../Constants";
|
|
3
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
4
|
+
import { DesignerToolbarPopupToolSelect } from "../designerToolbarGenerics/designerToolbarPopupToolSelect";
|
|
5
|
+
export class SelectorToolsPopup extends DesignerToolbarPopup {
|
|
6
|
+
templateToolSelect = html `
|
|
7
|
+
<div class="tool" data-command="setTool" popup="selector" data-command-parameter="RectangleSelector" title="Rectangle Selector" style="background-image: url('${assetsPath}images/layout/SelectRectTool.svg');"></div>
|
|
8
|
+
<div class="tool" data-command="setTool" data-command-parameter="MagicWandSelector" title="Magic Wand Selector" style="background-image: url('${assetsPath}images/layout/MagicWandTool.svg');"></div>
|
|
9
|
+
`;
|
|
10
|
+
toolActivated = new TypedEvent();
|
|
11
|
+
ready() {
|
|
12
|
+
this._setTitle(this.getAttribute("title"));
|
|
13
|
+
let toolSelect = new DesignerToolbarPopupToolSelect();
|
|
14
|
+
toolSelect.insertToolContent(this.templateToolSelect);
|
|
15
|
+
toolSelect.toolActivated.on((toolArg) => {
|
|
16
|
+
this.toolActivated.emit(toolArg);
|
|
17
|
+
});
|
|
18
|
+
let content = [];
|
|
19
|
+
content.push(toolSelect);
|
|
20
|
+
this._setContent(content);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
customElements.define('node-projects-designer-popup-selector', SelectorToolsPopup);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { ServiceContainer } from "../../../services/ServiceContainer.js";
|
|
3
|
+
import { DesignerView } from "../designerView.js";
|
|
4
|
+
import "./designerToolbarGenerics/designerToolsButtons.js";
|
|
5
|
+
import "./designerToolbarPopups/DrawToolPopup.js";
|
|
6
|
+
import "./designerToolbarPopups/SelectorToolsPopup.js";
|
|
7
|
+
export declare class DesignerToolsDock extends BaseCustomWebComponentConstructorAppend {
|
|
8
|
+
static readonly style: CSSStyleSheet;
|
|
9
|
+
static readonly template: HTMLTemplateElement;
|
|
10
|
+
private _designerView;
|
|
11
|
+
private _toolButtonsElem;
|
|
12
|
+
private _toolPopupElems;
|
|
13
|
+
private _serviceContainer;
|
|
14
|
+
private _prevSelected;
|
|
15
|
+
ready(): Promise<void>;
|
|
16
|
+
initialize(serviceContainer: ServiceContainer, designerView: DesignerView): void;
|
|
17
|
+
private _registerPopups;
|
|
18
|
+
private _toolButtonActivated;
|
|
19
|
+
private _activatePopup;
|
|
20
|
+
private _popupToolSelected;
|
|
21
|
+
private _isPopupScenario;
|
|
22
|
+
private _resetPreviousElements;
|
|
23
|
+
private _hideAllPopups;
|
|
24
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { CommandType } from "../../../../commandHandling/CommandType.js";
|
|
3
|
+
import { DesignerToolRenderer } from "./designerToolbarGenerics/designerToolRenderer.js";
|
|
4
|
+
import "./designerToolbarGenerics/designerToolsButtons.js";
|
|
5
|
+
import "./designerToolbarPopups/DrawToolPopup.js";
|
|
6
|
+
import "./designerToolbarPopups/SelectorToolsPopup.js";
|
|
7
|
+
export class DesignerToolsDock extends BaseCustomWebComponentConstructorAppend {
|
|
8
|
+
static style = css `
|
|
9
|
+
node-projects-designer-tools-buttons {
|
|
10
|
+
height: 100%;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#popups {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: calc(0px + 10px);
|
|
17
|
+
height: 100%;
|
|
18
|
+
left: calc(24px + 4px + 10px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#popups > * {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#popups > *[opened] {
|
|
26
|
+
display: block;
|
|
27
|
+
}`;
|
|
28
|
+
static template = html `
|
|
29
|
+
<node-projects-designer-tools-buttons id="tool-buttons"></node-projects-designer-tools-buttons>
|
|
30
|
+
<div id="popups">
|
|
31
|
+
<node-projects-designer-popup-drawtool popup="draw" class="popup" title="Drawtools" tabindex="-1"></node-projects-designer-popup-drawtool>
|
|
32
|
+
<node-projects-designer-popup-selector popup="selector" class="popup" title="Selectors" tabindex="-1"></node-projects-designer-popup-selector>
|
|
33
|
+
</div>`;
|
|
34
|
+
_designerView;
|
|
35
|
+
_toolButtonsElem;
|
|
36
|
+
_toolPopupElems;
|
|
37
|
+
_serviceContainer;
|
|
38
|
+
_prevSelected = [];
|
|
39
|
+
async ready() {
|
|
40
|
+
this._toolButtonsElem = this._getDomElement("tool-buttons");
|
|
41
|
+
this._toolButtonsElem.toolActivated.on((toolActivated => {
|
|
42
|
+
this._toolButtonActivated(toolActivated[0], toolActivated[1]);
|
|
43
|
+
}));
|
|
44
|
+
this._registerPopups();
|
|
45
|
+
let categories = [];
|
|
46
|
+
await this._waitForChildrenReady();
|
|
47
|
+
//TODO: warum macht das nicht alles die tools buttons liste selbst????
|
|
48
|
+
let tools = [];
|
|
49
|
+
for (let tool of this._toolButtonsElem.toolCollection) {
|
|
50
|
+
if (!categories.includes(tool.category)) {
|
|
51
|
+
tools.push(DesignerToolRenderer.createToolFromObject(tool));
|
|
52
|
+
categories.push(tool.category);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
this._toolButtonsElem.setToolsExternal(tools);
|
|
56
|
+
}
|
|
57
|
+
initialize(serviceContainer, designerView) {
|
|
58
|
+
this._serviceContainer = serviceContainer;
|
|
59
|
+
this._serviceContainer.globalContext.onToolChanged.on((e) => {
|
|
60
|
+
let command_name;
|
|
61
|
+
let found = false;
|
|
62
|
+
this._serviceContainer.designerTools.forEach((tool, key) => {
|
|
63
|
+
if (tool === e.newValue && !found) {
|
|
64
|
+
command_name = key;
|
|
65
|
+
found = true;
|
|
66
|
+
this._toolButtonsElem.externalToolChange(command_name);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
this._designerView = designerView;
|
|
71
|
+
}
|
|
72
|
+
_registerPopups() {
|
|
73
|
+
let popups = this._getDomElement("popups");
|
|
74
|
+
this._toolPopupElems = [...popups.querySelectorAll('.popup')];
|
|
75
|
+
//DrawToolPopup
|
|
76
|
+
let drawToolPopup = popups.querySelectorAll("node-projects-designer-popup-drawtool")[0];
|
|
77
|
+
drawToolPopup.toolActivated.on((toolArg) => this._popupToolSelected(drawToolPopup, toolArg));
|
|
78
|
+
}
|
|
79
|
+
_toolButtonActivated(tool, external) {
|
|
80
|
+
this._hideAllPopups();
|
|
81
|
+
this._prevSelected[1] = this._prevSelected[0];
|
|
82
|
+
this._prevSelected[0] = tool;
|
|
83
|
+
if (!external) {
|
|
84
|
+
if (this._isPopupScenario()) {
|
|
85
|
+
this._resetPreviousElements();
|
|
86
|
+
this._activatePopup(tool.category);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
this._toolButtonsElem.markToolAsSelected(tool.command_parameter);
|
|
90
|
+
let command = {
|
|
91
|
+
type: CommandType.setTool,
|
|
92
|
+
parameter: tool.command_parameter,
|
|
93
|
+
};
|
|
94
|
+
this._designerView.executeCommand(command);
|
|
95
|
+
}
|
|
96
|
+
_activatePopup(category) {
|
|
97
|
+
this._toolPopupElems.find(x => x.getAttribute("popup") == category)?.setAttribute("opened", "");
|
|
98
|
+
}
|
|
99
|
+
_popupToolSelected(popup, tool) {
|
|
100
|
+
}
|
|
101
|
+
_isPopupScenario() {
|
|
102
|
+
return JSON.stringify(this._prevSelected[1]) === JSON.stringify(this._prevSelected[0]);
|
|
103
|
+
}
|
|
104
|
+
_resetPreviousElements() {
|
|
105
|
+
for (let i = 0; i < this._prevSelected.length; i++) {
|
|
106
|
+
this._prevSelected[i] = null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_hideAllPopups() {
|
|
110
|
+
for (let popup of this._toolPopupElems) {
|
|
111
|
+
popup.removeAttribute("opened");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
customElements.define('node-projects-designer-tools-dock', DesignerToolsDock);
|
package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolRenderer.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export class DesignerToolRenderer {
|
|
3
3
|
static createToolFromObject(tool) {
|
|
4
4
|
let template = document.createElement('template');
|
|
5
|
-
template.innerHTML = "<div class='tool' data-command='setTool' data-command-parameter=" + tool.command_parameter + " popup=" + tool.category + " title=" + tool.title + " style='background-image:" + tool.background_url + ";'></div>";
|
|
5
|
+
template.innerHTML = "<div class='tool' data-command='setTool' data-command-parameter=" + tool.command_parameter + " popup=" + tool.category + " title=" + tool.title + " style='background-image:" + tool.background_url + ";" + (tool.margin ? "margin: " + tool.margin + ";" : "") + "'></div>";
|
|
6
6
|
return template.content.childNodes[0];
|
|
7
7
|
}
|
|
8
8
|
static createObjectFromTool(tool) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseCustomWebComponentConstructorAppend
|
|
2
|
-
import { ToolPopupCategoryCollection } from "./designerToolsButtons";
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend } from "@node-projects/base-custom-webcomponent";
|
|
3
2
|
export declare class DesignerToolbarPopupToolSelect extends BaseCustomWebComponentConstructorAppend {
|
|
4
3
|
static readonly style: CSSStyleSheet;
|
|
5
4
|
static readonly template: HTMLTemplateElement;
|
|
6
5
|
private _popupToolSelected;
|
|
7
6
|
constructor();
|
|
8
|
-
readonly toolActivated: TypedEvent<ToolPopupCategoryCollection>;
|
|
9
7
|
insertToolContent(template: HTMLTemplateElement): Promise<void>;
|
|
10
8
|
private _setupEventHandler;
|
|
11
|
-
private _toolSelected;
|
|
12
9
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { BaseCustomWebComponentConstructorAppend, css, html
|
|
2
|
-
import { DesignerToolRenderer } from "./designerToolRenderer";
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
|
|
3
2
|
export class DesignerToolbarPopupToolSelect extends BaseCustomWebComponentConstructorAppend {
|
|
4
3
|
static style = css `
|
|
5
4
|
.popup-tool-select {
|
|
6
5
|
display: flex;
|
|
7
6
|
flex-wrap: wrap;
|
|
7
|
+
gap: 3px;
|
|
8
|
+
margin: 0 3px;
|
|
9
|
+
justify-content: center;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.tool {
|
|
@@ -26,7 +28,6 @@ export class DesignerToolbarPopupToolSelect extends BaseCustomWebComponentConstr
|
|
|
26
28
|
super();
|
|
27
29
|
this._popupToolSelected = this._getDomElement("popup-tool-select");
|
|
28
30
|
}
|
|
29
|
-
toolActivated = new TypedEvent();
|
|
30
31
|
async insertToolContent(template) {
|
|
31
32
|
this._popupToolSelected.appendChild(template.content.cloneNode(true));
|
|
32
33
|
await this._waitForChildrenReady();
|
|
@@ -37,8 +38,5 @@ export class DesignerToolbarPopupToolSelect extends BaseCustomWebComponentConstr
|
|
|
37
38
|
tool.addEventListener("click", () => this._toolSelected(tool));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
_toolSelected(tool) {
|
|
41
|
-
this.toolActivated.emit(DesignerToolRenderer.createObjectFromTool(tool));
|
|
42
|
-
}
|
|
43
41
|
}
|
|
44
42
|
customElements.define('node-projects-designer-tools-popup-select', DesignerToolbarPopupToolSelect);
|
package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolsButtons.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export interface ToolPopupCategoryCollection {
|
|
|
12
12
|
title: string;
|
|
13
13
|
tool: NamedTools;
|
|
14
14
|
background_url: string;
|
|
15
|
+
margin?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Seperator {
|
|
18
|
+
tool: 'seperator';
|
|
15
19
|
}
|
|
16
20
|
export declare class DesignerToolsButtons extends BaseCustomWebComponentConstructorAppend {
|
|
17
21
|
static readonly style: CSSStyleSheet;
|
package/dist/elements/widgets/designerView/tools/designerToolbarGenerics/designerToolsButtons.js
CHANGED
|
@@ -3,37 +3,37 @@ import { assetsPath } from "../../../../../Constants.js";
|
|
|
3
3
|
import { NamedTools } from "../NamedTools.js";
|
|
4
4
|
import { DesignerToolRenderer } from "./designerToolRenderer.js";
|
|
5
5
|
export class DesignerToolsButtons extends BaseCustomWebComponentConstructorAppend {
|
|
6
|
-
static style = css `
|
|
7
|
-
.toolbar-host{
|
|
8
|
-
width: calc(100% - 2px);
|
|
9
|
-
height: calc(100% - 2px);
|
|
10
|
-
border: 1px solid black;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
justify-content: flex-start;
|
|
14
|
-
align-items: center;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.tool {
|
|
18
|
-
height:
|
|
19
|
-
width:
|
|
20
|
-
background-color: rgb(255, 255, 255);
|
|
21
|
-
background-size: 65%;
|
|
22
|
-
background-repeat: no-repeat;
|
|
23
|
-
background-position: center center;
|
|
24
|
-
flex-shrink: 0;
|
|
25
|
-
border-bottom: 1px solid black;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.tool[selected] {
|
|
29
|
-
background-color:
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.tool:hover {
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
6
|
+
static style = css `
|
|
7
|
+
.toolbar-host{
|
|
8
|
+
width: calc(100% - 2px);
|
|
9
|
+
height: calc(100% - 2px);
|
|
10
|
+
border: 1px solid black;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
align-items: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tool {
|
|
18
|
+
height: 22px;
|
|
19
|
+
width: 22px;
|
|
20
|
+
background-color: rgb(255, 255, 255);
|
|
21
|
+
background-size: 65%;
|
|
22
|
+
background-repeat: no-repeat;
|
|
23
|
+
background-position: center center;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
border-bottom: 1px solid black;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tool[selected] {
|
|
29
|
+
background-color: darkgreen;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tool:hover {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
35
|
`;
|
|
36
|
-
static template = html `
|
|
36
|
+
static template = html `
|
|
37
37
|
<div id="toolbar-host" class="toolbar-host"></div>`;
|
|
38
38
|
toolActivated = new TypedEvent();
|
|
39
39
|
_toolButtons;
|
|
@@ -51,17 +51,8 @@ export class DesignerToolsButtons extends BaseCustomWebComponentConstructorAppen
|
|
|
51
51
|
}
|
|
52
52
|
_initToolCategories() {
|
|
53
53
|
let toolCollection = [];
|
|
54
|
-
toolCollection.push({ tool: NamedTools.
|
|
55
|
-
toolCollection.push({ tool: NamedTools.MagicWandSelector, category: "selector", command: "setTool", command_parameter: NamedTools.MagicWandSelector, title: "Magic Wand Selector", background_url: "url(" + assetsPath + "images/layout/MagicWandTool.svg)" });
|
|
56
|
-
toolCollection.push({ tool: NamedTools.RectangleSelector, category: "selector", command: "setTool", command_parameter: NamedTools.RectangleSelector, title: "Rectangle Selector", background_url: "url(" + assetsPath + "images/layout/SelectRectTool.svg)" });
|
|
57
|
-
toolCollection.push({ tool: NamedTools.DrawLine, category: "draw", command: "setTool", command_parameter: NamedTools.DrawLine, title: "Draw Line", background_url: "url(" + assetsPath + "images/layout/DrawLineTool.svg)" });
|
|
58
|
-
toolCollection.push({ tool: NamedTools.DrawPath, category: "draw", command: "setTool", command_parameter: NamedTools.DrawPath, title: "Draw Path", background_url: "url(" + assetsPath + "images/layout/DrawPathTool.svg)" });
|
|
59
|
-
toolCollection.push({ tool: NamedTools.DrawRect, category: "draw", command: "setTool", command_parameter: NamedTools.DrawRect, title: "Draw Rectangle", background_url: "url(" + assetsPath + "images/layout/DrawRectTool.svg)" });
|
|
60
|
-
toolCollection.push({ tool: NamedTools.DrawEllipsis, category: "draw", command: "setTool", command_parameter: NamedTools.DrawEllipsis, title: "Draw Ellipsis", background_url: "url(" + assetsPath + "images/layout/DrawEllipTool.svg)" });
|
|
61
|
-
toolCollection.push({ tool: NamedTools.Zoom, category: "zoom", command: "setTool", command_parameter: NamedTools.Zoom, title: "Zoom Tool", background_url: "url(" + assetsPath + "images/layout/ZoomTool.svg)" });
|
|
62
|
-
toolCollection.push({ tool: NamedTools.Text, category: "text", command: "setTool", command_parameter: NamedTools.Text, title: "Text Tool", background_url: "url(" + assetsPath + "images/layout/TextTool.svg)" });
|
|
54
|
+
toolCollection.push({ tool: NamedTools.PickColor, category: "pick", command: "setTool", command_parameter: NamedTools.PickColor, title: "Color Picker", background_url: "url(" + assetsPath + "images/layout/ColorPickerTool.svg)", margin: '0 0 5px 0' });
|
|
63
55
|
toolCollection.push({ tool: NamedTools.TextBoc, category: "text", command: "setTool", command_parameter: NamedTools.TextBoc, title: "Textbox Tool", background_url: "url(" + assetsPath + "images/layout/TextBoxTool.svg)" });
|
|
64
|
-
toolCollection.push({ tool: NamedTools.PickColor, category: "pick", command: "setTool", command_parameter: NamedTools.PickColor, title: "Color Picker", background_url: "url(" + assetsPath + "images/layout/ColorPickerTool.svg)" });
|
|
65
56
|
this._toolCollection = toolCollection;
|
|
66
57
|
}
|
|
67
58
|
_createToolEventListeners() {
|
package/dist/elements/widgets/designerView/tools/designerToolbarPopups/DrawToolPopup copy.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
3
|
+
import { ToolPopupCategoryCollection } from "../designerToolbarGenerics/designerToolsButtons";
|
|
4
|
+
export declare class DrawToolPopup extends DesignerToolbarPopup {
|
|
5
|
+
private readonly templateToolSelect;
|
|
6
|
+
readonly toolActivated: TypedEvent<ToolPopupCategoryCollection>;
|
|
7
|
+
ready(): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html, TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { assetsPath } from "../../../../../Constants";
|
|
3
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
4
|
+
import { DesignerToolbarPopupToolSelect } from "../designerToolbarGenerics/designerToolbarPopupToolSelect";
|
|
5
|
+
export class DrawToolPopup extends DesignerToolbarPopup {
|
|
6
|
+
templateToolSelect = html `
|
|
7
|
+
<div class="tool" data-command="setTool" popup="draw" data-command-parameter="DrawLine" title="Draw Line" style="background-image: url('${assetsPath}images/layout/DrawLineTool.svg');"></div>
|
|
8
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawPath" title="Pointer Tool" style="background-image: url('${assetsPath}images/layout/DrawPathTool.svg');"></div>
|
|
9
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawRect" title="Draw Rectangle" style="background-image: url('${assetsPath}images/layout/DrawRectTool.svg');"></div>
|
|
10
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawEllipsis" title="Draw Ellipsis" style="background-image: url('${assetsPath}images/layout/DrawEllipTool.svg');"></div>
|
|
11
|
+
`;
|
|
12
|
+
toolActivated = new TypedEvent();
|
|
13
|
+
ready() {
|
|
14
|
+
this._setTitle(this.getAttribute("title"));
|
|
15
|
+
let toolSelect = new DesignerToolbarPopupToolSelect();
|
|
16
|
+
toolSelect.insertToolContent(this.templateToolSelect);
|
|
17
|
+
toolSelect.toolActivated.on((toolArg) => {
|
|
18
|
+
this.toolActivated.emit(toolArg);
|
|
19
|
+
});
|
|
20
|
+
let content = [];
|
|
21
|
+
content.push(toolSelect);
|
|
22
|
+
this._setContent(content);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
customElements.define('node-projects-designer-popup-drawtool', DrawToolPopup);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
1
|
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
3
|
-
import { ToolPopupCategoryCollection } from "../designerToolbarGenerics/designerToolsButtons";
|
|
4
2
|
export declare class DrawToolPopup extends DesignerToolbarPopup {
|
|
5
3
|
private readonly templateToolSelect;
|
|
6
|
-
readonly toolActivated: TypedEvent<ToolPopupCategoryCollection>;
|
|
7
4
|
ready(): void;
|
|
8
5
|
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from "@node-projects/base-custom-webcomponent";
|
|
2
2
|
import { assetsPath } from "../../../../../Constants";
|
|
3
3
|
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
4
4
|
import { DesignerToolbarPopupToolSelect } from "../designerToolbarGenerics/designerToolbarPopupToolSelect";
|
|
5
5
|
export class DrawToolPopup extends DesignerToolbarPopup {
|
|
6
|
-
templateToolSelect = html `
|
|
7
|
-
<div class="tool" data-command="setTool" popup="draw" data-command-parameter="DrawLine" title="Draw Line" style="background-image: url('${assetsPath}images/layout/DrawLineTool.svg');"></div>
|
|
8
|
-
<div class="tool" data-command="setTool" data-command-parameter="DrawPath" title="Pointer Tool" style="background-image: url('${assetsPath}images/layout/DrawPathTool.svg');"></div>
|
|
9
|
-
<div class="tool" data-command="setTool" data-command-parameter="DrawRect" title="Draw Rectangle" style="background-image: url('${assetsPath}images/layout/DrawRectTool.svg');"></div>
|
|
10
|
-
<div class="tool" data-command="setTool" data-command-parameter="DrawEllipsis" title="Draw Ellipsis" style="background-image: url('${assetsPath}images/layout/DrawEllipTool.svg');"></div>
|
|
6
|
+
templateToolSelect = html `
|
|
7
|
+
<div class="tool" data-command="setTool" popup="draw" data-command-parameter="DrawLine" title="Draw Line" style="background-image: url('${assetsPath}images/layout/DrawLineTool.svg');"></div>
|
|
8
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawPath" title="Pointer Tool" style="background-image: url('${assetsPath}images/layout/DrawPathTool.svg');"></div>
|
|
9
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawRect" title="Draw Rectangle" style="background-image: url('${assetsPath}images/layout/DrawRectTool.svg');"></div>
|
|
10
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawEllipsis" title="Draw Ellipsis" style="background-image: url('${assetsPath}images/layout/DrawEllipTool.svg');"></div>
|
|
11
11
|
`;
|
|
12
|
-
toolActivated = new TypedEvent();
|
|
13
12
|
ready() {
|
|
14
13
|
this._setTitle(this.getAttribute("title"));
|
|
15
14
|
let toolSelect = new DesignerToolbarPopupToolSelect();
|
|
16
15
|
toolSelect.insertToolContent(this.templateToolSelect);
|
|
17
|
-
toolSelect.toolActivated.on((toolArg) => {
|
|
18
|
-
this.toolActivated.emit(toolArg);
|
|
19
|
-
});
|
|
20
16
|
let content = [];
|
|
21
17
|
content.push(toolSelect);
|
|
22
18
|
this._setContent(content);
|
package/dist/elements/widgets/designerView/tools/designerToolbarPopups/SelectorToolsPopup.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { DesignerToolbarPopup } from "../designerToolbarGenerics/designerToolbarPopup";
|
|
3
|
+
import { ToolPopupCategoryCollection } from "../designerToolbarGenerics/designerToolsButtons";
|
|
4
|
+
export declare class SelectorToolsPopup extends DesignerToolbarPopup {
|
|
5
|
+
private readonly templateToolSelect;
|
|
6
|
+
readonly toolActivated: TypedEvent<ToolPopupCategoryCollection>;
|
|
7
|
+
ready(): void;
|
|
8
|
+
}
|