@node-projects/web-component-designer 0.1.98 → 0.1.100
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/elements/helper/Screenshot.js +3 -1
- package/dist/elements/services/DefaultServiceBootstrap.js +2 -0
- package/dist/elements/services/propertiesService/app.d.ts +2 -0
- package/dist/elements/services/propertiesService/app.js +71 -0
- package/dist/elements/services/propertiesService/services/MathMLElementsPropertiesService.d.ts +15 -0
- package/dist/elements/services/propertiesService/services/MathMLElementsPropertiesService.js +72 -0
- package/dist/elements/services/propertiesService/services/UnkownElementsPropertiesService.js +2 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +28 -18
- package/dist/elements/widgets/designerView/extensions/CanvasExtension.js +8 -6
- package/dist/elements/widgets/designerView/tools/PanTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/toolBar/popups/{PointerToolPopup copy.d.ts → DrawToolPopup copy.d.ts } +1 -1
- package/dist/elements/widgets/designerView/tools/toolBar/popups/DrawToolPopup copy.js +102 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +24 -24
- package/dist/elements/services/placementService/DefaultPlacementService copy.d.ts +0 -19
- package/dist/elements/services/placementService/DefaultPlacementService copy.js +0 -151
- package/dist/elements/widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons copy.d.ts +0 -5
- package/dist/elements/widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons copy.js +0 -7
- package/dist/elements/widgets/designerView/tools/toolBar/popups/PointerToolPopup copy.js +0 -49
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup copy.d.ts +0 -6
- package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup copy.js +0 -49
|
@@ -24,7 +24,9 @@ export class Screenshot {
|
|
|
24
24
|
cursor: "never",
|
|
25
25
|
displaySurface: 'browser'
|
|
26
26
|
},
|
|
27
|
-
audio: false
|
|
27
|
+
audio: false,
|
|
28
|
+
selfBrowserSurface: "include",
|
|
29
|
+
preferCurrentTab: true
|
|
28
30
|
};
|
|
29
31
|
Screenshot._video.style.display = "none";
|
|
30
32
|
elementHostForVideo.appendChild(Screenshot._video);
|
|
@@ -86,6 +86,7 @@ import { EventsService } from './eventsService/EventsService.js';
|
|
|
86
86
|
import { SimpleDemoProviderService } from './demoProviderService/SimpleDemoProviderService.js';
|
|
87
87
|
import { DrawElementTool } from '../widgets/designerView/tools/DrawElementTool.js';
|
|
88
88
|
import { RoundPixelsDesignViewConfigButton } from '../widgets/designerView/extensions/buttons/RoundPixelsDesignViewConfigButton.js';
|
|
89
|
+
import { MathMLElementsPropertiesService } from './propertiesService/services/MathMLElementsPropertiesService.js';
|
|
89
90
|
export function createDefaultServiceContainer() {
|
|
90
91
|
let serviceContainer = new ServiceContainer();
|
|
91
92
|
let defaultPlacementService = new DefaultPlacementService();
|
|
@@ -96,6 +97,7 @@ export function createDefaultServiceContainer() {
|
|
|
96
97
|
serviceContainer.register("propertyService", new LitElementPropertiesService());
|
|
97
98
|
serviceContainer.register("propertyService", new NativeElementsPropertiesService());
|
|
98
99
|
serviceContainer.register("propertyService", new SVGElementsPropertiesService());
|
|
100
|
+
serviceContainer.register("propertyService", new MathMLElementsPropertiesService());
|
|
99
101
|
serviceContainer.register("propertyService", new Lit2PropertiesService());
|
|
100
102
|
serviceContainer.register("propertyService", new BaseCustomWebComponentPropertiesService());
|
|
101
103
|
serviceContainer.register("propertyGroupsService", new PropertyGroupsService());
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function getProtoProperties(target) {
|
|
3
|
+
// If this is a custom element, you need to go up the prototype
|
|
4
|
+
// chain until you get proper HTMLElement, since everything under it
|
|
5
|
+
// is generated prototypes and will have propeties that are dupes (like:
|
|
6
|
+
// every observedAttribute is also mirrored as a property)
|
|
7
|
+
const isCustomElement = target.tagName.indexOf('-') !== -1;
|
|
8
|
+
let proto = target.__proto__;
|
|
9
|
+
if (isCustomElement) {
|
|
10
|
+
while (proto.constructor !== window.HTMLElement.prototype.constructor) {
|
|
11
|
+
proto = proto.__proto__;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
let protoProps = {};
|
|
15
|
+
// We literally want nothing other than 'href' and 'target' from HTMLAnchorElement.
|
|
16
|
+
if (proto.constructor.name === 'HTMLAnchorElement') {
|
|
17
|
+
protoProps['href'] = Object.getOwnPropertyDescriptors(proto).href;
|
|
18
|
+
protoProps['target'] = Object.getOwnPropertyDescriptors(proto).target;
|
|
19
|
+
proto = proto.__proto__;
|
|
20
|
+
}
|
|
21
|
+
while (proto.constructor.name !== 'Element') {
|
|
22
|
+
Object.assign(protoProps, Object.getOwnPropertyDescriptors(proto));
|
|
23
|
+
proto = proto.__proto__;
|
|
24
|
+
}
|
|
25
|
+
let propNames = Object.keys(protoProps).sort();
|
|
26
|
+
// Skip some very specific Polymer/element properties.
|
|
27
|
+
let blacklist = [
|
|
28
|
+
// Polymer specific
|
|
29
|
+
'isAttached',
|
|
30
|
+
'constructor', 'created', 'ready', 'attached', 'detached',
|
|
31
|
+
'attributeChanged', 'is', 'listeners', 'observers', 'properties',
|
|
32
|
+
// Native elements ones we don't care about
|
|
33
|
+
'validity', 'useMap', 'innerText', 'outerText', 'style', 'accessKey',
|
|
34
|
+
'draggable', 'lang', 'spellcheck', 'tabIndex', 'translate', 'align', 'dir',
|
|
35
|
+
'isMap', 'useMap', 'hspace', 'vspace', 'referrerPolicy', 'crossOrigin',
|
|
36
|
+
'lowsrc', 'longDesc',
|
|
37
|
+
// Specific elements stuff
|
|
38
|
+
'receivedFocusFromKeyboard', 'pointerDown', 'valueAsNumber',
|
|
39
|
+
'selectionDirection', 'selectionStart', 'selectionEnd'
|
|
40
|
+
];
|
|
41
|
+
let i = 0;
|
|
42
|
+
while (i < propNames.length) {
|
|
43
|
+
let name = propNames[i];
|
|
44
|
+
// Skip everything that starts with a _ which is a Polymer private/protected
|
|
45
|
+
// and you probably don't care about it.
|
|
46
|
+
// Also anything in the blacklist. Or that starts with webkit.
|
|
47
|
+
if (name.charAt(0) === '_' ||
|
|
48
|
+
name === 'keyEventTarget' ||
|
|
49
|
+
blacklist.indexOf(name) !== -1 ||
|
|
50
|
+
name.indexOf('webkit') === 0 ||
|
|
51
|
+
name.indexOf('on') === 0) {
|
|
52
|
+
propNames.splice(i, 1);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// Skip everything that doesn't have a setter.
|
|
56
|
+
if (!protoProps[name].set) {
|
|
57
|
+
propNames.splice(i, 1);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
return propNames || [];
|
|
63
|
+
}
|
|
64
|
+
function getAttributesIfCustomElement(target) {
|
|
65
|
+
if (target.tagName.indexOf('-') !== -1) {
|
|
66
|
+
return target.constructor.observedAttributes;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
}
|
package/dist/elements/services/propertiesService/services/MathMLElementsPropertiesService.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
6
|
+
export declare class MathMLElementsPropertiesService extends CommonPropertiesService {
|
|
7
|
+
private commonMathProperties;
|
|
8
|
+
private mathProperties;
|
|
9
|
+
private mfracProperties;
|
|
10
|
+
name: string;
|
|
11
|
+
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
12
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
13
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
14
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
2
|
+
import { PropertyType } from '../PropertyType.js';
|
|
3
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
|
+
export class MathMLElementsPropertiesService extends CommonPropertiesService {
|
|
5
|
+
commonMathProperties = [
|
|
6
|
+
{
|
|
7
|
+
name: "displaystyle",
|
|
8
|
+
type: "boolean",
|
|
9
|
+
service: this,
|
|
10
|
+
defaultValue: true,
|
|
11
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
mathProperties = [
|
|
15
|
+
{
|
|
16
|
+
name: "display",
|
|
17
|
+
type: "list",
|
|
18
|
+
values: ["block", "inline"],
|
|
19
|
+
service: this,
|
|
20
|
+
defaultValue: "text",
|
|
21
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
mfracProperties = [
|
|
25
|
+
{
|
|
26
|
+
name: "denomalign",
|
|
27
|
+
type: "list",
|
|
28
|
+
values: ["left", "center", "right"],
|
|
29
|
+
service: this,
|
|
30
|
+
defaultValue: "center",
|
|
31
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "linethickness",
|
|
35
|
+
type: "string",
|
|
36
|
+
service: this,
|
|
37
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "numalign",
|
|
41
|
+
type: "list",
|
|
42
|
+
values: ["left", "center", "right"],
|
|
43
|
+
service: this,
|
|
44
|
+
defaultValue: "center",
|
|
45
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
name = "mathml";
|
|
49
|
+
getRefreshMode(designItem) {
|
|
50
|
+
return RefreshMode.full;
|
|
51
|
+
}
|
|
52
|
+
isHandledElement(designItem) {
|
|
53
|
+
return designItem.element instanceof MathMLElement;
|
|
54
|
+
}
|
|
55
|
+
getProperty(designItem, name) {
|
|
56
|
+
return this.getProperties(designItem).find(x => x.name == name);
|
|
57
|
+
}
|
|
58
|
+
getProperties(designItem) {
|
|
59
|
+
if (!this.isHandledElement(designItem))
|
|
60
|
+
return null;
|
|
61
|
+
switch (designItem.element.localName) {
|
|
62
|
+
case 'math':
|
|
63
|
+
return [...this.commonMathProperties, ...this.mathProperties];
|
|
64
|
+
case 'merror':
|
|
65
|
+
return [...this.commonMathProperties];
|
|
66
|
+
case 'mfrac':
|
|
67
|
+
return [...this.commonMathProperties, ...this.mfracProperties];
|
|
68
|
+
default:
|
|
69
|
+
return [...this.commonMathProperties];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
package/dist/elements/services/propertiesService/services/UnkownElementsPropertiesService.js
CHANGED
|
@@ -12,6 +12,8 @@ export class UnkownElementsPropertiesService extends AbstractPropertiesService {
|
|
|
12
12
|
let list = Object.getOwnPropertyNames(Object.getPrototypeOf(designItem.element));
|
|
13
13
|
let props = [];
|
|
14
14
|
for (let p of list) {
|
|
15
|
+
if (p.startsWith('on'))
|
|
16
|
+
continue;
|
|
15
17
|
let desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(designItem.element), p);
|
|
16
18
|
if (desc.get || desc.set) {
|
|
17
19
|
let v = designItem.element[p];
|
|
@@ -118,7 +118,6 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
118
118
|
font-weight: inherit;
|
|
119
119
|
font-style: inherit;
|
|
120
120
|
line-height: inherit;
|
|
121
|
-
--node-projects-web-component-designer-background: inherit;
|
|
122
121
|
}
|
|
123
122
|
* {
|
|
124
123
|
touch-action: none;
|
|
@@ -363,24 +362,34 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
363
362
|
if (!this.instanceServiceContainer.selectionService.primarySelection) {
|
|
364
363
|
this.zoomToFit();
|
|
365
364
|
this.disableBackgroud();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
365
|
+
try {
|
|
366
|
+
const el = this.rootDesignItem.element;
|
|
367
|
+
const sel = this.instanceServiceContainer.selectionService.selectedElements;
|
|
368
|
+
this.instanceServiceContainer.selectionService.setSelectedElements(null);
|
|
369
|
+
await sleep(100);
|
|
370
|
+
const screenshot = await Screenshot.takeScreenshot(el, el.clientWidth, el.clientHeight);
|
|
371
|
+
await exportData(dataURItoBlob(screenshot), "screenshot.png");
|
|
372
|
+
this.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
373
|
+
}
|
|
374
|
+
catch (err) {
|
|
375
|
+
console.error(err);
|
|
376
|
+
}
|
|
373
377
|
this.enableBackground();
|
|
374
378
|
}
|
|
375
379
|
else {
|
|
376
380
|
this.disableBackgroud();
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
try {
|
|
382
|
+
const el = this.instanceServiceContainer.selectionService.primarySelection.element;
|
|
383
|
+
const sel = this.instanceServiceContainer.selectionService.selectedElements;
|
|
384
|
+
this.instanceServiceContainer.selectionService.setSelectedElements(null);
|
|
385
|
+
await sleep(100);
|
|
386
|
+
const screenshot = await Screenshot.takeScreenshot(el, el.clientWidth, el.clientHeight);
|
|
387
|
+
await exportData(dataURItoBlob(screenshot), "screenshot.png");
|
|
388
|
+
this.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
389
|
+
}
|
|
390
|
+
catch (err) {
|
|
391
|
+
console.error(err);
|
|
392
|
+
}
|
|
384
393
|
this.enableBackground();
|
|
385
394
|
}
|
|
386
395
|
}
|
|
@@ -430,10 +439,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
430
439
|
}
|
|
431
440
|
}
|
|
432
441
|
disableBackgroud() {
|
|
433
|
-
this._canvasContainer.style.
|
|
442
|
+
this._canvasContainer.style.background = 'var(--node-projects-web-component-designer-screenshot-background, white)';
|
|
434
443
|
}
|
|
435
444
|
enableBackground() {
|
|
436
|
-
this._canvasContainer.style.
|
|
445
|
+
this._canvasContainer.style.background = '';
|
|
437
446
|
}
|
|
438
447
|
zoomToFit() {
|
|
439
448
|
const autoZomOffset = 10;
|
|
@@ -844,7 +853,8 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
844
853
|
}
|
|
845
854
|
_onDblClick(event) {
|
|
846
855
|
event.preventDefault();
|
|
847
|
-
this.
|
|
856
|
+
if (this.serviceContainer.globalContext.tool == null || this.serviceContainer.globalContext.tool === this.serviceContainer.designerTools.get(NamedTools.Pointer))
|
|
857
|
+
this.extensionManager.applyExtension(this.instanceServiceContainer.selectionService.primarySelection, ExtensionType.Doubleclick, event);
|
|
848
858
|
}
|
|
849
859
|
_searchShowOverlay() {
|
|
850
860
|
let divElement = this._getDomElement('node-projects-designer-search-container');
|
|
@@ -14,12 +14,14 @@ export class CanvasExtension extends AbstractExtension {
|
|
|
14
14
|
const top = Number.parseFloat(computedStyle.marginTop.replace('px', ''));
|
|
15
15
|
const right = Number.parseFloat(computedStyle.marginRight.replace('px', ''));
|
|
16
16
|
const bottom = Number.parseFloat(computedStyle.marginBottom.replace('px', ''));
|
|
17
|
-
if (
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
if (!isNaN(left) && !isNaN(top) && !isNaN(right) && !isNaN(bottom)) {
|
|
18
|
+
if (this._valuesHaveChanges(left, top, right, bottom, itemRect.x, itemRect.y, itemRect.width, itemRect.height)) {
|
|
19
|
+
this._removeAllOverlays();
|
|
20
|
+
this._drawRect(itemRect.x - left, itemRect.y - top, left + itemRect.width + right, top, 'svg-margin');
|
|
21
|
+
this._drawRect(itemRect.x - left, itemRect.y, left, itemRect.height, 'svg-margin');
|
|
22
|
+
this._drawRect(itemRect.x + itemRect.width, itemRect.y, right, itemRect.height, 'svg-margin');
|
|
23
|
+
this._drawRect(itemRect.x - left, itemRect.y + itemRect.height, left + itemRect.width + right, bottom, 'svg-margin');
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -8,7 +8,7 @@ export class PanTool {
|
|
|
8
8
|
designerCanvas.captureActiveTool(this);
|
|
9
9
|
break;
|
|
10
10
|
case EventNames.PointerMove:
|
|
11
|
-
if (event.buttons == 1) {
|
|
11
|
+
if (event.buttons == 1 || event.buttons == 4) {
|
|
12
12
|
designerCanvas.canvasOffset = { x: designerCanvas.canvasOffset.x + +event.movementX / designerCanvas.zoomFactor, y: designerCanvas.canvasOffset.y + event.movementY / designerCanvas.zoomFactor };
|
|
13
13
|
}
|
|
14
14
|
break;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCustomWebComponentConstructorAppend } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class DrawToolPopup extends BaseCustomWebComponentConstructorAppend {
|
|
3
3
|
static style: CSSStyleSheet;
|
|
4
4
|
static template: HTMLTemplateElement;
|
|
5
5
|
constructor();
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { html, BaseCustomWebComponentConstructorAppend, css } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
import { assetsPath } from "../../../../../../Constants.js";
|
|
3
|
+
export class DrawToolPopup extends BaseCustomWebComponentConstructorAppend {
|
|
4
|
+
static style = css `
|
|
5
|
+
.container {
|
|
6
|
+
width: 220px;
|
|
7
|
+
min-height: 200px;
|
|
8
|
+
color: white;
|
|
9
|
+
background-color: rgb(64, 64, 64);
|
|
10
|
+
border: 1px solid black;
|
|
11
|
+
}
|
|
12
|
+
header {
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
.tool {
|
|
16
|
+
height: 32px;
|
|
17
|
+
width: 32px;
|
|
18
|
+
background-color: rgb(255, 255, 255);
|
|
19
|
+
background-size: 65%;
|
|
20
|
+
background-repeat: no-repeat;
|
|
21
|
+
background-position: center center;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
border-bottom: 1px solid black;
|
|
24
|
+
}
|
|
25
|
+
.tools {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
margin-bottom: 5px;
|
|
29
|
+
}
|
|
30
|
+
.inputs{
|
|
31
|
+
float: left;
|
|
32
|
+
margin-top: 5px;
|
|
33
|
+
align-items: center;
|
|
34
|
+
}
|
|
35
|
+
.input {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
margin-top: 5px;
|
|
39
|
+
}
|
|
40
|
+
.text {
|
|
41
|
+
margin-left: 5px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
}
|
|
44
|
+
.strokecolor{
|
|
45
|
+
float: both;
|
|
46
|
+
}
|
|
47
|
+
.fillbrush{
|
|
48
|
+
float: both;
|
|
49
|
+
}
|
|
50
|
+
.strokethickness{
|
|
51
|
+
float: both;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
`;
|
|
55
|
+
static template = html `
|
|
56
|
+
<div class="container">
|
|
57
|
+
<header><h2 id="title" style="margin: 0;">Draw</h2></header>
|
|
58
|
+
<main id="content-area">
|
|
59
|
+
<div class="tools">
|
|
60
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawLine" title="Draw Line" style="background-image: url('${assetsPath}images/layout/DrawLineTool.svg');"></div>
|
|
61
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawPath" title="Pointer Tool" style="background-image: url('${assetsPath}images/layout/DrawPathTool.svg');"></div>
|
|
62
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawRect" title="Draw Rectangle" style="background-image: url('${assetsPath}images/layout/DrawRectTool.svg');"></div>
|
|
63
|
+
<div class="tool" data-command="setTool" data-command-parameter="DrawEllipsis" title="Draw Ellipsis" style="background-image: url('${assetsPath}images/layout/DrawEllipTool.svg');"></div>
|
|
64
|
+
<div class="tool" data-command="setTool" data-command-parameter="PickColor" title="Pick Color" style="background-image: url('${assetsPath}images/layout/ColorPickerTool.svg');"></div>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="inputs">
|
|
67
|
+
<div class="input">
|
|
68
|
+
<input id="strokecolor" class="strokecolor" type="color" title="stroke color" value="#000000" style="padding: 0; width:31px; height:31px;">
|
|
69
|
+
<text class="text">Stroke Color</text>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="input">
|
|
72
|
+
<input id="fillbrush" class="fillbrush" type="color" title="fill brush" value="#ffffff" style="padding: 0; width:31px; height:31px;">
|
|
73
|
+
<text class="text">Fill Brush</text>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="input">
|
|
76
|
+
<input id="strokethickness" class="strokethickness" type="range" title="stroke thickness" min="1" max="20" value="3" style="padding: 0; width:80px; height:20px; margin-right: 5px;">
|
|
77
|
+
<text class="text">Stroke Thickness</text>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
</div>`;
|
|
82
|
+
constructor() {
|
|
83
|
+
super();
|
|
84
|
+
for (let e of [...this.shadowRoot.querySelectorAll("div.tool")]) {
|
|
85
|
+
let div = e;
|
|
86
|
+
div.onclick = () => this.getRootNode().host.setTool(div.dataset['commandParameter']);
|
|
87
|
+
}
|
|
88
|
+
if (this.shadowRoot.querySelector("input.strokecolor")) {
|
|
89
|
+
let input = this._getDomElement("strokecolor");
|
|
90
|
+
input.onchange = () => this.getRootNode().host.setStrokeColor(input.value);
|
|
91
|
+
}
|
|
92
|
+
if (this.shadowRoot.querySelector("input.fillbrush")) {
|
|
93
|
+
let input = this._getDomElement("fillbrush");
|
|
94
|
+
input.onchange = () => this.getRootNode().host.setFillBrush(input.value);
|
|
95
|
+
}
|
|
96
|
+
if (this.shadowRoot.querySelector("input.strokethickness")) {
|
|
97
|
+
let input = this._getDomElement("strokethickness");
|
|
98
|
+
input.onchange = () => this.getRootNode().host.setStrokeThickness(input.value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
customElements.define('node-projects-designer-drawtool-popup', DrawToolPopup);
|
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ export * from "./elements/services/propertiesService/services/CssCurrentProperti
|
|
|
115
115
|
export * from "./elements/services/propertiesService/services/CssPropertiesService.js";
|
|
116
116
|
export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
|
|
117
117
|
export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
|
|
118
|
+
export * from "./elements/services/propertiesService/services/MathMLElementsPropertiesService.js";
|
|
118
119
|
export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
|
|
119
120
|
export * from "./elements/services/propertiesService/services/SVGElementsPropertiesService.js";
|
|
120
121
|
export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ export * from "./elements/services/propertiesService/services/CssCurrentProperti
|
|
|
74
74
|
export * from "./elements/services/propertiesService/services/CssPropertiesService.js";
|
|
75
75
|
export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
|
|
76
76
|
export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
|
|
77
|
+
export * from "./elements/services/propertiesService/services/MathMLElementsPropertiesService.js";
|
|
77
78
|
export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
|
|
78
79
|
export * from "./elements/services/propertiesService/services/SVGElementsPropertiesService.js";
|
|
79
80
|
export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "A UI designer for Polymer apps",
|
|
3
|
-
"name": "@node-projects/web-component-designer",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"author": "jochen.kuehner@gmx.de",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"tsc": "tsc",
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"prepublishOnly": "npm run build"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@node-projects/base-custom-webcomponent": ">=0.23.0"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"mdn-data": "^2.4.2"
|
|
19
|
-
},
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/node-projects/web-component-designer.git"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"description": "A UI designer for Polymer apps",
|
|
3
|
+
"name": "@node-projects/web-component-designer",
|
|
4
|
+
"version": "0.1.100",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"author": "jochen.kuehner@gmx.de",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"tsc": "tsc",
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@node-projects/base-custom-webcomponent": ">=0.23.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"mdn-data": "^2.4.2"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/node-projects/web-component-designer.git"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IPoint } from '../../../interfaces/IPoint.js';
|
|
2
|
-
import type { IPlacementService } from './IPlacementService.js';
|
|
3
|
-
import type { IDesignItem } from '../../item/IDesignItem.js';
|
|
4
|
-
import { IPlacementView } from '../../widgets/designerView/IPlacementView.js';
|
|
5
|
-
export declare class DefaultPlacementService implements IPlacementService {
|
|
6
|
-
serviceForContainer(container: IDesignItem, containerStyle: CSSStyleDeclaration): boolean;
|
|
7
|
-
isEnterableContainer(container: IDesignItem): boolean;
|
|
8
|
-
canEnter(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
9
|
-
canLeave(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
10
|
-
getElementOffset(container: IDesignItem, designItem?: IDesignItem): IPoint;
|
|
11
|
-
private calculateTrack;
|
|
12
|
-
placePoint(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): IPoint;
|
|
13
|
-
startPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
14
|
-
place(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
15
|
-
moveElements(designItems: IDesignItem[], position: IPoint, absolute: boolean): void;
|
|
16
|
-
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
17
|
-
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
18
|
-
finishPlace(event: MouseEvent, placementView: IPlacementView, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
19
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { DomConverter } from '../../widgets/designerView/DomConverter.js';
|
|
2
|
-
import { combineTransforms, extractTranslationFromDOMMatrix, getResultingTransformationBetweenElementAndAllAncestors } from '../../helper/TransformHelper.js';
|
|
3
|
-
import { filterChildPlaceItems, getDesignItemCurrentPos, placeDesignItem } from '../../helper/LayoutHelper.js';
|
|
4
|
-
import { ExtensionType } from '../../widgets/designerView/extensions/ExtensionType.js';
|
|
5
|
-
import { straightenLine } from '../../helper/PathDataPolyfill.js';
|
|
6
|
-
export class DefaultPlacementService {
|
|
7
|
-
serviceForContainer(container, containerStyle) {
|
|
8
|
-
if (containerStyle.display === 'grid' || containerStyle.display === 'inline-grid' ||
|
|
9
|
-
containerStyle.display === 'flex' || containerStyle.display === 'inline-flex')
|
|
10
|
-
return false;
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
isEnterableContainer(container) {
|
|
14
|
-
if (DomConverter.IsSelfClosingElement(container.element.localName))
|
|
15
|
-
return false;
|
|
16
|
-
if (!container.isRootItem && container.element.shadowRoot && container.element.shadowRoot.querySelector('slot') == null)
|
|
17
|
-
return false;
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
canEnter(container, items) {
|
|
21
|
-
if (!this.isEnterableContainer(container))
|
|
22
|
-
return false;
|
|
23
|
-
if (!items.every(x => !x.element.contains(container.element) && x !== container))
|
|
24
|
-
return false;
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
canLeave(container, items) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
getElementOffset(container, designItem) {
|
|
31
|
-
return container.instanceServiceContainer.designerCanvas.getNormalizedElementCoordinates(container.element);
|
|
32
|
-
}
|
|
33
|
-
calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, item) {
|
|
34
|
-
let trackX = newPoint.x - startPoint.x;
|
|
35
|
-
let trackY = newPoint.y - startPoint.y;
|
|
36
|
-
if (!event.ctrlKey) {
|
|
37
|
-
if (placementView.alignOnGrid) {
|
|
38
|
-
let p = getDesignItemCurrentPos(item, 'position');
|
|
39
|
-
p.x = p.x % placementView.gridSize;
|
|
40
|
-
p.y = p.y % placementView.gridSize;
|
|
41
|
-
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize - p.x;
|
|
42
|
-
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize - p.y;
|
|
43
|
-
}
|
|
44
|
-
else if (placementView.alignOnSnap) {
|
|
45
|
-
let rect = item.element.getBoundingClientRect();
|
|
46
|
-
let newPos = placementView.snapLines.snapToPosition({ x: (newPoint.x - offsetInControl.x), y: (newPoint.y - offsetInControl.y) }, { width: rect.width / placementView.scaleFactor, height: rect.height / placementView.scaleFactor }, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
47
|
-
if (newPos.x !== null) {
|
|
48
|
-
trackX = newPos.x - Math.round(startPoint.x) + Math.round(offsetInControl.x);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
trackX = Math.round(trackX);
|
|
52
|
-
}
|
|
53
|
-
if (newPos.y !== null) {
|
|
54
|
-
trackY = newPos.y - Math.round(startPoint.y) + Math.round(offsetInControl.y);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
trackY = Math.round(trackY);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return { x: trackX, y: trackY };
|
|
62
|
-
}
|
|
63
|
-
placePoint(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
64
|
-
let trackX = newPoint.x;
|
|
65
|
-
let trackY = newPoint.y;
|
|
66
|
-
if (!event.ctrlKey) {
|
|
67
|
-
if (placementView.alignOnGrid) {
|
|
68
|
-
trackX = Math.round(trackX / placementView.gridSize) * placementView.gridSize;
|
|
69
|
-
trackY = Math.round(trackY / placementView.gridSize) * placementView.gridSize;
|
|
70
|
-
}
|
|
71
|
-
else if (placementView.alignOnSnap) {
|
|
72
|
-
let newPos = placementView.snapLines.snapToPosition({ x: newPoint.x - offsetInControl.x, y: newPoint.y - offsetInControl.y }, null, { x: trackX > 0 ? 1 : -1, y: trackY > 0 ? 1 : -1 });
|
|
73
|
-
if (newPos.x !== null) {
|
|
74
|
-
trackX = newPos.x;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
trackX = Math.round(trackX);
|
|
78
|
-
}
|
|
79
|
-
if (newPos.y !== null) {
|
|
80
|
-
trackY = newPos.y;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
trackY = Math.round(trackY);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return { x: trackX, y: trackY };
|
|
88
|
-
}
|
|
89
|
-
startPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
90
|
-
}
|
|
91
|
-
place(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
92
|
-
//TODO: this should revert all undo actions while active
|
|
93
|
-
//maybe a undo actions returns itself or an id so it could be changed?
|
|
94
|
-
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
95
|
-
if (event.shiftKey) {
|
|
96
|
-
track = straightenLine({ x: 0, y: 0 }, track, true);
|
|
97
|
-
}
|
|
98
|
-
let filteredItems = filterChildPlaceItems(items);
|
|
99
|
-
for (const designItem of filteredItems) {
|
|
100
|
-
const canvas = designItem.instanceServiceContainer.designerCanvas.rootDesignItem.element;
|
|
101
|
-
let originalElementAndAllAncestorsMultipliedMatrix = getResultingTransformationBetweenElementAndAllAncestors(designItem.parent.element, canvas, true);
|
|
102
|
-
let transformMatrixParentTransformsCompensated = null;
|
|
103
|
-
if (originalElementAndAllAncestorsMultipliedMatrix) {
|
|
104
|
-
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0).matrixTransform(originalElementAndAllAncestorsMultipliedMatrix.inverse());
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0);
|
|
108
|
-
}
|
|
109
|
-
const translationMatrix = new DOMMatrix().translate(transformMatrixParentTransformsCompensated.x, transformMatrixParentTransformsCompensated.y);
|
|
110
|
-
combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
moveElements(designItems, position, absolute) {
|
|
114
|
-
//TODO: Check if we set left or right
|
|
115
|
-
//TODO: Use CSS units
|
|
116
|
-
for (let d of designItems) {
|
|
117
|
-
if (position.x)
|
|
118
|
-
d.setStyle('left', parseInt(d.element.style.left) - position.x + 'px');
|
|
119
|
-
if (position.y)
|
|
120
|
-
d.setStyle('top', parseInt(d.element.style.top) - position.y + 'px');
|
|
121
|
-
}
|
|
122
|
-
designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
|
|
123
|
-
}
|
|
124
|
-
enterContainer(container, items) {
|
|
125
|
-
let filterdItems = filterChildPlaceItems(items);
|
|
126
|
-
for (let i of filterdItems) {
|
|
127
|
-
container.insertChild(i);
|
|
128
|
-
if (i.lastContainerSize) {
|
|
129
|
-
if (!i.hasStyle('width'))
|
|
130
|
-
i.setStyle('width', i.lastContainerSize.width + 'px');
|
|
131
|
-
if (!i.hasStyle('height'))
|
|
132
|
-
i.setStyle('height', i.lastContainerSize.height + 'px');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
leaveContainer(container, items) {
|
|
137
|
-
}
|
|
138
|
-
finishPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
|
|
139
|
-
let filterdItems = filterChildPlaceItems(items);
|
|
140
|
-
for (const designItem of filterdItems) {
|
|
141
|
-
let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
|
|
142
|
-
const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
|
|
143
|
-
designItem.element.style.transform = designItem.getStyle('transform') ?? '';
|
|
144
|
-
let track = { x: translation.x, y: translation.y };
|
|
145
|
-
placeDesignItem(container, designItem, { x: track.x - stylesMapOffset.x, y: track.y - stylesMapOffset.y }, 'position');
|
|
146
|
-
}
|
|
147
|
-
for (const item of items) {
|
|
148
|
-
placementView.extensionManager.removeExtension(item, ExtensionType.Placement);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AbstractDesignViewConfigButton } from "./AbstractDesignViewConfigButton.js";
|
|
2
|
-
export declare const enableStylesheetService = "enableStylesheetService";
|
|
3
|
-
export declare class StylesheetServiceDesignViewConfigButtons extends AbstractDesignViewConfigButton {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractDesignViewConfigButton } from "./AbstractDesignViewConfigButton.js";
|
|
2
|
-
export const enableStylesheetService = 'enableStylesheetService';
|
|
3
|
-
export class StylesheetServiceDesignViewConfigButtons extends AbstractDesignViewConfigButton {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(enableStylesheetService, "ss", "modify Stylesheet");
|
|
6
|
-
}
|
|
7
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { html, BaseCustomWebComponentConstructorAppend, css } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { assetsPath } from "../../../../../../Constants.js";
|
|
3
|
-
export class PointerToolPopup extends BaseCustomWebComponentConstructorAppend {
|
|
4
|
-
static style = css `
|
|
5
|
-
.container {
|
|
6
|
-
width: 120px;
|
|
7
|
-
min-height: 100px;
|
|
8
|
-
color: white;
|
|
9
|
-
background-color: rgb(64, 64, 64);
|
|
10
|
-
border: 1px solid black;
|
|
11
|
-
}
|
|
12
|
-
header {
|
|
13
|
-
text-align: center;
|
|
14
|
-
}
|
|
15
|
-
.tool {
|
|
16
|
-
height: 32px;
|
|
17
|
-
width: 32px;
|
|
18
|
-
background-color: rgb(255, 255, 255);
|
|
19
|
-
background-size: 65%;
|
|
20
|
-
background-repeat: no-repeat;
|
|
21
|
-
background-position: center center;
|
|
22
|
-
flex-shrink: 0;
|
|
23
|
-
border-bottom: 1px solid black;
|
|
24
|
-
}
|
|
25
|
-
.tools {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-wrap: wrap;
|
|
28
|
-
margin-bottom: 5px;
|
|
29
|
-
gap: 3px;
|
|
30
|
-
}`;
|
|
31
|
-
static template = html `
|
|
32
|
-
<div class="container">
|
|
33
|
-
<header><h2 id="title" style="margin: 0;">Selection</h2></header>
|
|
34
|
-
<main id="content-area">
|
|
35
|
-
<div class="tools">
|
|
36
|
-
<div class="tool" data-command="setTool" data-command-parameter="RectangleSelector" title="Rectangle Selector" style="background-image: url('${assetsPath}images/tools/SelectRectTool.svg');"></div>
|
|
37
|
-
<div class="tool" data-command="setTool" data-command-parameter="MagicWandSelector" title="Magic Wand Selector" style="background-image: url('${assetsPath}images/tools/MagicWandTool.svg');"></div>
|
|
38
|
-
</div>
|
|
39
|
-
</main>
|
|
40
|
-
</div>`;
|
|
41
|
-
constructor() {
|
|
42
|
-
super();
|
|
43
|
-
for (let e of [...this.shadowRoot.querySelectorAll("div.tool")]) {
|
|
44
|
-
let div = e;
|
|
45
|
-
div.onclick = () => this.getRootNode().host.setTool(div.dataset['commandParameter']);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
customElements.define('node-projects-designer-selection-tool-popup', SelectionToolPopup);
|
package/dist/elements/widgets/designerView/tools/toolBar/popups/SelectionToolPopup copy.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentConstructorAppend } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
export declare class SelectionToolPopup extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
-
static style: CSSStyleSheet;
|
|
4
|
-
static template: HTMLTemplateElement;
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { html, BaseCustomWebComponentConstructorAppend, css } from '@node-projects/base-custom-webcomponent';
|
|
2
|
-
import { assetsPath } from "../../../../../../Constants.js";
|
|
3
|
-
export class SelectionToolPopup extends BaseCustomWebComponentConstructorAppend {
|
|
4
|
-
static style = css `
|
|
5
|
-
.container {
|
|
6
|
-
width: 120px;
|
|
7
|
-
min-height: 100px;
|
|
8
|
-
color: white;
|
|
9
|
-
background-color: rgb(64, 64, 64);
|
|
10
|
-
border: 1px solid black;
|
|
11
|
-
}
|
|
12
|
-
header {
|
|
13
|
-
text-align: center;
|
|
14
|
-
}
|
|
15
|
-
.tool {
|
|
16
|
-
height: 32px;
|
|
17
|
-
width: 32px;
|
|
18
|
-
background-color: rgb(255, 255, 255);
|
|
19
|
-
background-size: 65%;
|
|
20
|
-
background-repeat: no-repeat;
|
|
21
|
-
background-position: center center;
|
|
22
|
-
flex-shrink: 0;
|
|
23
|
-
border-bottom: 1px solid black;
|
|
24
|
-
}
|
|
25
|
-
.tools {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-wrap: wrap;
|
|
28
|
-
margin-bottom: 5px;
|
|
29
|
-
gap: 3px;
|
|
30
|
-
}`;
|
|
31
|
-
static template = html `
|
|
32
|
-
<div class="container">
|
|
33
|
-
<header><h2 id="title" style="margin: 0;">Selection</h2></header>
|
|
34
|
-
<main id="content-area">
|
|
35
|
-
<div class="tools">
|
|
36
|
-
<div class="tool" data-command="setTool" data-command-parameter="RectangleSelector" title="Rectangle Selector" style="background-image: url('${assetsPath}images/tools/SelectRectTool.svg');"></div>
|
|
37
|
-
<div class="tool" data-command="setTool" data-command-parameter="MagicWandSelector" title="Magic Wand Selector" style="background-image: url('${assetsPath}images/tools/MagicWandTool.svg');"></div>
|
|
38
|
-
</div>
|
|
39
|
-
</main>
|
|
40
|
-
</div>`;
|
|
41
|
-
constructor() {
|
|
42
|
-
super();
|
|
43
|
-
for (let e of [...this.shadowRoot.querySelectorAll("div.tool")]) {
|
|
44
|
-
let div = e;
|
|
45
|
-
div.onclick = () => this.getRootNode().host.setTool(div.dataset['commandParameter']);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
customElements.define('node-projects-designer-selection-tool-popup', SelectionToolPopup);
|