Skip to content

Commit

Permalink
Merge pull request #2690 from adumesny/master
Browse files Browse the repository at this point in the history
build fix. added Utils.swap()
  • Loading branch information
adumesny authored Jun 2, 2024
2 parents 1f5dfa6 + c7b914b commit cf60875
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/dd-draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cf60875

Please sign in to comment.