diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-17 13:12:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-17 13:12:57 +0200 |
| commit | 9fad151c2782366a948882e1ae6aa725ed155a18 (patch) | |
| tree | 445431446ed6662ab7c6740eec73f7fff95f7e88 /desktop/island/Logic.js | |
| parent | f114ab947afbca8b301ae5d2fa903667ef200711 (diff) | |
| download | quickshell-9fad151c2782366a948882e1ae6aa725ed155a18.tar.gz quickshell-9fad151c2782366a948882e1ae6aa725ed155a18.zip | |
island: corner position helper for the OBS webcam
Diffstat (limited to 'desktop/island/Logic.js')
| -rw-r--r-- | desktop/island/Logic.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/desktop/island/Logic.js b/desktop/island/Logic.js index 24458cd..e687ac1 100644 --- a/desktop/island/Logic.js +++ b/desktop/island/Logic.js @@ -71,3 +71,11 @@ function obsElapsed(ms) { const mmss = `${two(Math.floor(s / 60) % 60)}:${two(s % 60)}`; return h ? `${h}:${mmss}` : mmss; } + +// Top-left position for a w x h source on a W x H canvas with margin m, in one +// of the four corners. Anything unrecognised reads as top-left. +function cornerPos(corner, W, H, w, h, m) { + const right = corner === "tr" || corner === "br"; + const bottom = corner === "bl" || corner === "br"; + return { x: right ? W - w - m : m, y: bottom ? H - h - m : m }; +} |
