From 9afb5a7bc11816b6f4d5c8ebd2625b36ad7802ad Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 30 Jul 2024 19:21:06 -0700 Subject: [PATCH] Update setTransform calculation to ensure blocks don't overflow display container (#181) --- frontend/layout/lib/utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/layout/lib/utils.ts b/frontend/layout/lib/utils.ts index b903d1134..855ff4f03 100644 --- a/frontend/layout/lib/utils.ts +++ b/frontend/layout/lib/utils.ts @@ -83,10 +83,10 @@ export function determineDropDirection(dimensions?: Dimensions, offset?: XYCoord export function setTransform({ top, left, width, height }: Dimensions, setSize: boolean = true): CSSProperties { // Replace unitless items with px - const topRounded = Math.round(top); - const leftRounded = Math.round(left); - const widthRounded = Math.round(width); - const heightRounded = Math.round(height); + const topRounded = Math.floor(top); + const leftRounded = Math.floor(left); + const widthRounded = Math.ceil(width); + const heightRounded = Math.ceil(height); const translate = `translate3d(${leftRounded}px,${topRounded}px, 0)`; return { top: 0,