mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
feat: restrict scroll to bounds
This commit is contained in:
parent
7007f9e1c1
commit
ea414c2c5b
2 changed files with 6 additions and 2 deletions
|
|
@ -439,6 +439,7 @@ export const Container = ({
|
|||
// },
|
||||
};
|
||||
setBoxes(newBoxes);
|
||||
updateCanvasHeight(newBoxes);
|
||||
}
|
||||
|
||||
const paramUpdated = useCallback(
|
||||
|
|
|
|||
|
|
@ -408,8 +408,10 @@ export default function DragContainer({
|
|||
let left = e.lastEvent.translate[0];
|
||||
let top = e.lastEvent.translate[1];
|
||||
const currentWidget = boxes.find(({ id }) => id === e.target.id)?.component?.component;
|
||||
const parentWidget = boxes.find(({ id }) => id === parentElem.id)?.component?.component;
|
||||
const restrictedWidgets = restrictedWidgetsObj[parentWidget];
|
||||
const parentWidget = parentElem
|
||||
? boxes.find(({ id }) => id === parentElem.id)?.component?.component
|
||||
: undefined;
|
||||
const restrictedWidgets = restrictedWidgetsObj?.[parentWidget] || [];
|
||||
const isParentChangeAllowed = !restrictedWidgets.includes(currentWidget);
|
||||
if (parentElem && isParentChangeAllowed) {
|
||||
left = left - parentElem.left * gridWidth;
|
||||
|
|
@ -497,6 +499,7 @@ export default function DragContainer({
|
|||
elementGuidelines={list.map((l) => ({ element: `.ele-${l.id}`, className: 'grid-guide-lines' }))}
|
||||
isDisplaySnapDigit={false}
|
||||
snapGridWidth={gridWidth}
|
||||
bounds={{ left: 0, top: 0, right: 0, bottom: 0, position: 'css' }}
|
||||
/>
|
||||
|
||||
{removeDuplicates(list)
|
||||
|
|
|
|||
Loading…
Reference in a new issue