MCPcopy Create free account
hub / github.com/material-shell/material-shell / centerInBox

Function centerInBox

src/utils/layout.ts:3–13  ·  view source on GitHub ↗
(
    box: Clutter.ActorBox,
    width: number,
    height: number
)

Source from the content-addressed store, hash-verified

1import Clutter from 'gi://Clutter';
2
3export function centerInBox(
4 box: Clutter.ActorBox,
5 width: number,
6 height: number
7) {
8 const paddingX = (box.x2 - box.x1 - width) / 2;
9 const paddingY = (box.y2 - box.y1 - height) / 2;
10 const x = box.x1 + paddingX;
11 const y = box.y1 + paddingY;
12 return Clutter.ActorBox.new(x, y, x + width, y + height);
13}

Callers 2

vfunc_allocateMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected