Skip to content

Commit

Permalink
Merge pull request #1560 from visualize-admin/fix/adding-new-chart-fr…
Browse files Browse the repository at this point in the history
…ee-canvas

fix: Assure the layouts adhere to min and max constraints
  • Loading branch information
bprusinowski committed Jun 5, 2024
2 parents c947553 + a0d953e commit a7b1001
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app/components/react-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,17 @@ export const ChartGridLayout = (props: ChartGridLayoutProps) => {

const enhancedLayouts = useMemo(() => {
return mapValues(layouts, (layouts) => {
return layouts.map((x) => ({
...x,
minH: MIN_H,
maxH: MAX_H,
maxW: MAX_W,
resizeHandles: resize ? availableHandles : [],
}));
return layouts.map((x) => {
return {
...x,
minH: MIN_H,
maxH: MAX_H,
h: Math.min(MAX_H, Math.max(MIN_H, x.h)),
maxW: MAX_W,
w: Math.min(MAX_W, x.w),
resizeHandles: resize ? availableHandles : [],
};
});
});
}, [layouts, resize]);

Expand Down

0 comments on commit a7b1001

Please sign in to comment.