mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-07 00:12:21 +01:00
Update setTransform calculation to ensure blocks don't overflow display container (#181)
This commit is contained in:
parent
4025d2fa9a
commit
9afb5a7bc1
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user