(
box: Clutter.ActorBox,
width: number,
height: number
)
| 1 | import Clutter from 'gi://Clutter'; |
| 2 | |
| 3 | export 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 | } |
no outgoing calls
no test coverage detected