From dc3ca7cbf721df64d860ead581499c190832aea4 Mon Sep 17 00:00:00 2001 From: YuTing <1110804@allis.com.tw> Date: Mon, 25 Dec 2023 10:14:28 +0800 Subject: [PATCH] fix the problem if layout doesnt have static item --- src/core/helpers/utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/helpers/utils.ts b/src/core/helpers/utils.ts index 6fdd985..839de3a 100644 --- a/src/core/helpers/utils.ts +++ b/src/core/helpers/utils.ts @@ -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)) {