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 { export function setTransform({ top, left, width, height }: Dimensions, setSize: boolean = true): CSSProperties {
// Replace unitless items with px // Replace unitless items with px
const topRounded = Math.round(top); const topRounded = Math.floor(top);
const leftRounded = Math.round(left); const leftRounded = Math.floor(left);
const widthRounded = Math.round(width); const widthRounded = Math.ceil(width);
const heightRounded = Math.round(height); const heightRounded = Math.ceil(height);
const translate = `translate3d(${leftRounded}px,${topRounded}px, 0)`; const translate = `translate3d(${leftRounded}px,${topRounded}px, 0)`;
return { return {
top: 0, top: 0,