MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / setTransform

Function setTransform

frontend/layout/lib/utils.ts:61–82  ·  view source on GitHub ↗
(
    { top, left, width, height }: Dimensions,
    setSize = true,
    roundVals = true,
    zIndex?: number | string
)

Source from the content-addressed store, hash-verified

59}
60
61export function setTransform(
62 { top, left, width, height }: Dimensions,
63 setSize = true,
64 roundVals = true,
65 zIndex?: number | string
66): CSSProperties {
67 // Replace unitless items with px
68 const topRounded = roundVals ? Math.floor(top) : top;
69 const leftRounded = roundVals ? Math.floor(left) : left;
70 const widthRounded = roundVals ? Math.ceil(width) : width;
71 const heightRounded = roundVals ? Math.ceil(height) : height;
72 const translate = `translate3d(${leftRounded}px,${topRounded}px, 0)`;
73 return {
74 top: 0,
75 left: 0,
76 transform: translate,
77 width: setSize ? `${widthRounded}px` : undefined,
78 height: setSize ? `${heightRounded}px` : undefined,
79 position: "absolute",
80 zIndex: zIndex,
81 };
82}
83
84export function getCenter(dimensions: Dimensions): Point {
85 return {

Callers 4

constructorMethod · 0.90
updateTreeHelperMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected