@node-projects/web-component-designer 0.0.36 → 0.0.40
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/assets/images/chromeDevtools/flex-direction-row-icon.svg +82 -1
- package/assets/images/chromeDevtools/{flex-nowrap-icon.svg → flex-wrap-nowrap-icon.svg} +0 -0
- package/assets/images/chromeDevtools/{flex-wrap-icon.svg → flex-wrap-wrap-icon.svg} +0 -0
- package/dist/elements/controls/DesignerTabControl.js +1 -1
- package/dist/elements/controls/ThicknessEditor.d.ts +20 -4
- package/dist/elements/controls/ThicknessEditor.js +74 -9
- package/dist/elements/item/DesignItem.d.ts +1 -0
- package/dist/elements/item/DesignItem.js +3 -0
- package/dist/elements/item/IDesignItem.d.ts +1 -0
- package/dist/elements/services/ServiceContainer.d.ts +2 -0
- package/dist/elements/services/ServiceContainer.js +1 -0
- package/dist/elements/services/propertiesService/propertyEditors/BasePropertyEditor.js +6 -1
- package/dist/elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js +1 -1
- package/dist/elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js +2 -2
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +10 -0
- package/dist/elements/widgets/designerView/IDesignerCanvas.d.ts +1 -0
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +3 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +20 -1
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.d.ts +22 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.js +52 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.d.ts +2 -12
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.js +3 -73
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.d.ts +16 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.js +50 -0
- package/dist/elements/widgets/designerView/extensions/AltToEnterContainerExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/CanvasExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.js +4 -4
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +14 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionType.d.ts +0 -3
- package/dist/elements/widgets/designerView/extensions/ExtensionType.js +0 -3
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.js +5 -5
- package/dist/elements/widgets/designerView/extensions/GridExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/IExtensionManger.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/InvisibleDivExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/MouseOverExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PositionExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +21 -21
- package/dist/elements/widgets/designerView/extensions/RotateExtension.js +3 -3
- package/dist/elements/widgets/designerView/extensions/SelectionDefaultExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.d.ts +3 -14
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.js +4 -75
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.js +27 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.js +26 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.d.ts +7 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.js +10 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.d.ts +7 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.js +15 -8
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtension.d.ts +1 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtensionProvider.d.ts +1 -4
- package/dist/elements/widgets/designerView/overlayLayerView.d.ts +4 -0
- package/dist/elements/widgets/designerView/overlayLayerView.js +62 -1
- package/dist/elements/widgets/designerView/tools/PointerTool.js +1 -5
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/package.json +3 -3
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
10
|
+
fill="none"
|
|
11
|
+
viewBox="0 0 13 13"
|
|
12
|
+
version="1.1"
|
|
13
|
+
id="svg15"
|
|
14
|
+
sodipodi:docname="flex-direction-row-icon.svg"
|
|
15
|
+
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
|
|
16
|
+
<metadata
|
|
17
|
+
id="metadata19">
|
|
18
|
+
<rdf:RDF>
|
|
19
|
+
<cc:Work
|
|
20
|
+
rdf:about="">
|
|
21
|
+
<dc:format>image/svg+xml</dc:format>
|
|
22
|
+
<dc:type
|
|
23
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
24
|
+
</cc:Work>
|
|
25
|
+
</rdf:RDF>
|
|
26
|
+
</metadata>
|
|
27
|
+
<sodipodi:namedview
|
|
28
|
+
pagecolor="#ffffff"
|
|
29
|
+
bordercolor="#666666"
|
|
30
|
+
borderopacity="1"
|
|
31
|
+
objecttolerance="10"
|
|
32
|
+
gridtolerance="10"
|
|
33
|
+
guidetolerance="10"
|
|
34
|
+
inkscape:pageopacity="0"
|
|
35
|
+
inkscape:pageshadow="2"
|
|
36
|
+
inkscape:window-width="1680"
|
|
37
|
+
inkscape:window-height="987"
|
|
38
|
+
id="namedview17"
|
|
39
|
+
showgrid="false"
|
|
40
|
+
inkscape:zoom="63.076923"
|
|
41
|
+
inkscape:cx="6.5"
|
|
42
|
+
inkscape:cy="6.5"
|
|
43
|
+
inkscape:window-x="-8"
|
|
44
|
+
inkscape:window-y="-8"
|
|
45
|
+
inkscape:window-maximized="1"
|
|
46
|
+
inkscape:current-layer="svg15" />
|
|
47
|
+
<g
|
|
48
|
+
clip-path="url(#clip0)"
|
|
49
|
+
id="g8"
|
|
50
|
+
transform="matrix(0,1,1,0,0,0)">
|
|
51
|
+
<rect
|
|
52
|
+
x="2"
|
|
53
|
+
y="2.816"
|
|
54
|
+
width="4.6069999"
|
|
55
|
+
height="2.7379999"
|
|
56
|
+
rx="0.5"
|
|
57
|
+
stroke="#000000"
|
|
58
|
+
id="rect2" />
|
|
59
|
+
<rect
|
|
60
|
+
x="1.5"
|
|
61
|
+
y="6.9889998"
|
|
62
|
+
width="5.6069999"
|
|
63
|
+
height="3.7379999"
|
|
64
|
+
rx="1"
|
|
65
|
+
fill="#000000"
|
|
66
|
+
id="rect4" />
|
|
67
|
+
<path
|
|
68
|
+
d="M 9.461,1.5 V 9.13 H 8 L 10.002,12 12,9.13 H 10.542 V 1.5 h -1.08 z"
|
|
69
|
+
fill="#000000"
|
|
70
|
+
id="path6" />
|
|
71
|
+
</g>
|
|
72
|
+
<defs
|
|
73
|
+
id="defs13">
|
|
74
|
+
<clipPath
|
|
75
|
+
id="clip0">
|
|
76
|
+
<path
|
|
77
|
+
fill="#fff"
|
|
78
|
+
d="M0 0h13v13H0z"
|
|
79
|
+
id="path10" />
|
|
80
|
+
</clipPath>
|
|
81
|
+
</defs>
|
|
82
|
+
</svg>
|
|
File without changes
|
|
File without changes
|
|
@@ -137,7 +137,7 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
|
|
|
137
137
|
let htmlItem = item;
|
|
138
138
|
const tabHeaderDiv = this._elementMap.get(htmlItem);
|
|
139
139
|
this._moreContainer.appendChild(tabHeaderDiv);
|
|
140
|
-
if (w < this._headerDiv.clientWidth) {
|
|
140
|
+
if (this._headerDiv.children.length == 0 || (w + (tabHeaderDiv.clientWidth / 2)) < this._headerDiv.clientWidth) {
|
|
141
141
|
this._headerDiv.appendChild(tabHeaderDiv);
|
|
142
142
|
w += tabHeaderDiv.clientWidth;
|
|
143
143
|
}
|
|
@@ -6,10 +6,26 @@ export declare type ThicknessEditorValueChangedEventArgs = {
|
|
|
6
6
|
export declare class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
7
7
|
static readonly style: CSSStyleSheet;
|
|
8
8
|
static readonly template: HTMLTemplateElement;
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
private _leftInput;
|
|
10
|
+
private _topInput;
|
|
11
|
+
private _rightInput;
|
|
12
|
+
private _bottomInput;
|
|
13
|
+
private _valueLeft;
|
|
14
|
+
get valueLeft(): string;
|
|
15
|
+
set valueLeft(value: string);
|
|
16
|
+
valueLeftChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
17
|
+
private _valueTop;
|
|
18
|
+
get valueTop(): string;
|
|
19
|
+
set valueTop(value: string);
|
|
20
|
+
valueTopChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
21
|
+
private _valueRight;
|
|
22
|
+
get valueRight(): string;
|
|
23
|
+
set valueRight(value: string);
|
|
24
|
+
valueRightChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
25
|
+
private _valueBottom;
|
|
26
|
+
get valueBottom(): string;
|
|
27
|
+
set valueBottom(value: string);
|
|
28
|
+
valueBottomChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
13
29
|
property: string;
|
|
14
30
|
unsetValue: string;
|
|
15
31
|
_updateValue(): void;
|
|
@@ -57,23 +57,88 @@ export class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
57
57
|
<div id="rect"></div>
|
|
58
58
|
</div>
|
|
59
59
|
`;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
_leftInput;
|
|
61
|
+
_topInput;
|
|
62
|
+
_rightInput;
|
|
63
|
+
_bottomInput;
|
|
64
|
+
_valueLeft;
|
|
65
|
+
get valueLeft() {
|
|
66
|
+
return this._valueLeft;
|
|
63
67
|
}
|
|
64
|
-
set
|
|
65
|
-
const oldValue = this.
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
set valueLeft(value) {
|
|
69
|
+
const oldValue = this._valueLeft;
|
|
70
|
+
this._valueLeft = value;
|
|
71
|
+
if (oldValue !== value) {
|
|
72
|
+
this._updateValue();
|
|
73
|
+
this.valueLeftChanged.emit({ newValue: value, oldValue: oldValue });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
valueLeftChanged = new TypedEvent();
|
|
77
|
+
_valueTop;
|
|
78
|
+
get valueTop() {
|
|
79
|
+
return this._valueTop;
|
|
80
|
+
}
|
|
81
|
+
set valueTop(value) {
|
|
82
|
+
const oldValue = this._valueTop;
|
|
83
|
+
this._valueTop = value;
|
|
84
|
+
if (oldValue !== value) {
|
|
85
|
+
this._updateValue();
|
|
86
|
+
this.valueTopChanged.emit({ newValue: value, oldValue: oldValue });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
valueTopChanged = new TypedEvent();
|
|
90
|
+
_valueRight;
|
|
91
|
+
get valueRight() {
|
|
92
|
+
return this._valueRight;
|
|
93
|
+
}
|
|
94
|
+
set valueRight(value) {
|
|
95
|
+
const oldValue = this._valueRight;
|
|
96
|
+
this._valueRight = value;
|
|
97
|
+
if (oldValue !== value) {
|
|
98
|
+
this._updateValue();
|
|
99
|
+
this.valueRightChanged.emit({ newValue: value, oldValue: oldValue });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
valueRightChanged = new TypedEvent();
|
|
103
|
+
_valueBottom;
|
|
104
|
+
get valueBottom() {
|
|
105
|
+
return this._valueBottom;
|
|
106
|
+
}
|
|
107
|
+
set valueBottom(value) {
|
|
108
|
+
const oldValue = this._valueBottom;
|
|
109
|
+
this._valueBottom = value;
|
|
110
|
+
if (oldValue !== value) {
|
|
111
|
+
this._updateValue();
|
|
112
|
+
this.valueBottomChanged.emit({ newValue: value, oldValue: oldValue });
|
|
113
|
+
}
|
|
69
114
|
}
|
|
70
|
-
|
|
115
|
+
valueBottomChanged = new TypedEvent();
|
|
71
116
|
property;
|
|
72
117
|
unsetValue;
|
|
73
118
|
_updateValue() {
|
|
119
|
+
this._leftInput.value = this.valueLeft;
|
|
120
|
+
this._topInput.value = this.valueTop;
|
|
121
|
+
this._rightInput.value = this.valueRight;
|
|
122
|
+
this._bottomInput.value = this._valueBottom;
|
|
74
123
|
}
|
|
75
124
|
ready() {
|
|
76
125
|
this._parseAttributesToProperties();
|
|
126
|
+
this._leftInput = this._getDomElement('left');
|
|
127
|
+
this._topInput = this._getDomElement('top');
|
|
128
|
+
this._rightInput = this._getDomElement('right');
|
|
129
|
+
this._bottomInput = this._getDomElement('bottom');
|
|
130
|
+
this._leftInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
131
|
+
this._valueLeft = this._leftInput.value; };
|
|
132
|
+
this._topInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
133
|
+
this._valueTop = this._topInput.value; };
|
|
134
|
+
this._rightInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
135
|
+
this._valueRight = this._rightInput.value; };
|
|
136
|
+
this._bottomInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
137
|
+
this._valueBottom = this._bottomInput.value; };
|
|
138
|
+
this._leftInput.onblur = (e) => this._valueLeft = this._leftInput.value;
|
|
139
|
+
this._topInput.onblur = (e) => this._valueTop = this._topInput.value;
|
|
140
|
+
this._rightInput.onblur = (e) => this._valueRight = this._rightInput.value;
|
|
141
|
+
this._bottomInput.onblur = (e) => this._valueBottom = this._bottomInput.value;
|
|
77
142
|
this._updateValue();
|
|
78
143
|
}
|
|
79
144
|
}
|
|
@@ -44,6 +44,9 @@ export class DesignItem {
|
|
|
44
44
|
set id(value) {
|
|
45
45
|
this.element.id = value;
|
|
46
46
|
}
|
|
47
|
+
get isRootItem() {
|
|
48
|
+
return this.instanceServiceContainer.contentService.rootDesignItem === this;
|
|
49
|
+
}
|
|
47
50
|
_childArray = [];
|
|
48
51
|
get hasChildren() {
|
|
49
52
|
return this._childArray.length > 0;
|
|
@@ -21,6 +21,7 @@ import { ISnaplinesProviderService } from "./placementService/ISnaplinesProvider
|
|
|
21
21
|
import { IPrepareElementsForDesignerService } from './instanceService/IPrepareElementsForDesignerService';
|
|
22
22
|
import { IDragDropService } from './dragDropService/IDragDropService';
|
|
23
23
|
import { ICopyPasteService } from "./copyPasteService/ICopyPasteService.js";
|
|
24
|
+
import { IDesignerPointerExtensionProvider } from "../widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtensionProvider.js";
|
|
24
25
|
interface ServiceNameMap {
|
|
25
26
|
"propertyService": IPropertiesService;
|
|
26
27
|
"containerService": IPlacementService;
|
|
@@ -43,6 +44,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
|
|
|
43
44
|
demoViewWidget: new (...args: any[]) => IDemoView & HTMLElement;
|
|
44
45
|
};
|
|
45
46
|
readonly designerExtensions: Map<(ExtensionType | string), IDesignerExtensionProvider[]>;
|
|
47
|
+
readonly designerPointerExtensions: IDesignerPointerExtensionProvider[];
|
|
46
48
|
designerContextMenuExtensions: IContextMenuExtension[];
|
|
47
49
|
readonly globalContext: GlobalContext;
|
|
48
50
|
readonly designerTools: Map<string | NamedTools, ITool>;
|
|
@@ -8,6 +8,7 @@ export class ServiceContainer extends BaseServiceContainer {
|
|
|
8
8
|
demoViewWidget: DemoView
|
|
9
9
|
};
|
|
10
10
|
designerExtensions = new Map();
|
|
11
|
+
designerPointerExtensions = [];
|
|
11
12
|
designerContextMenuExtensions;
|
|
12
13
|
globalContext = new GlobalContext(this);
|
|
13
14
|
designerTools = new Map();
|
|
@@ -30,7 +30,12 @@ export class BasePropertyEditor {
|
|
|
30
30
|
else
|
|
31
31
|
this.element.classList.remove('unset-value');
|
|
32
32
|
this.disableChangeNotification = true;
|
|
33
|
-
|
|
33
|
+
try {
|
|
34
|
+
this.refreshValue(valueType, value);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
console.error(err);
|
|
38
|
+
}
|
|
34
39
|
this.disableChangeNotification = false;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
@@ -5,10 +5,10 @@ export class ThicknessPropertyEditor extends BasePropertyEditor {
|
|
|
5
5
|
super(property);
|
|
6
6
|
const selector = new ThicknessEditor();
|
|
7
7
|
selector.property = property.name;
|
|
8
|
-
selector.
|
|
8
|
+
selector.valueLeftChanged.on((e) => this._valueChanged(e.newValue));
|
|
9
9
|
this.element = selector;
|
|
10
10
|
}
|
|
11
11
|
refreshValue(valueType, value) {
|
|
12
|
-
this.element.
|
|
12
|
+
this.element.valueLeft = value;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -115,6 +115,11 @@ export class CssPropertiesService {
|
|
|
115
115
|
type: "list",
|
|
116
116
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
117
117
|
service: this
|
|
118
|
+
}, {
|
|
119
|
+
name: "position",
|
|
120
|
+
type: "list",
|
|
121
|
+
values: ["static", "relative", "absolute"],
|
|
122
|
+
service: this
|
|
118
123
|
}, {
|
|
119
124
|
name: "grid-template-columns",
|
|
120
125
|
type: "string",
|
|
@@ -160,6 +165,11 @@ export class CssPropertiesService {
|
|
|
160
165
|
type: "list",
|
|
161
166
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
162
167
|
service: this
|
|
168
|
+
}, {
|
|
169
|
+
name: "position",
|
|
170
|
+
type: "list",
|
|
171
|
+
values: ["static", "relative", "absolute"],
|
|
172
|
+
service: this
|
|
163
173
|
}, {
|
|
164
174
|
name: "flex-direction",
|
|
165
175
|
type: "img-list",
|
|
@@ -22,6 +22,7 @@ export interface IDesignerCanvas extends IPlacementView, IUiCommandHandler {
|
|
|
22
22
|
eatEvents: Element;
|
|
23
23
|
initialize(serviceContainer: ServiceContainer): any;
|
|
24
24
|
getNormalizedEventCoordinates(event: MouseEvent): IPoint;
|
|
25
|
+
getNormalizedOffsetInElement(event: MouseEvent, element: Element): IPoint;
|
|
25
26
|
getElementAtPoint(point: IPoint, ignoreElementCallback?: (element: HTMLElement) => boolean): any;
|
|
26
27
|
elementFromPoint(x: number, y: number): Element;
|
|
27
28
|
}
|
|
@@ -40,6 +40,7 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
40
40
|
static readonly style: CSSStyleSheet;
|
|
41
41
|
static readonly template: HTMLTemplateElement;
|
|
42
42
|
extensionManager: IExtensionManager;
|
|
43
|
+
private _pointerextensions;
|
|
43
44
|
private _onDblClickBound;
|
|
44
45
|
constructor();
|
|
45
46
|
get designerWidth(): string;
|
|
@@ -70,6 +71,8 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
70
71
|
private onKeyUp;
|
|
71
72
|
private onKeyDown;
|
|
72
73
|
getNormalizedEventCoordinates(event: MouseEvent): IPoint;
|
|
74
|
+
getNormalizedElementCoordinates(element: Element): IPoint;
|
|
75
|
+
getNormalizedOffsetInElement(event: MouseEvent, element: Element): IPoint;
|
|
73
76
|
static getHost(node: Node): Element;
|
|
74
77
|
getElementAtPoint(point: IPoint, ignoreElementCallback?: (element: HTMLElement) => boolean): HTMLElement;
|
|
75
78
|
_rect: SVGRectElement;
|
|
@@ -103,13 +103,13 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
103
103
|
<div style="width: 100%;height: 100%;">
|
|
104
104
|
<div id="node-projects-designer-canvas-outercanvas2" style="width: 100%;height: 100%;position: relative;overflow: auto;">
|
|
105
105
|
<div id="node-projects-designer-canvas-canvasContainer" style="width: 100%;height: 100%;margin: auto;position: absolute;top: 0;/* bottom: 0; does not work with fixed sized when size is bigger then view */left: 0;user-select: none;">
|
|
106
|
-
<!-- <div id="zoomHelper" style="width: 10px; height: 10px; position: absolute; top: 0; left: 0; pointer-events: none;"></div> -->
|
|
107
106
|
<div id="node-projects-designer-canvas-canvas" part="canvas" tabindex="0"></div>
|
|
108
107
|
</div>
|
|
109
108
|
</div>
|
|
110
109
|
</div>
|
|
111
110
|
</div>`;
|
|
112
111
|
extensionManager;
|
|
112
|
+
_pointerextensions;
|
|
113
113
|
_onDblClickBound;
|
|
114
114
|
constructor() {
|
|
115
115
|
super();
|
|
@@ -276,6 +276,12 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
276
276
|
this._canvasContainer.appendChild(this.overlayLayer);
|
|
277
277
|
this.snapLines = new Snaplines(this.overlayLayer);
|
|
278
278
|
this.snapLines.initialize(this.rootDesignItem);
|
|
279
|
+
if (this.serviceContainer.designerPointerExtensions)
|
|
280
|
+
for (let pe of this.serviceContainer.designerPointerExtensions) {
|
|
281
|
+
if (!this._pointerextensions)
|
|
282
|
+
this._pointerextensions = [];
|
|
283
|
+
this._pointerextensions.push(pe.getExtension(this));
|
|
284
|
+
}
|
|
279
285
|
if (this.children) {
|
|
280
286
|
let children = this.children;
|
|
281
287
|
if (this.children.length == 1 && this.children[0] instanceof HTMLSlotElement) {
|
|
@@ -486,6 +492,15 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
486
492
|
y: offsetOfOuterY - offsetOfCanvasY
|
|
487
493
|
};
|
|
488
494
|
}
|
|
495
|
+
getNormalizedElementCoordinates(element) {
|
|
496
|
+
const targetRect = element.getBoundingClientRect();
|
|
497
|
+
return { x: targetRect.x - this.containerBoundingRect.x, y: targetRect.y - this.containerBoundingRect.y };
|
|
498
|
+
}
|
|
499
|
+
getNormalizedOffsetInElement(event, element) {
|
|
500
|
+
const normEvt = this.getNormalizedEventCoordinates(event);
|
|
501
|
+
const normEl = this.getNormalizedElementCoordinates(element);
|
|
502
|
+
return { x: normEvt.x - normEl.x, y: normEvt.y - normEl.y };
|
|
503
|
+
}
|
|
489
504
|
//todo remove, is in base custom webcomp domhelper
|
|
490
505
|
static getHost(node) {
|
|
491
506
|
while (node.parentElement)
|
|
@@ -539,6 +554,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
539
554
|
_rect;
|
|
540
555
|
_pointerEventHandler(event) {
|
|
541
556
|
this._fillCalculationrects();
|
|
557
|
+
if (this._pointerextensions) {
|
|
558
|
+
for (let pe of this._pointerextensions)
|
|
559
|
+
pe.refresh(event);
|
|
560
|
+
}
|
|
542
561
|
if (event.composedPath().indexOf(this.eatEvents) >= 0)
|
|
543
562
|
return;
|
|
544
563
|
if (event.button == 2)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IDesignItem } from "../../../item/IDesignItem";
|
|
2
|
+
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
3
|
+
import { IDesignerExtension } from "./IDesignerExtension";
|
|
4
|
+
import { IExtensionManager } from "./IExtensionManger";
|
|
5
|
+
import { OverlayLayerView } from '../overlayLayerView';
|
|
6
|
+
import { OverlayLayer } from './OverlayLayer';
|
|
7
|
+
export declare abstract class AbstractExtension implements IDesignerExtension {
|
|
8
|
+
protected overlays: SVGGraphicsElement[];
|
|
9
|
+
protected overlayLayerView: OverlayLayerView;
|
|
10
|
+
protected extensionManager: IExtensionManager;
|
|
11
|
+
protected designerView: IDesignerCanvas;
|
|
12
|
+
protected extendedItem: IDesignItem;
|
|
13
|
+
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
14
|
+
abstract extend(): any;
|
|
15
|
+
abstract refresh(): any;
|
|
16
|
+
abstract dispose(): any;
|
|
17
|
+
protected _removeAllOverlays(): void;
|
|
18
|
+
_drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
19
|
+
_drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
20
|
+
_drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
21
|
+
_drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export class AbstractExtension {
|
|
2
|
+
overlays = [];
|
|
3
|
+
overlayLayerView;
|
|
4
|
+
extensionManager;
|
|
5
|
+
designerView;
|
|
6
|
+
extendedItem;
|
|
7
|
+
constructor(extensionManager, designerView, extendedItem) {
|
|
8
|
+
this.extensionManager = extensionManager;
|
|
9
|
+
this.designerView = designerView;
|
|
10
|
+
this.extendedItem = extendedItem;
|
|
11
|
+
this.overlayLayerView = designerView.overlayLayer;
|
|
12
|
+
}
|
|
13
|
+
_removeAllOverlays() {
|
|
14
|
+
for (let o of this.overlays) {
|
|
15
|
+
try {
|
|
16
|
+
this.overlayLayerView.removeOverlay(o);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
console.error(err);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
this.overlays = [];
|
|
23
|
+
}
|
|
24
|
+
_drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
25
|
+
const newLine = this.overlayLayerView.drawLine(x1, y1, x2, y2, className, line, overlayLayer);
|
|
26
|
+
if (!line) {
|
|
27
|
+
this.overlays.push(newLine);
|
|
28
|
+
}
|
|
29
|
+
return newLine;
|
|
30
|
+
}
|
|
31
|
+
_drawCircle(x, y, radius, className, circle, overlayLayer) {
|
|
32
|
+
const newCircle = this.overlayLayerView.drawCircle(x, y, radius, className, circle, overlayLayer);
|
|
33
|
+
if (!circle) {
|
|
34
|
+
this.overlays.push(newCircle);
|
|
35
|
+
}
|
|
36
|
+
return circle;
|
|
37
|
+
}
|
|
38
|
+
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
39
|
+
const newRect = this.overlayLayerView.drawRect(x, y, w, h, className, rect, overlayLayer);
|
|
40
|
+
if (!rect) {
|
|
41
|
+
this.overlays.push(newRect);
|
|
42
|
+
}
|
|
43
|
+
return newRect;
|
|
44
|
+
}
|
|
45
|
+
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
46
|
+
const newText = this.overlayLayerView.drawText(text, x, y, className, textEl, overlayLayer);
|
|
47
|
+
if (!textEl) {
|
|
48
|
+
this.overlays.push(newText);
|
|
49
|
+
}
|
|
50
|
+
return newText;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -2,21 +2,11 @@ import { IDesignItem } from "../../../item/IDesignItem";
|
|
|
2
2
|
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
3
3
|
import { IDesignerExtension } from "./IDesignerExtension";
|
|
4
4
|
import { IExtensionManager } from "./IExtensionManger";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export declare abstract class AbstractExtension implements IDesignerExtension {
|
|
8
|
-
protected overlays: SVGGraphicsElement[];
|
|
9
|
-
protected overlayLayerView: OverlayLayerView;
|
|
10
|
-
protected extensionManager: IExtensionManager;
|
|
11
|
-
protected designerView: IDesignerCanvas;
|
|
5
|
+
import { AbstractExtensionBase } from "./AbstractExtensionBase.js";
|
|
6
|
+
export declare abstract class AbstractExtension extends AbstractExtensionBase implements IDesignerExtension {
|
|
12
7
|
protected extendedItem: IDesignItem;
|
|
13
8
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
14
9
|
abstract extend(): any;
|
|
15
10
|
abstract refresh(): any;
|
|
16
11
|
abstract dispose(): any;
|
|
17
|
-
protected _removeAllOverlays(): void;
|
|
18
|
-
_drawLineOverlay(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
19
|
-
_drawCircleOverlay(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
20
|
-
_drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
21
|
-
_drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
22
12
|
}
|
|
@@ -1,78 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
overlayLayerView;
|
|
4
|
-
extensionManager;
|
|
5
|
-
designerView;
|
|
1
|
+
import { AbstractExtensionBase } from "./AbstractExtensionBase.js";
|
|
2
|
+
export class AbstractExtension extends AbstractExtensionBase {
|
|
6
3
|
extendedItem;
|
|
7
4
|
constructor(extensionManager, designerView, extendedItem) {
|
|
8
|
-
|
|
9
|
-
this.designerView = designerView;
|
|
5
|
+
super(extensionManager, designerView);
|
|
10
6
|
this.extendedItem = extendedItem;
|
|
11
|
-
this.overlayLayerView = designerView.overlayLayer;
|
|
12
|
-
}
|
|
13
|
-
_removeAllOverlays() {
|
|
14
|
-
for (let o of this.overlays) {
|
|
15
|
-
try {
|
|
16
|
-
this.overlayLayerView.removeOverlay(o);
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
console.error(err);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
this.overlays = [];
|
|
23
|
-
}
|
|
24
|
-
_drawLineOverlay(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
25
|
-
if (!line) {
|
|
26
|
-
line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
27
|
-
this.overlayLayerView.addOverlay(line, overlayLayer);
|
|
28
|
-
this.overlays.push(line);
|
|
29
|
-
}
|
|
30
|
-
line.setAttribute('x1', x1);
|
|
31
|
-
line.setAttribute('y1', y1);
|
|
32
|
-
line.setAttribute('x2', x2);
|
|
33
|
-
line.setAttribute('y2', y2);
|
|
34
|
-
if (className)
|
|
35
|
-
line.setAttribute('class', className);
|
|
36
|
-
return line;
|
|
37
|
-
}
|
|
38
|
-
_drawCircleOverlay(x, y, radius, className, circle, overlayLayer) {
|
|
39
|
-
if (!circle) {
|
|
40
|
-
circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
41
|
-
this.overlayLayerView.addOverlay(circle, overlayLayer);
|
|
42
|
-
this.overlays.push(circle);
|
|
43
|
-
}
|
|
44
|
-
circle.setAttribute('cx', x);
|
|
45
|
-
circle.setAttribute('cy', y);
|
|
46
|
-
circle.setAttribute('r', radius);
|
|
47
|
-
if (className)
|
|
48
|
-
circle.setAttribute('class', className);
|
|
49
|
-
return circle;
|
|
50
|
-
}
|
|
51
|
-
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
52
|
-
if (!rect) {
|
|
53
|
-
rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
54
|
-
this.overlayLayerView.addOverlay(rect, overlayLayer);
|
|
55
|
-
this.overlays.push(rect);
|
|
56
|
-
}
|
|
57
|
-
rect.setAttribute('x', x);
|
|
58
|
-
rect.setAttribute('y', y);
|
|
59
|
-
rect.setAttribute('width', w);
|
|
60
|
-
rect.setAttribute('height', h);
|
|
61
|
-
if (className)
|
|
62
|
-
rect.setAttribute('class', className);
|
|
63
|
-
return rect;
|
|
64
|
-
}
|
|
65
|
-
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
66
|
-
if (!textEl) {
|
|
67
|
-
textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
68
|
-
this.overlayLayerView.addOverlay(textEl, overlayLayer);
|
|
69
|
-
this.overlays.push(textEl);
|
|
70
|
-
}
|
|
71
|
-
textEl.setAttribute('x', x);
|
|
72
|
-
textEl.setAttribute('y', y);
|
|
73
|
-
textEl.textContent = text;
|
|
74
|
-
if (className)
|
|
75
|
-
textEl.setAttribute('class', className);
|
|
76
|
-
return textEl;
|
|
77
7
|
}
|
|
78
8
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IDesignerCanvas } from "../IDesignerCanvas";
|
|
2
|
+
import { IExtensionManager } from "./IExtensionManger";
|
|
3
|
+
import { OverlayLayerView } from '../overlayLayerView';
|
|
4
|
+
import { OverlayLayer } from './OverlayLayer';
|
|
5
|
+
export declare abstract class AbstractExtensionBase {
|
|
6
|
+
protected overlays: SVGGraphicsElement[];
|
|
7
|
+
protected overlayLayerView: OverlayLayerView;
|
|
8
|
+
protected extensionManager: IExtensionManager;
|
|
9
|
+
protected designerCanvas: IDesignerCanvas;
|
|
10
|
+
constructor(extensionManager: IExtensionManager, designerCanvas: IDesignerCanvas);
|
|
11
|
+
protected _removeAllOverlays(): void;
|
|
12
|
+
protected _drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
13
|
+
protected _drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
14
|
+
protected _drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
15
|
+
protected _drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
16
|
+
}
|