diff --git a/frontend/src/AppBuilder/RightSideBar/ComponentsManagerTab/DragLayer.jsx b/frontend/src/AppBuilder/RightSideBar/ComponentsManagerTab/DragLayer.jsx index 158d87787d..9589ac145b 100644 --- a/frontend/src/AppBuilder/RightSideBar/ComponentsManagerTab/DragLayer.jsx +++ b/frontend/src/AppBuilder/RightSideBar/ComponentsManagerTab/DragLayer.jsx @@ -44,11 +44,16 @@ const CustomDragLayer = ({ size }) => { const mainCanvasWidth = document.getElementById('real-canvas')?.offsetWidth || 0; - const width = (mainCanvasWidth * size.width) / NO_OF_GRIDS; + let width = (mainCanvasWidth * size.width) / NO_OF_GRIDS; // Calculate position relative to the current canvas (parent or child) const left = currentOffset.x - (canvasBounds?.left || 0); const top = currentOffset.y - (canvasBounds?.top || 0); + // Adjust position and width if exceeding grid bounds + if (width >= canvasWidth) { + width = canvasWidth; + } + const [x, y] = snapToGrid(canvasWidth, left, top); return (