MCPcopy
hub / github.com/CapSoftware/Cap / centerCurrentWindow

Function centerCurrentWindow

apps/desktop/src/routes/camera.tsx:110–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108})();
109
110async function centerCurrentWindow() {
111 const monitor = await currentMonitor();
112 if (!monitor) return;
113 const window = getCurrentWindow();
114 const scaleFactor = monitor.scaleFactor;
115 const monitorPosition = monitor.position.toLogical(scaleFactor);
116 const monitorSize = monitor.size.toLogical(scaleFactor);
117 const windowSize = (await window.outerSize()).toLogical(scaleFactor);
118 const x = monitorPosition.x + (monitorSize.width - windowSize.width) / 2;
119 const y = monitorPosition.y + (monitorSize.height - windowSize.height) / 2;
120 await window.setPosition(new LogicalPosition(x, y));
121}
122
123export default function () {
124 document.documentElement.classList.toggle("dark", true);

Callers 1

centerCameraOnlyWindowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected