Skip to content

Commit cf60875

Browse files
authored
Merge pull request #2690 from adumesny/master
build fix. added Utils.swap()
2 parents 1f5dfa6 + c7b914b commit cf60875

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/dd-draggable.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
301301
this.dragOffset = this._getDragOffset(this.lastDrag, n.el, this.helperContainment);
302302
this.helper.style.width = this.dragOffset.width + 'px';
303303
this.helper.style.height = this.dragOffset.height + 'px';
304-
function swap(o: unknown, a: string, b: string): void { const tmp = o[a]; o[a] = o[b]; o[b] = tmp; }
305-
swap(n._orig, 'w', 'h');
304+
Utils.swap(n._orig, 'w', 'h');
306305
delete n._rect;
307306
this._mouseMove(this.lastDrag);
308307
}

src/utils.ts

+3
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ export class Utils {
589589
}
590590
}
591591

592+
/** swap the given object 2 field values */
593+
public static swap(o: unknown, a: string, b: string): void { const tmp = o[a]; o[a] = o[b]; o[b] = tmp; }
594+
592595
/** returns true if event is inside the given element rectangle */
593596
// Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead
594597
// this.el.contains(event.relatedTarget as HTMLElement)

0 commit comments

Comments
 (0)