@node-projects/web-component-designer 0.0.231 → 0.0.232
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/PathDataPolyfill.d.ts +1 -1
- package/dist/elements/helper/PathDataPolyfill.js +43 -27
- package/dist/elements/services/placementService/DefaultPlacementService.js +1 -1
- package/dist/elements/widgets/designerView/Snaplines.js +8 -8
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +0 -2
- package/dist/elements/widgets/designerView/designerCanvas.js +0 -4
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.js +11 -6
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.js +1 -2
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.js +1 -2
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.js +1 -2
- package/dist/elements/widgets/designerView/extensions/RotateExtension.js +1 -2
- package/dist/elements/widgets/designerView/overlayLayerView.d.ts +7 -7
- package/dist/elements/widgets/designerView/overlayLayerView.js +17 -14
- package/dist/elements/widgets/designerView/tools/DrawElementTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/DrawEllipsisTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/DrawLineTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/DrawPathTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/DrawRectTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/MagicWandSelectorTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/PointerTool.js +3 -1
- package/dist/elements/widgets/designerView/tools/RectangleSelectorTool.js +1 -1
- package/dist/elements/widgets/designerView/tools/ZoomTool.js +1 -1
- package/package.json +9 -9
|
@@ -43,7 +43,7 @@ export declare type PathDataA = {
|
|
|
43
43
|
export declare type PathData = {
|
|
44
44
|
type: string;
|
|
45
45
|
} & (PathDataM | PathDataL | PathDataH | PathDataV | PathDataZ | PathDataC | PathDataS | PathDataQ | PathDataT | PathDataA)[];
|
|
46
|
-
export declare function straightenLine(p1: IPoint, p2: IPoint): IPoint;
|
|
46
|
+
export declare function straightenLine(p1: IPoint, p2: IPoint, only90Steps?: boolean): IPoint;
|
|
47
47
|
export declare function calculateNormLegth(p1: IPoint, p2: IPoint): number;
|
|
48
48
|
export declare function calculateAlpha(p1: IPoint, p2: IPoint): number;
|
|
49
49
|
export declare function moveSVGPath(path: SVGPathElement, xFactor: number, yFactor: number): string;
|
|
@@ -856,37 +856,53 @@ if (!SVGPathElement.prototype.getPathData || !SVGPathElement.prototype.setPathDa
|
|
|
856
856
|
};
|
|
857
857
|
})();
|
|
858
858
|
}
|
|
859
|
-
export function straightenLine(p1, p2) {
|
|
859
|
+
export function straightenLine(p1, p2, only90Steps = false) {
|
|
860
860
|
let newP;
|
|
861
861
|
let alpha = calculateAlpha(p1, p2);
|
|
862
862
|
let normLength;
|
|
863
|
-
if (
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}
|
|
877
|
-
else if ((alpha >= 157.5 && alpha < 202.5)) { // 180
|
|
878
|
-
newP = { x: p2.x, y: p1.y };
|
|
879
|
-
}
|
|
880
|
-
else if ((alpha >= 202.5 && alpha < 247.5)) { // 225
|
|
881
|
-
normLength = calculateNormLegth(p1, p2);
|
|
882
|
-
newP = { x: p1.x - normLength, y: p1.y + normLength };
|
|
883
|
-
}
|
|
884
|
-
else if ((alpha >= 247.5 && alpha < 292.5)) { // 270
|
|
885
|
-
newP = { x: p1.x, y: p2.y };
|
|
863
|
+
if (only90Steps) {
|
|
864
|
+
if (alpha >= 315 && alpha < 360 || alpha >= 0 && alpha < 45) { // 0
|
|
865
|
+
newP = { x: p2.x, y: p1.y };
|
|
866
|
+
}
|
|
867
|
+
else if (alpha >= 45 && alpha < 135) { // 90
|
|
868
|
+
newP = { x: p1.x, y: p2.y };
|
|
869
|
+
}
|
|
870
|
+
else if (alpha >= 135 && alpha < 225) { // 180
|
|
871
|
+
newP = { x: p2.x, y: p1.y };
|
|
872
|
+
}
|
|
873
|
+
else if (alpha >= 225 && alpha < 315) { // 270
|
|
874
|
+
newP = { x: p1.x, y: p2.y };
|
|
875
|
+
}
|
|
886
876
|
}
|
|
887
|
-
else
|
|
888
|
-
|
|
889
|
-
|
|
877
|
+
else {
|
|
878
|
+
if (alpha >= 337.5 && alpha < 360 || alpha >= 0 && alpha < 22.5) { // 0
|
|
879
|
+
newP = { x: p2.x, y: p1.y };
|
|
880
|
+
}
|
|
881
|
+
else if (alpha >= 22.5 && alpha < 67.5) { // 45
|
|
882
|
+
normLength = calculateNormLegth(p1, p2);
|
|
883
|
+
newP = { x: p1.x + normLength, y: p1.y - normLength };
|
|
884
|
+
}
|
|
885
|
+
else if (alpha >= 67.5 && alpha < 112.5) { // 90
|
|
886
|
+
newP = { x: p1.x, y: p2.y };
|
|
887
|
+
}
|
|
888
|
+
else if (alpha >= 112.5 && alpha < 157.5) { // 135
|
|
889
|
+
normLength = calculateNormLegth(p1, p2);
|
|
890
|
+
newP = { x: p1.x - normLength, y: p1.y - normLength };
|
|
891
|
+
}
|
|
892
|
+
else if (alpha >= 157.5 && alpha < 202.5) { // 180
|
|
893
|
+
newP = { x: p2.x, y: p1.y };
|
|
894
|
+
}
|
|
895
|
+
else if (alpha >= 202.5 && alpha < 247.5) { // 225
|
|
896
|
+
normLength = calculateNormLegth(p1, p2);
|
|
897
|
+
newP = { x: p1.x - normLength, y: p1.y + normLength };
|
|
898
|
+
}
|
|
899
|
+
else if (alpha >= 247.5 && alpha < 292.5) { // 270
|
|
900
|
+
newP = { x: p1.x, y: p2.y };
|
|
901
|
+
}
|
|
902
|
+
else if (alpha >= 292.5 && alpha < 337.5) { // 315
|
|
903
|
+
normLength = calculateNormLegth(p1, p2);
|
|
904
|
+
newP = { x: p1.x + normLength, y: p1.y + normLength };
|
|
905
|
+
}
|
|
890
906
|
}
|
|
891
907
|
return newP;
|
|
892
908
|
}
|
|
@@ -92,7 +92,7 @@ export class DefaultPlacementService {
|
|
|
92
92
|
//maybe a undo actions returns itself or an id so it could be changed?
|
|
93
93
|
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
94
94
|
if (event.shiftKey) {
|
|
95
|
-
track = straightenLine({ x: 0, y: 0 }, track);
|
|
95
|
+
track = straightenLine({ x: 0, y: 0 }, track, true);
|
|
96
96
|
}
|
|
97
97
|
let filteredItems = filterChildPlaceItems(items);
|
|
98
98
|
for (const designItem of filteredItems) {
|
|
@@ -142,7 +142,7 @@ export class Snaplines {
|
|
|
142
142
|
line.setAttribute('y1', (minY));
|
|
143
143
|
line.setAttribute('y2', (maxY));
|
|
144
144
|
line.setAttribute('class', 'svg-snapline');
|
|
145
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
145
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
146
146
|
}
|
|
147
147
|
if (r.x - this._outerRect.left + r.width == position.x || (size && r.x - this._outerRect.left + r.width == position.x + size.width)) {
|
|
148
148
|
let line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
@@ -151,7 +151,7 @@ export class Snaplines {
|
|
|
151
151
|
line.setAttribute('y1', (minY));
|
|
152
152
|
line.setAttribute('y2', (maxY));
|
|
153
153
|
line.setAttribute('class', 'svg-snapline');
|
|
154
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
154
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
155
155
|
}
|
|
156
156
|
if (size && r.x - this._outerRect.left + r.width / 2 == position.x + size.width / 2) {
|
|
157
157
|
let line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
@@ -160,7 +160,7 @@ export class Snaplines {
|
|
|
160
160
|
line.setAttribute('y1', (minY));
|
|
161
161
|
line.setAttribute('y2', (maxY));
|
|
162
162
|
line.setAttribute('class', 'svg-snapline');
|
|
163
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
163
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
164
164
|
}
|
|
165
165
|
let rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
166
166
|
rect.setAttribute('x', (r.x - this._outerRect.x));
|
|
@@ -168,7 +168,7 @@ export class Snaplines {
|
|
|
168
168
|
rect.setAttribute('y', (r.y - this._outerRect.y));
|
|
169
169
|
rect.setAttribute('height', (r.height));
|
|
170
170
|
rect.setAttribute('class', 'svg-snapline');
|
|
171
|
-
this._overlayLayerView.addOverlay(rect, overlayLayer);
|
|
171
|
+
this._overlayLayerView.addOverlay(this.constructor.name, rect, overlayLayer);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (rectsV) {
|
|
@@ -187,7 +187,7 @@ export class Snaplines {
|
|
|
187
187
|
line.setAttribute('y1', (r.y - this._outerRect.y));
|
|
188
188
|
line.setAttribute('y2', (r.y - this._outerRect.y));
|
|
189
189
|
line.setAttribute('class', 'svg-snapline');
|
|
190
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
190
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
191
191
|
}
|
|
192
192
|
if (r.y - this._outerRect.top + r.height == position.y || (size && r.y - this._outerRect.top + r.height == position.y + size.height)) {
|
|
193
193
|
let line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
@@ -196,7 +196,7 @@ export class Snaplines {
|
|
|
196
196
|
line.setAttribute('y1', (r.y - this._outerRect.y + r.height));
|
|
197
197
|
line.setAttribute('y2', (r.y - this._outerRect.y + r.height));
|
|
198
198
|
line.setAttribute('class', 'svg-snapline');
|
|
199
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
199
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
200
200
|
}
|
|
201
201
|
if (size && r.y - this._outerRect.top + r.height / 2 == position.y + size.height / 2) {
|
|
202
202
|
let line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
@@ -205,7 +205,7 @@ export class Snaplines {
|
|
|
205
205
|
line.setAttribute('y1', (r.y - this._outerRect.y + r.height / 2));
|
|
206
206
|
line.setAttribute('y2', (r.y - this._outerRect.y + r.height / 2));
|
|
207
207
|
line.setAttribute('class', 'svg-snapline');
|
|
208
|
-
this._overlayLayerView.addOverlay(line, overlayLayer);
|
|
208
|
+
this._overlayLayerView.addOverlay(this.constructor.name, line, overlayLayer);
|
|
209
209
|
}
|
|
210
210
|
let rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
211
211
|
rect.setAttribute('x', (r.x - this._outerRect.x));
|
|
@@ -213,7 +213,7 @@ export class Snaplines {
|
|
|
213
213
|
rect.setAttribute('y', (r.y - this._outerRect.y));
|
|
214
214
|
rect.setAttribute('height', (r.height));
|
|
215
215
|
rect.setAttribute('class', 'svg-snapline');
|
|
216
|
-
this._overlayLayerView.addOverlay(rect, overlayLayer);
|
|
216
|
+
this._overlayLayerView.addOverlay(this.constructor.name, rect, overlayLayer);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -10,7 +10,6 @@ import { IUiCommandHandler } from '../../../commandHandling/IUiCommandHandler.js
|
|
|
10
10
|
import { IUiCommand } from '../../../commandHandling/IUiCommand.js';
|
|
11
11
|
import { IExtensionManager } from './extensions/IExtensionManger.js';
|
|
12
12
|
import { IPoint } from '../../../interfaces/IPoint.js';
|
|
13
|
-
import { OverlayLayer } from './extensions/OverlayLayer.js';
|
|
14
13
|
import { OverlayLayerView } from './overlayLayerView.js';
|
|
15
14
|
import { IRect } from "../../../interfaces/IRect.js";
|
|
16
15
|
import { ISize } from "../../../interfaces/ISize.js";
|
|
@@ -126,7 +125,6 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
126
125
|
captureActiveTool(tool: ITool): void;
|
|
127
126
|
releaseActiveTool(): void;
|
|
128
127
|
private _fillCalculationrects;
|
|
129
|
-
addOverlay(element: SVGGraphicsElement, overlayLayer?: OverlayLayer): void;
|
|
130
128
|
removeOverlay(element: SVGGraphicsElement): void;
|
|
131
129
|
zoomOntoRectangle(startPoint: IPoint, endPoint: IPoint): void;
|
|
132
130
|
zoomPoint(canvasPoint: IPoint, newZoom: number): void;
|
|
@@ -14,7 +14,6 @@ import { NamedTools } from './tools/NamedTools.js';
|
|
|
14
14
|
import { Screenshot } from '../../helper/Screenshot.js';
|
|
15
15
|
import { dataURItoBlob, exportData, sleep } from '../../helper/Helper.js';
|
|
16
16
|
import { DomHelper } from '@node-projects/base-custom-webcomponent/dist/DomHelper.js';
|
|
17
|
-
import { OverlayLayer } from './extensions/OverlayLayer.js';
|
|
18
17
|
import { OverlayLayerView } from './overlayLayerView.js';
|
|
19
18
|
import { ContextMenu } from '../../helper/contextMenu/ContextMenu.js';
|
|
20
19
|
import { NodeType } from '../../item/NodeType.js';
|
|
@@ -1116,9 +1115,6 @@ class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
1116
1115
|
this.containerBoundingRect = this._canvasContainer.getBoundingClientRect();
|
|
1117
1116
|
this.outerRect = this._outercanvas2.getBoundingClientRect();
|
|
1118
1117
|
}
|
|
1119
|
-
addOverlay(element, overlayLayer = OverlayLayer.Normal) {
|
|
1120
|
-
this.overlayLayer.addOverlay(element, overlayLayer);
|
|
1121
|
-
}
|
|
1122
1118
|
removeOverlay(element) {
|
|
1123
1119
|
this.overlayLayer.removeOverlay(element);
|
|
1124
1120
|
}
|
|
@@ -10,6 +10,7 @@ export declare abstract class AbstractExtensionBase {
|
|
|
10
10
|
protected designerCanvas: IDesignerCanvas;
|
|
11
11
|
constructor(extensionManager: IExtensionManager, designerCanvas: IDesignerCanvas);
|
|
12
12
|
protected _removeAllOverlays(): void;
|
|
13
|
+
protected _addOverlay(element: SVGGraphicsElement, overlayLayer?: OverlayLayer): void;
|
|
13
14
|
protected _drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
14
15
|
protected _drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
15
16
|
protected _drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OverlayLayer } from './OverlayLayer.js';
|
|
1
2
|
export class AbstractExtensionBase {
|
|
2
3
|
overlays = [];
|
|
3
4
|
overlayLayerView;
|
|
@@ -19,36 +20,40 @@ export class AbstractExtensionBase {
|
|
|
19
20
|
}
|
|
20
21
|
this.overlays = [];
|
|
21
22
|
}
|
|
23
|
+
_addOverlay(element, overlayLayer = OverlayLayer.Normal) {
|
|
24
|
+
this.overlayLayerView.addOverlay(this.constructor.name, element, overlayLayer);
|
|
25
|
+
this.overlays.push(element);
|
|
26
|
+
}
|
|
22
27
|
_drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
23
|
-
const newLine = this.overlayLayerView.drawLine(x1, y1, x2, y2, className, line, overlayLayer);
|
|
28
|
+
const newLine = this.overlayLayerView.drawLine(this.constructor.name, x1, y1, x2, y2, className, line, overlayLayer);
|
|
24
29
|
if (!line) {
|
|
25
30
|
this.overlays.push(newLine);
|
|
26
31
|
}
|
|
27
32
|
return newLine;
|
|
28
33
|
}
|
|
29
34
|
_drawCircle(x, y, radius, className, circle, overlayLayer) {
|
|
30
|
-
const newCircle = this.overlayLayerView.drawCircle(x, y, radius, className, circle, overlayLayer);
|
|
35
|
+
const newCircle = this.overlayLayerView.drawCircle(this.constructor.name, x, y, radius, className, circle, overlayLayer);
|
|
31
36
|
if (!circle) {
|
|
32
37
|
this.overlays.push(newCircle);
|
|
33
38
|
}
|
|
34
39
|
return newCircle;
|
|
35
40
|
}
|
|
36
41
|
_drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
37
|
-
const newRect = this.overlayLayerView.drawRect(x, y, w, h, className, rect, overlayLayer);
|
|
42
|
+
const newRect = this.overlayLayerView.drawRect(this.constructor.name, x, y, w, h, className, rect, overlayLayer);
|
|
38
43
|
if (!rect) {
|
|
39
44
|
this.overlays.push(newRect);
|
|
40
45
|
}
|
|
41
46
|
return newRect;
|
|
42
47
|
}
|
|
43
48
|
_drawText(text, x, y, className, textEl, overlayLayer) {
|
|
44
|
-
const newText = this.overlayLayerView.drawText(text, x, y, className, textEl, overlayLayer);
|
|
49
|
+
const newText = this.overlayLayerView.drawText(this.constructor.name, text, x, y, className, textEl, overlayLayer);
|
|
45
50
|
if (!textEl) {
|
|
46
51
|
this.overlays.push(newText);
|
|
47
52
|
}
|
|
48
53
|
return newText;
|
|
49
54
|
}
|
|
50
55
|
_drawTextWithBackground(text, x, y, backgroundColor, className, existingEls, overlayLayer) {
|
|
51
|
-
const newEls = this.overlayLayerView.drawTextWithBackground(text, x, y, backgroundColor, className, existingEls, overlayLayer);
|
|
56
|
+
const newEls = this.overlayLayerView.drawTextWithBackground(this.constructor.name, text, x, y, backgroundColor, className, existingEls, overlayLayer);
|
|
52
57
|
if (!existingEls) {
|
|
53
58
|
this.overlays.push(...newEls);
|
|
54
59
|
}
|
|
@@ -56,7 +61,7 @@ export class AbstractExtensionBase {
|
|
|
56
61
|
}
|
|
57
62
|
_drawTransformedRect(points, className, path, overlayLayer) {
|
|
58
63
|
let data = "M" + points[0].x + " " + points[0].y + " L" + points[1].x + " " + points[1].y + " L" + points[3].x + " " + points[3].y + " L" + points[2].x + " " + points[2].y + "Z";
|
|
59
|
-
const newPath = this.overlayLayerView.drawPath(data, className, path, overlayLayer);
|
|
64
|
+
const newPath = this.overlayLayerView.drawPath(this.constructor.name, data, className, path, overlayLayer);
|
|
60
65
|
if (!path) {
|
|
61
66
|
this.overlays.push(newPath);
|
|
62
67
|
}
|
|
@@ -42,8 +42,7 @@ class EditTextExtension extends AbstractExtension {
|
|
|
42
42
|
foreignObject.setAttribute('width', '96');
|
|
43
43
|
foreignObject.setAttribute('height', '24');
|
|
44
44
|
foreignObject.appendChild(elements);
|
|
45
|
-
this.
|
|
46
|
-
this.overlays.push(foreignObject);
|
|
45
|
+
this._addOverlay(foreignObject, OverlayLayer.Foregorund);
|
|
47
46
|
this.designerCanvas.clickOverlay.style.pointerEvents = 'none';
|
|
48
47
|
this.extendedItem.element.addEventListener('blur', this._blurBound);
|
|
49
48
|
this.extendedItem.element.addEventListener('focus', this._focusBound);
|
package/dist/elements/widgets/designerView/extensions/EditText/EditTextWithStyloExtension.js
CHANGED
|
@@ -35,8 +35,7 @@ class EditTextWithStyloExtension extends AbstractExtension {
|
|
|
35
35
|
foreignObject.setAttribute('width', '100%');
|
|
36
36
|
foreignObject.setAttribute('height', '100%');
|
|
37
37
|
foreignObject.appendChild(elements);
|
|
38
|
-
this.
|
|
39
|
-
this.overlays.push(foreignObject);
|
|
38
|
+
this._addOverlay(foreignObject, OverlayLayer.Foregorund);
|
|
40
39
|
this._drawClickOverlayRects();
|
|
41
40
|
this._rect1.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
42
41
|
this._rect2.addEventListener('pointerdown', (e) => this._clickOutside(e));
|
|
@@ -12,8 +12,7 @@ export class GrayOutExtension extends AbstractExtension {
|
|
|
12
12
|
if (!this._path) {
|
|
13
13
|
this._path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
14
14
|
this._path.setAttribute('class', 'svg-gray-out');
|
|
15
|
-
this.
|
|
16
|
-
this.overlays.push(this._path);
|
|
15
|
+
this._addOverlay(this._path, OverlayLayer.Background);
|
|
17
16
|
}
|
|
18
17
|
let normalizedRect = this.designerCanvas.getNormalizedElementCoordinates(this.extendedItem.element);
|
|
19
18
|
this.drawGrayOut(normalizedRect);
|
|
@@ -41,8 +41,7 @@ export class RotateExtension extends AbstractExtension {
|
|
|
41
41
|
g.addEventListener(EventNames.PointerUp, event => this._pointerActionTypeRotate(event));
|
|
42
42
|
g.setAttribute('class', 'svg-primary-rotate');
|
|
43
43
|
g.setAttribute('transform', 'translate(' + rotateIconPosition.x + ',' + rotateIconPosition.y + ') scale(' + 1 / this.designerCanvas.scaleFactor + ')');
|
|
44
|
-
this.
|
|
45
|
-
this.overlays.push(g);
|
|
44
|
+
this._addOverlay(g);
|
|
46
45
|
return g;
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
@@ -14,16 +14,16 @@ export declare class OverlayLayerView extends BaseCustomWebComponentConstructorA
|
|
|
14
14
|
private _id;
|
|
15
15
|
constructor(serviceContainer: ServiceContainer);
|
|
16
16
|
private _initialize;
|
|
17
|
-
addOverlay(element: SVGGraphicsElement, overlayLayer?: OverlayLayer): void;
|
|
17
|
+
addOverlay(overlaySource: string, element: SVGGraphicsElement, overlayLayer?: OverlayLayer): void;
|
|
18
18
|
removeOverlay(element: SVGElement): void;
|
|
19
19
|
removeAllNodesWithClass(className: string): void;
|
|
20
20
|
removeAllOverlays(): void;
|
|
21
21
|
createPoint(): DOMPointInit;
|
|
22
22
|
elementFromPoint(x: number, y: number): Element;
|
|
23
|
-
drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
24
|
-
drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
25
|
-
drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
26
|
-
drawPath(data: string, className?: string, path?: SVGPathElement, overlayLayer?: OverlayLayer): SVGPathElement;
|
|
27
|
-
drawText(text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
28
|
-
drawTextWithBackground(text: string, x: number, y: number, backgroundColor: string, className?: string, existingEls?: [SVGFilterElement, SVGFEFloodElement, SVGTextElement, SVGTextElement], overlayLayer?: OverlayLayer): [SVGFilterElement, SVGFEFloodElement, SVGTextElement, SVGTextElement];
|
|
23
|
+
drawLine(overlaySource: string, x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
24
|
+
drawCircle(overlaySource: string, x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
25
|
+
drawRect(overlaySource: string, x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
26
|
+
drawPath(overlaySource: string, data: string, className?: string, path?: SVGPathElement, overlayLayer?: OverlayLayer): SVGPathElement;
|
|
27
|
+
drawText(overlaySource: string, text: string, x: number, y: number, className?: string, textEl?: SVGTextElement, overlayLayer?: OverlayLayer): SVGTextElement;
|
|
28
|
+
drawTextWithBackground(overlaySource: string, text: string, x: number, y: number, backgroundColor: string, className?: string, existingEls?: [SVGFilterElement, SVGFEFloodElement, SVGTextElement, SVGTextElement], overlayLayer?: OverlayLayer): [SVGFilterElement, SVGFEFloodElement, SVGTextElement, SVGTextElement];
|
|
29
29
|
}
|
|
@@ -59,7 +59,8 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
59
59
|
}
|
|
60
60
|
this.shadowRoot.adoptedStyleSheets = styles;
|
|
61
61
|
}
|
|
62
|
-
addOverlay(element, overlayLayer = OverlayLayer.Normal) {
|
|
62
|
+
addOverlay(overlaySource, element, overlayLayer = OverlayLayer.Normal) {
|
|
63
|
+
element.setAttribute("overlay-source", overlaySource);
|
|
63
64
|
switch (overlayLayer) {
|
|
64
65
|
case OverlayLayer.Background:
|
|
65
66
|
this._gBackground.appendChild(element);
|
|
@@ -100,10 +101,10 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
100
101
|
//@ts-ignore
|
|
101
102
|
return this.shadowRoot.elementFromPoint(x, y);
|
|
102
103
|
}
|
|
103
|
-
drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
104
|
+
drawLine(overlaySource, x1, y1, x2, y2, className, line, overlayLayer) {
|
|
104
105
|
if (!line) {
|
|
105
106
|
line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
106
|
-
this.addOverlay(line, overlayLayer);
|
|
107
|
+
this.addOverlay(overlaySource, line, overlayLayer);
|
|
107
108
|
}
|
|
108
109
|
line.setAttribute('x1', x1);
|
|
109
110
|
line.setAttribute('y1', y1);
|
|
@@ -113,10 +114,10 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
113
114
|
line.setAttribute('class', className);
|
|
114
115
|
return line;
|
|
115
116
|
}
|
|
116
|
-
drawCircle(x, y, radius, className, circle, overlayLayer) {
|
|
117
|
+
drawCircle(overlaySource, x, y, radius, className, circle, overlayLayer) {
|
|
117
118
|
if (!circle) {
|
|
118
119
|
circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
119
|
-
this.addOverlay(circle, overlayLayer);
|
|
120
|
+
this.addOverlay(overlaySource, circle, overlayLayer);
|
|
120
121
|
}
|
|
121
122
|
circle.setAttribute('cx', x);
|
|
122
123
|
circle.setAttribute('cy', y);
|
|
@@ -125,10 +126,10 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
125
126
|
circle.setAttribute('class', className);
|
|
126
127
|
return circle;
|
|
127
128
|
}
|
|
128
|
-
drawRect(x, y, w, h, className, rect, overlayLayer) {
|
|
129
|
+
drawRect(overlaySource, x, y, w, h, className, rect, overlayLayer) {
|
|
129
130
|
if (!rect) {
|
|
130
131
|
rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
131
|
-
this.addOverlay(rect, overlayLayer);
|
|
132
|
+
this.addOverlay(overlaySource, rect, overlayLayer);
|
|
132
133
|
}
|
|
133
134
|
rect.setAttribute('x', x);
|
|
134
135
|
rect.setAttribute('y', y);
|
|
@@ -138,20 +139,20 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
138
139
|
rect.setAttribute('class', className);
|
|
139
140
|
return rect;
|
|
140
141
|
}
|
|
141
|
-
drawPath(data, className, path, overlayLayer) {
|
|
142
|
+
drawPath(overlaySource, data, className, path, overlayLayer) {
|
|
142
143
|
if (!path) {
|
|
143
144
|
path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
144
|
-
this.addOverlay(path, overlayLayer);
|
|
145
|
+
this.addOverlay(overlaySource, path, overlayLayer);
|
|
145
146
|
}
|
|
146
147
|
path.setAttribute('d', data);
|
|
147
148
|
if (className)
|
|
148
149
|
path.setAttribute('class', className);
|
|
149
150
|
return path;
|
|
150
151
|
}
|
|
151
|
-
drawText(text, x, y, className, textEl, overlayLayer) {
|
|
152
|
+
drawText(overlaySource, text, x, y, className, textEl, overlayLayer) {
|
|
152
153
|
if (!textEl) {
|
|
153
154
|
textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
154
|
-
this.addOverlay(textEl, overlayLayer);
|
|
155
|
+
this.addOverlay(overlaySource, textEl, overlayLayer);
|
|
155
156
|
}
|
|
156
157
|
textEl.setAttribute('x', x);
|
|
157
158
|
textEl.setAttribute('y', y);
|
|
@@ -160,7 +161,7 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
160
161
|
textEl.setAttribute('class', className);
|
|
161
162
|
return textEl;
|
|
162
163
|
}
|
|
163
|
-
drawTextWithBackground(text, x, y, backgroundColor, className, existingEls, overlayLayer) {
|
|
164
|
+
drawTextWithBackground(overlaySource, text, x, y, backgroundColor, className, existingEls, overlayLayer) {
|
|
164
165
|
if (!existingEls) {
|
|
165
166
|
let filter = document.createElementNS("http://www.w3.org/2000/svg", "filter");
|
|
166
167
|
filter.setAttribute("x", "0");
|
|
@@ -179,8 +180,10 @@ class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
179
180
|
let textEl1 = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
180
181
|
textEl1.setAttribute("filter", "url(#solid_" + this._id + ")");
|
|
181
182
|
let textEl2 = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
182
|
-
this.addOverlay(textEl1, overlayLayer);
|
|
183
|
-
this.addOverlay(textEl2, overlayLayer);
|
|
183
|
+
this.addOverlay(overlaySource, textEl1, overlayLayer);
|
|
184
|
+
this.addOverlay(overlaySource, textEl2, overlayLayer);
|
|
185
|
+
filter.setAttribute("overlay-source", overlaySource);
|
|
186
|
+
flood.setAttribute("overlay-source", overlaySource);
|
|
184
187
|
existingEls = [filter, flood, textEl1, textEl2];
|
|
185
188
|
}
|
|
186
189
|
existingEls[2].setAttribute('x', x);
|
|
@@ -51,7 +51,7 @@ export class DrawElementTool {
|
|
|
51
51
|
if (!this._rect) {
|
|
52
52
|
designerCanvas.rootDesignItem.element.appendChild(this._createdItem.element);
|
|
53
53
|
this._rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
54
|
-
designerCanvas.overlayLayer.addOverlay(this._rect, OverlayLayer.Foregorund);
|
|
54
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._rect, OverlayLayer.Foregorund);
|
|
55
55
|
this._rect.setAttribute('class', 'svg-draw-new-element');
|
|
56
56
|
this._rect.setAttribute('x', (this._startPosition.x - designerCanvas.containerBoundingRect.x));
|
|
57
57
|
this._rect.setAttribute('y', (this._startPosition.y - designerCanvas.containerBoundingRect.y));
|
|
@@ -32,7 +32,7 @@ export class DrawEllipsisTool {
|
|
|
32
32
|
this._path.setAttribute("cy", currentPoint.y.toString());
|
|
33
33
|
this._path.setAttribute("rx", "0");
|
|
34
34
|
this._path.setAttribute("ry", "0");
|
|
35
|
-
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
35
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._path, OverlayLayer.Foregorund);
|
|
36
36
|
break;
|
|
37
37
|
case EventNames.PointerMove:
|
|
38
38
|
if (this._path) {
|
|
@@ -31,7 +31,7 @@ export class DrawLineTool {
|
|
|
31
31
|
this._path.setAttribute("y1", currentPoint.y.toString());
|
|
32
32
|
this._path.setAttribute("x2", currentPoint.x.toString());
|
|
33
33
|
this._path.setAttribute("y2", currentPoint.y.toString());
|
|
34
|
-
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
34
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._path, OverlayLayer.Foregorund);
|
|
35
35
|
break;
|
|
36
36
|
case EventNames.PointerMove:
|
|
37
37
|
if (this._path) {
|
|
@@ -35,7 +35,7 @@ export class DrawPathTool {
|
|
|
35
35
|
this._path.setAttribute("stroke", designerCanvas.serviceContainer.globalContext.strokeColor);
|
|
36
36
|
this._path.setAttribute("fill", designerCanvas.serviceContainer.globalContext.fillBrush);
|
|
37
37
|
this._path.setAttribute("stroke-width", designerCanvas.serviceContainer.globalContext.strokeThickness);
|
|
38
|
-
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
38
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._path, OverlayLayer.Foregorund);
|
|
39
39
|
this._startPoint = currentPoint;
|
|
40
40
|
}
|
|
41
41
|
if (this._lastPoint != null && this._lastPoint.x === currentPoint.x && this._lastPoint.y === currentPoint.y && !this._samePoint) {
|
|
@@ -35,7 +35,7 @@ export class DrawRectTool {
|
|
|
35
35
|
this._path.setAttribute("y", currentPoint.y.toString());
|
|
36
36
|
this._path.setAttribute("width", "0");
|
|
37
37
|
this._path.setAttribute("height", "0");
|
|
38
|
-
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
38
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._path, OverlayLayer.Foregorund);
|
|
39
39
|
break;
|
|
40
40
|
case EventNames.PointerMove:
|
|
41
41
|
if (this._path) {
|
|
@@ -17,7 +17,7 @@ export class MagicWandSelectorTool {
|
|
|
17
17
|
this._path.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
18
18
|
this._pathD = "M" + currentPoint.x + " " + currentPoint.y;
|
|
19
19
|
this._path.setAttribute("D", this._pathD);
|
|
20
|
-
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
20
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._path, OverlayLayer.Foregorund);
|
|
21
21
|
break;
|
|
22
22
|
case EventNames.PointerMove:
|
|
23
23
|
if (this._path) {
|
|
@@ -315,8 +315,10 @@ export class PointerTool {
|
|
|
315
315
|
containerService.finishPlace(event, designerCanvas, this._actionStartedDesignItem.parent, this._initialPoint, this._initialOffset, cp, designerCanvas.instanceServiceContainer.selectionService.selectedElements);
|
|
316
316
|
this._changeGroup.commit();
|
|
317
317
|
this._changeGroup = null;
|
|
318
|
+
let elements = designerCanvas.elementsFromPoint(event.x, event.y);
|
|
318
319
|
for (const item of this._actionStartedDesignItems) {
|
|
319
|
-
|
|
320
|
+
if (elements.includes(item.element))
|
|
321
|
+
designerCanvas.extensionManager.applyExtension(item, ExtensionType.MouseOver, event);
|
|
320
322
|
designerCanvas.extensionManager.removeExtension(item, ExtensionType.Placement);
|
|
321
323
|
}
|
|
322
324
|
}
|
|
@@ -23,7 +23,7 @@ export class RectangleSelectorTool {
|
|
|
23
23
|
this._rect.setAttribute('height', 0);
|
|
24
24
|
this._rect.style.strokeWidth = '' + (1 / designerCanvas.scaleFactor);
|
|
25
25
|
this._rect.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
26
|
-
designerCanvas.overlayLayer.addOverlay(this._rect, OverlayLayer.Foregorund);
|
|
26
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._rect, OverlayLayer.Foregorund);
|
|
27
27
|
break;
|
|
28
28
|
case EventNames.PointerMove:
|
|
29
29
|
if (this._initialPoint) {
|
|
@@ -23,7 +23,7 @@ export class ZoomTool {
|
|
|
23
23
|
this._rect.setAttribute('height', 0);
|
|
24
24
|
this._rect.style.strokeWidth = '' + (1 / designerCanvas.scaleFactor);
|
|
25
25
|
this._rect.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
26
|
-
designerCanvas.overlayLayer.addOverlay(this._rect, OverlayLayer.Foregorund);
|
|
26
|
+
designerCanvas.overlayLayer.addOverlay(this.constructor.name, this._rect, OverlayLayer.Foregorund);
|
|
27
27
|
break;
|
|
28
28
|
case EventNames.PointerMove:
|
|
29
29
|
if (this._startPoint) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "A UI designer for Polymer apps",
|
|
3
3
|
"name": "@node-projects/web-component-designer",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.232",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -20,24 +20,24 @@
|
|
|
20
20
|
"@adobe/css-tools": "4.3.0-beta.1",
|
|
21
21
|
"@node-projects/lean-he-esm": "^3.3.0",
|
|
22
22
|
"@node-projects/node-html-parser-esm": "^6.1.5",
|
|
23
|
-
"@papyrs/stylo": "^0.0.
|
|
23
|
+
"@papyrs/stylo": "^0.0.45",
|
|
24
24
|
"@types/codemirror": "^5.60.7",
|
|
25
25
|
"@types/css-tree": "^2.3.1",
|
|
26
26
|
"@types/jquery": "^3.5.16",
|
|
27
27
|
"@types/jquery.fancytree": "0.0.7",
|
|
28
|
-
"@types/node": "^
|
|
29
|
-
"ace-builds": "^1.
|
|
28
|
+
"@types/node": "^20.2.1",
|
|
29
|
+
"ace-builds": "^1.21.1",
|
|
30
30
|
"codemirror": "^6.0.1",
|
|
31
31
|
"css-tree": "^2.3.1",
|
|
32
32
|
"esprima-next": "^5.8.4",
|
|
33
33
|
"html2canvas": "*",
|
|
34
34
|
"jest": "^29.5.0",
|
|
35
|
-
"jquery": "^3.
|
|
35
|
+
"jquery": "^3.7.0",
|
|
36
36
|
"jquery.fancytree": "^2.38.3",
|
|
37
|
-
"mdn-data": "^2.0.
|
|
38
|
-
"monaco-editor": "^0.
|
|
39
|
-
"ts-jest": "^29.0
|
|
40
|
-
"typescript": "^5.0.
|
|
37
|
+
"mdn-data": "^2.0.32",
|
|
38
|
+
"monaco-editor": "^0.38.0",
|
|
39
|
+
"ts-jest": "^29.1.0",
|
|
40
|
+
"typescript": "^5.0.4",
|
|
41
41
|
"typescript-lit-html-plugin": "^0.9.0"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|