Update setTransform calculation to ensure blocks don't overflow display container (#181)

This commit is contained in:
Evan Simkowitz 2024-07-30 19:21:06 -07:00 committed by GitHub
parent 4025d2fa9a
commit 9afb5a7bc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,