diff --git a/src/dd-draggable.ts b/src/dd-draggable.ts index e08bdf582..81107f6c0 100644 --- a/src/dd-draggable.ts +++ b/src/dd-draggable.ts @@ -301,8 +301,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt this.dragOffset = this._getDragOffset(this.lastDrag, n.el, this.helperContainment); this.helper.style.width = this.dragOffset.width + 'px'; this.helper.style.height = this.dragOffset.height + 'px'; - function swap(o: unknown, a: string, b: string): void { const tmp = o[a]; o[a] = o[b]; o[b] = tmp; } - swap(n._orig, 'w', 'h'); + Utils.swap(n._orig, 'w', 'h'); delete n._rect; this._mouseMove(this.lastDrag); } diff --git a/src/utils.ts b/src/utils.ts index 6497edbc3..a26238f52 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -589,6 +589,9 @@ export class Utils { } } + /** swap the given object 2 field values */ + public static swap(o: unknown, a: string, b: string): void { const tmp = o[a]; o[a] = o[b]; o[b] = tmp; } + /** returns true if event is inside the given element rectangle */ // Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead // this.el.contains(event.relatedTarget as HTMLElement)