@node-projects/web-component-designer 0.0.118 → 0.0.119
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/widgets/designerView/designerCanvas.js +1 -1
- package/dist/elements/widgets/designerView/extensions/PositionExtension.d.ts +4 -0
- package/dist/elements/widgets/designerView/extensions/PositionExtension.js +26 -27
- package/dist/elements/widgets/designerView/extensions/PositionExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/PositionExtensionProvider.js +4 -0
- package/dist/elements/widgets/designerView/extensions/contextMenu/RotateLeftAndRightContextMenu.js +1 -1
- package/dist/elements/widgets/designerView/extensions/contextMenu/ZMoveContextMenu.js +1 -1
- package/dist/elements/widgets/designerView/tools/MagicWandSelectorTool.js +2 -0
- package/dist/elements/widgets/designerView/tools/PointerTool.js +2 -1
- package/dist/elements/widgets/designerView/tools/RectangleSelectorTool.js +2 -0
- package/dist/elements/widgets/designerView/tools/ZoomTool.js +2 -0
- package/package.json +1 -1
|
@@ -406,7 +406,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
406
406
|
this.instanceServiceContainer.undoService.clear();
|
|
407
407
|
this.overlayLayer.removeAllOverlays();
|
|
408
408
|
DomHelper.removeAllChildnodes(this.overlayLayer);
|
|
409
|
-
for (let i of this.rootDesignItem.children())
|
|
409
|
+
for (let i of [...this.rootDesignItem.children()])
|
|
410
410
|
this.rootDesignItem._removeChildInternal(i);
|
|
411
411
|
this.addDesignItems(designItems);
|
|
412
412
|
this.instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'parsed' });
|
|
@@ -7,6 +7,10 @@ export declare class PositionExtension extends AbstractExtension {
|
|
|
7
7
|
private _line2;
|
|
8
8
|
private _line3;
|
|
9
9
|
private _line4;
|
|
10
|
+
private _rectX;
|
|
11
|
+
private _textX;
|
|
12
|
+
private _rectY;
|
|
13
|
+
private _textY;
|
|
10
14
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
11
15
|
extend(): void;
|
|
12
16
|
refresh(): void;
|
|
@@ -4,6 +4,10 @@ export class PositionExtension extends AbstractExtension {
|
|
|
4
4
|
_line2;
|
|
5
5
|
_line3;
|
|
6
6
|
_line4;
|
|
7
|
+
_rectX;
|
|
8
|
+
_textX;
|
|
9
|
+
_rectY;
|
|
10
|
+
_textY;
|
|
7
11
|
constructor(extensionManager, designerView, extendedItem) {
|
|
8
12
|
super(extensionManager, designerView, extendedItem);
|
|
9
13
|
}
|
|
@@ -11,33 +15,28 @@ export class PositionExtension extends AbstractExtension {
|
|
|
11
15
|
this.refresh();
|
|
12
16
|
}
|
|
13
17
|
refresh() {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
this._line1 = this._drawLine((xOffset / this.designerCanvas.scaleFactor - left - tx), (yOffset + itemRect.height / 2) / this.designerCanvas.scaleFactor, xOffset / this.designerCanvas.scaleFactor, (yOffset + itemRect.height / 2) / this.designerCanvas.scaleFactor, 'svg-position', this._line1);
|
|
38
|
-
this._line2 = this._drawLine((xOffset + itemRect.width / 2) / this.designerCanvas.scaleFactor, (yOffset / this.designerCanvas.scaleFactor) - top - ty, (xOffset + itemRect.width / 2) / this.designerCanvas.scaleFactor, yOffset / this.designerCanvas.scaleFactor, 'svg-position', this._line2);
|
|
39
|
-
this._line3 = this._drawLine((xOffset + itemRect.width) / this.designerCanvas.scaleFactor, (yOffset + itemRect.height / 2) / this.designerCanvas.scaleFactor, (xOffset + itemRect.width + right + -1 * tx) / this.designerCanvas.scaleFactor, (yOffset + itemRect.height / 2) / this.designerCanvas.scaleFactor, 'svg-position', this._line3);
|
|
40
|
-
this._line4 = this._drawLine((xOffset + itemRect.width / 2) / this.designerCanvas.scaleFactor, (yOffset + itemRect.height) / this.designerCanvas.scaleFactor, (xOffset + itemRect.width / 2) / this.designerCanvas.scaleFactor, (yOffset + itemRect.height + bottom + -1 * ty) / this.designerCanvas.scaleFactor, 'svg-position', this._line4);
|
|
18
|
+
const itemRect = this.designerCanvas.getNormalizedElementCoordinates(this.extendedItem.element);
|
|
19
|
+
const itemParentRect = this.designerCanvas.getNormalizedElementCoordinates(this.extendedItem.element.parentElement);
|
|
20
|
+
this._line1 = this._drawLine(itemParentRect.x, itemRect.y + itemRect.height / 2, itemRect.x, itemRect.y + itemRect.height / 2, 'svg-position', this._line1);
|
|
21
|
+
this._line2 = this._drawLine(itemParentRect.x + itemParentRect.width, itemRect.y + itemRect.height / 2, itemRect.x + itemRect.width, itemRect.y + itemRect.height / 2, 'svg-position', this._line2);
|
|
22
|
+
this._line3 = this._drawLine(itemRect.x + itemRect.width / 2, itemParentRect.y, itemRect.x + itemRect.width / 2, itemRect.y, 'svg-position', this._line3);
|
|
23
|
+
this._line4 = this._drawLine(itemRect.x + itemRect.width / 2, itemParentRect.y + itemParentRect.height, itemRect.x + itemRect.width / 2, itemRect.y + itemRect.height, 'svg-position', this._line4);
|
|
24
|
+
this._line1.style.strokeWidth = '' + (1 / this.designerCanvas.scaleFactor);
|
|
25
|
+
this._line2.style.strokeWidth = '' + (1 / this.designerCanvas.scaleFactor);
|
|
26
|
+
this._line3.style.strokeWidth = '' + (1 / this.designerCanvas.scaleFactor);
|
|
27
|
+
this._line4.style.strokeWidth = '' + (1 / this.designerCanvas.scaleFactor);
|
|
28
|
+
this._line1.style.strokeDasharray = '' + (4 / this.designerCanvas.scaleFactor);
|
|
29
|
+
this._line2.style.strokeDasharray = '' + (4 / this.designerCanvas.scaleFactor);
|
|
30
|
+
this._line3.style.strokeDasharray = '' + (4 / this.designerCanvas.scaleFactor);
|
|
31
|
+
this._line4.style.strokeDasharray = '' + (4 / this.designerCanvas.scaleFactor);
|
|
32
|
+
let x = Math.round(itemRect.x - itemParentRect.x);
|
|
33
|
+
let y = Math.round(itemRect.y - itemParentRect.y);
|
|
34
|
+
this._rectX = this._drawRect(itemParentRect.x + x / 2 - 10, itemRect.y + itemRect.height / 2 - 8, 20, 16, 'svg-position-text-rect', this._rectX);
|
|
35
|
+
this._textX = this._drawText('' + x, itemParentRect.x + x / 2 - 9, itemRect.y + itemRect.height / 2 + 4, null, this._textX);
|
|
36
|
+
this._textX.style.fontSize = '12px';
|
|
37
|
+
this._rectY = this._drawRect(itemRect.x + itemRect.width / 2 - 10, itemParentRect.y + y / 2 - 8, 20, 16, 'svg-position-text-rect', this._rectY);
|
|
38
|
+
this._textY = this._drawText('' + y, itemRect.x + itemRect.width / 2 - 10, itemParentRect.y + y / 2 + 4, null, this._textY);
|
|
39
|
+
this._textY.style.fontSize = '12px';
|
|
41
40
|
}
|
|
42
41
|
dispose() {
|
|
43
42
|
this._removeAllOverlays();
|
|
@@ -6,4 +6,5 @@ import { IExtensionManager } from "./IExtensionManger";
|
|
|
6
6
|
export declare class PositionExtensionProvider implements IDesignerExtensionProvider {
|
|
7
7
|
shouldExtend(extensionManager: IExtensionManager, designerView: IDesignerCanvas, designItem: IDesignItem): boolean;
|
|
8
8
|
getExtension(extensionManager: IExtensionManager, designerView: IDesignerCanvas, designItem: IDesignItem): IDesignerExtension;
|
|
9
|
+
readonly style: CSSStyleSheet;
|
|
9
10
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PositionExtension } from "./PositionExtension";
|
|
2
|
+
import { css } from "@node-projects/base-custom-webcomponent";
|
|
2
3
|
export class PositionExtensionProvider {
|
|
3
4
|
shouldExtend(extensionManager, designerView, designItem) {
|
|
4
5
|
const cs = getComputedStyle(designItem.element);
|
|
@@ -9,4 +10,7 @@ export class PositionExtensionProvider {
|
|
|
9
10
|
getExtension(extensionManager, designerView, designItem) {
|
|
10
11
|
return new PositionExtension(extensionManager, designerView, designItem);
|
|
11
12
|
}
|
|
13
|
+
style = css `
|
|
14
|
+
.svg-position-text-rect { fill: white; }
|
|
15
|
+
`;
|
|
12
16
|
}
|
package/dist/elements/widgets/designerView/extensions/contextMenu/RotateLeftAndRightContextMenu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandType } from "../../../../../commandHandling/CommandType";
|
|
2
2
|
export class RotateLeftAndRight {
|
|
3
3
|
shouldProvideContextmenu(event, designerView, designItem, initiator) {
|
|
4
|
-
return
|
|
4
|
+
return !designItem.isRootItem;
|
|
5
5
|
}
|
|
6
6
|
provideContextMenuItems(event, designerView, designItem) {
|
|
7
7
|
return [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandType } from "../../../../../commandHandling/CommandType";
|
|
2
2
|
export class ZMoveContextMenu {
|
|
3
3
|
shouldProvideContextmenu(event, designerView, designItem, initiator) {
|
|
4
|
-
return
|
|
4
|
+
return !designItem.isRootItem;
|
|
5
5
|
}
|
|
6
6
|
provideContextMenuItems(event, designerView, designItem) {
|
|
7
7
|
return [
|
|
@@ -13,6 +13,8 @@ export class MagicWandSelectorTool {
|
|
|
13
13
|
designerCanvas.captureActiveTool(this);
|
|
14
14
|
this._path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
15
15
|
this._path.setAttribute('class', 'svg-selector');
|
|
16
|
+
this._path.style.strokeWidth = '' + (1 / designerCanvas.scaleFactor);
|
|
17
|
+
this._path.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
16
18
|
this._pathD = "M" + currentPoint.x + " " + currentPoint.y;
|
|
17
19
|
this._path.setAttribute("D", this._pathD);
|
|
18
20
|
designerCanvas.overlayLayer.addOverlay(this._path, OverlayLayer.Foregorund);
|
|
@@ -31,7 +31,8 @@ export class PointerTool {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
let newEl = designerCanvas.serviceContainer.elementAtPointService.getElementAtPoint(designerCanvas, { x: event.x, y: event.y });
|
|
35
|
+
const designItem = DesignItem.GetOrCreateDesignItem(newEl, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer);
|
|
35
36
|
if (!designerCanvas.instanceServiceContainer.selectionService.isSelected(designItem)) {
|
|
36
37
|
designerCanvas.instanceServiceContainer.selectionService.setSelectedElements([designItem]);
|
|
37
38
|
}
|
|
@@ -21,6 +21,8 @@ export class RectangleSelectorTool {
|
|
|
21
21
|
this._rect.setAttribute('y', (this._initialPoint.y * designerCanvas.scaleFactor));
|
|
22
22
|
this._rect.setAttribute('width', 0);
|
|
23
23
|
this._rect.setAttribute('height', 0);
|
|
24
|
+
this._rect.style.strokeWidth = '' + (1 / designerCanvas.scaleFactor);
|
|
25
|
+
this._rect.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
24
26
|
designerCanvas.overlayLayer.addOverlay(this._rect, OverlayLayer.Foregorund);
|
|
25
27
|
break;
|
|
26
28
|
case EventNames.PointerMove:
|
|
@@ -20,6 +20,8 @@ export class ZoomTool {
|
|
|
20
20
|
this._rect.setAttribute('y', (this._startPoint.y * designerCanvas.zoomFactor));
|
|
21
21
|
this._rect.setAttribute('width', 0);
|
|
22
22
|
this._rect.setAttribute('height', 0);
|
|
23
|
+
this._rect.style.strokeWidth = '' + (1 / designerCanvas.scaleFactor);
|
|
24
|
+
this._rect.style.strokeDasharray = '' + (2 / designerCanvas.scaleFactor);
|
|
23
25
|
designerCanvas.overlayLayer.addOverlay(this._rect, OverlayLayer.Foregorund);
|
|
24
26
|
break;
|
|
25
27
|
case EventNames.PointerMove:
|