Skip to content

Commit

Permalink
Merge pull request #47 from UTing1119/FixHorizontalShift
Browse files Browse the repository at this point in the history
fix the problem if layout doesnt have static item
  • Loading branch information
gwinnem committed Dec 27, 2023
2 parents e6567f6 + dc3ca7c commit b83f0da
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ export function collides(l1: ILayoutItem, l2: ILayoutItem): boolean {
* @throws {Error} Empty layout.
*/
export function getFirstCollision(layout: TLayout, layoutItem: ILayoutItem): ILayoutItem | undefined {
if(layout.length < 1) {
throw new Error('Empty layout');
}
// if layout doesnt have static item it will cause error
// cannot drag or do anything

// if(layout.length < 1) {
// throw new Error('Empty layout');
// }

for(let i = 0, len = layout.length; i < len; i++) {
if(collides(layout[i], layoutItem)) {
Expand Down

0 comments on commit b83f0da

Please sign in to comment.