@node-projects/web-component-designer 0.0.33 → 0.0.34
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.
|
@@ -184,7 +184,6 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
184
184
|
this.instanceServiceContainer.selectionService.setSelectedElements(null);
|
|
185
185
|
}
|
|
186
186
|
handleMoveCommand(command) {
|
|
187
|
-
//TODO: -> via undo redo service
|
|
188
187
|
let sel = this.instanceServiceContainer.selectionService.primarySelection;
|
|
189
188
|
if (command == CommandType.moveBackward)
|
|
190
189
|
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.previousElementSibling), 'beforebegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
@@ -223,10 +222,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
223
222
|
this._outercanvas2.addEventListener(EventNames.PointerDown, this._pointerEventHandlerBound);
|
|
224
223
|
this._outercanvas2.addEventListener(EventNames.PointerMove, this._pointerEventHandlerBound);
|
|
225
224
|
this._outercanvas2.addEventListener(EventNames.PointerUp, this._pointerEventHandlerBound);
|
|
226
|
-
this.
|
|
227
|
-
this.
|
|
228
|
-
this.
|
|
229
|
-
this.
|
|
225
|
+
this._outercanvas2.addEventListener(EventNames.DragEnter, event => this._onDragEnter(event));
|
|
226
|
+
this._outercanvas2.addEventListener(EventNames.DragLeave, event => this._onDragLeave(event));
|
|
227
|
+
this._outercanvas2.addEventListener(EventNames.DragOver, event => this._onDragOver(event));
|
|
228
|
+
this._outercanvas2.addEventListener(EventNames.Drop, event => this._onDrop(event));
|
|
230
229
|
this._canvas.addEventListener(EventNames.KeyDown, this._onKeyDownBound, true);
|
|
231
230
|
this._canvas.addEventListener(EventNames.KeyUp, this._onKeyUpBound, true);
|
|
232
231
|
this._canvas.addEventListener(EventNames.DblClick, this._onDblClickBound, true);
|
|
@@ -304,9 +303,9 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
304
303
|
let di = await this.serviceContainer.forSomeServicesTillResult("instanceService", (service) => service.getElement(elementDefinition, this.serviceContainer, this.instanceServiceContainer));
|
|
305
304
|
let grp = di.openGroup("Insert");
|
|
306
305
|
di.setStyle('position', 'absolute');
|
|
307
|
-
const
|
|
308
|
-
di.setStyle('top', ((event.offsetY - (this.containerBoundingRect.y * this._zoomFactor)) / this._zoomFactor +
|
|
309
|
-
di.setStyle('left', ((event.offsetX - (this.containerBoundingRect.x * this._zoomFactor)) / this._zoomFactor +
|
|
306
|
+
const canvasRect = this._canvasContainer.getBoundingClientRect();
|
|
307
|
+
di.setStyle('top', ((event.offsetY + event.target.scrollTop - (this.containerBoundingRect.y * this._zoomFactor)) / this._zoomFactor + canvasRect.top) + 'px');
|
|
308
|
+
di.setStyle('left', ((event.offsetX + event.target.scrollLeft - (this.containerBoundingRect.x * this._zoomFactor)) / this._zoomFactor + canvasRect.left) + 'px');
|
|
310
309
|
this.instanceServiceContainer.undoService.execute(new InsertAction(this.rootDesignItem, this.rootDesignItem.childCount, di));
|
|
311
310
|
grp.commit();
|
|
312
311
|
requestAnimationFrame(() => this.instanceServiceContainer.selectionService.setSelectedElements([di]));
|
|
@@ -415,8 +414,8 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
415
414
|
offsetInControlX: (startPoint ? startPoint.offsetInControlX : event.x - targetRect.x),
|
|
416
415
|
offsetInControlY: (startPoint ? startPoint.offsetInControlY : event.y - targetRect.y),
|
|
417
416
|
zoom: this._zoomFactor,
|
|
418
|
-
normalizedX: ((event.offsetX - (this.containerBoundingRect.x * this._zoomFactor)) / this._zoomFactor + targetRect.left),
|
|
419
|
-
normalizedY: ((event.offsetY - (this.containerBoundingRect.y * this._zoomFactor)) / this._zoomFactor + targetRect.top)
|
|
417
|
+
normalizedX: ((event.offsetX + event.target.scrollLeft - (this.containerBoundingRect.x * this._zoomFactor)) / this._zoomFactor + targetRect.left),
|
|
418
|
+
normalizedY: ((event.offsetY + event.target.scrollTop - (this.containerBoundingRect.y * this._zoomFactor)) / this._zoomFactor + targetRect.top)
|
|
420
419
|
};
|
|
421
420
|
}
|
|
422
421
|
//todo remove, is in base custom webcomp domhelper
|