Skip to content

Commit b83f0da

Browse files
authored
Merge pull request #47 from UTing1119/FixHorizontalShift
fix the problem if layout doesnt have static item
2 parents e6567f6 + dc3ca7c commit b83f0da

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/helpers/utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ export function collides(l1: ILayoutItem, l2: ILayoutItem): boolean {
7070
* @throws {Error} Empty layout.
7171
*/
7272
export function getFirstCollision(layout: TLayout, layoutItem: ILayoutItem): ILayoutItem | undefined {
73-
if(layout.length < 1) {
74-
throw new Error('Empty layout');
75-
}
73+
// if layout doesnt have static item it will cause error
74+
// cannot drag or do anything
75+
76+
// if(layout.length < 1) {
77+
// throw new Error('Empty layout');
78+
// }
7679

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

0 commit comments

Comments
 (0)