fix: prevent widgets from havin negative top position

This commit is contained in:
Johnson Cherian 2024-01-11 02:55:45 +05:30
parent d2bc60cdc0
commit bc835e9dac
2 changed files with 11 additions and 0 deletions

View file

@ -357,6 +357,9 @@ export const Container = ({
const newWidth = (width * noOfGrids) / _canvasWidth;
gw = gw ? gw : gridWidth;
const parent = boxes[id]?.component?.parent;
if (y < 0) {
y = 0;
}
if (parent) {
const parentElem = document.getElementById(`canvas-${parent}`);
const parentId = parent.includes('-') ? parent?.split('-').slice(0, -1).join('-') : parent;
@ -425,6 +428,10 @@ export const Container = ({
}
}
if (y < 0) {
y = 0;
}
if (parent) {
const parentElem = document.getElementById(`canvas-${parent}`);
const parentId = parent.includes('-') ? parent?.split('-').slice(0, -1).join('-') : parent;

View file

@ -772,6 +772,10 @@ export default function DragContainer({
width,
} = lastEvent;
if (top < 0) {
top = 0;
}
let draggedOverElemId = i.parent;
const parentComponent = boxes.find((box) => box.id === i.parent);
const parentComponentType = parentComponent?.component?.component;