@node-projects/web-component-designer 0.0.130 → 0.0.131
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/IDesignerCanvas.d.ts +4 -0
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +4 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +11 -0
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +4 -4
- package/package.json +1 -1
|
@@ -33,6 +33,10 @@ export interface IDesignerCanvas extends IPlacementView, IUiCommandHandler {
|
|
|
33
33
|
getNormalizedEventCoordinates(event: MouseEvent): IPoint;
|
|
34
34
|
getViewportCoordinates(event: MouseEvent): IPoint;
|
|
35
35
|
getNormalizedElementCoordinates(element: Element): IRect;
|
|
36
|
+
getNormalizedElementCoordinatesAndRealSizes(element: Element): IRect & {
|
|
37
|
+
realWidth: number;
|
|
38
|
+
realHeight: number;
|
|
39
|
+
};
|
|
36
40
|
captureActiveTool(tool: ITool): any;
|
|
37
41
|
releaseActiveTool(): any;
|
|
38
42
|
getDesignSurfaceDimensions(): ISize;
|
|
@@ -100,6 +100,10 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
100
100
|
*/
|
|
101
101
|
getViewportCoordinates(event: MouseEvent): IPoint;
|
|
102
102
|
getNormalizedElementCoordinates(element: Element): IRect;
|
|
103
|
+
getNormalizedElementCoordinatesAndRealSizes(element: Element): IRect & {
|
|
104
|
+
realWidth: number;
|
|
105
|
+
realHeight: number;
|
|
106
|
+
};
|
|
103
107
|
getNormalizedOffsetInElement(event: MouseEvent, element: Element): IPoint;
|
|
104
108
|
elementFromPoint(x: number, y: number): Element;
|
|
105
109
|
elementsFromPoint(x: number, y: number): Element[];
|
|
@@ -736,6 +736,17 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
736
736
|
const targetRect = element.getBoundingClientRect();
|
|
737
737
|
return { x: (targetRect.x - this.containerBoundingRect.x) / this.scaleFactor, y: (targetRect.y - this.containerBoundingRect.y) / this.scaleFactor, width: targetRect.width / this.scaleFactor, height: targetRect.height / this.scaleFactor };
|
|
738
738
|
}
|
|
739
|
+
getNormalizedElementCoordinatesAndRealSizes(element) {
|
|
740
|
+
let ret = this.getNormalizedElementCoordinates(element);
|
|
741
|
+
const st = getComputedStyle(element);
|
|
742
|
+
let realWidth = ret.width;
|
|
743
|
+
let realHeight = ret.height;
|
|
744
|
+
if (st.boxSizing != 'border-box') {
|
|
745
|
+
realWidth = realWidth - (parseFloat(st.borderLeft) + parseFloat(st.paddingLeft) + parseFloat(st.paddingRight) + parseFloat(st.borderRight));
|
|
746
|
+
realHeight = realHeight - (parseFloat(st.borderTop) + parseFloat(st.paddingTop) + parseFloat(st.paddingBottom) + parseFloat(st.borderBottom));
|
|
747
|
+
}
|
|
748
|
+
return { ...ret, realWidth, realHeight };
|
|
749
|
+
}
|
|
739
750
|
getNormalizedOffsetInElement(event, element) {
|
|
740
751
|
const normEvt = this.getNormalizedEventCoordinates(event);
|
|
741
752
|
const normEl = this.getNormalizedElementCoordinates(element);
|
|
@@ -72,12 +72,12 @@ export class ResizeExtension extends AbstractExtension {
|
|
|
72
72
|
this._initialPoint = currentPoint;
|
|
73
73
|
this._initialSizes = [];
|
|
74
74
|
this._actionModeStarted = actionMode;
|
|
75
|
-
let rect = this.extendedItem.element
|
|
76
|
-
this._initialSizes.push({ width: rect.
|
|
75
|
+
let rect = this.designerCanvas.getNormalizedElementCoordinatesAndRealSizes(this.extendedItem.element);
|
|
76
|
+
this._initialSizes.push({ width: rect.realWidth, height: rect.realHeight });
|
|
77
77
|
if (this.resizeAllSelected) {
|
|
78
78
|
for (const designItem of this.designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
79
|
-
rect = designItem.element
|
|
80
|
-
this._initialSizes.push({ width: rect.
|
|
79
|
+
rect = this.designerCanvas.getNormalizedElementCoordinatesAndRealSizes(designItem.element);
|
|
80
|
+
this._initialSizes.push({ width: rect.realWidth, height: rect.realHeight });
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
if (this.designerCanvas.alignOnSnap)
|