From 9fad151c2782366a948882e1ae6aa725ed155a18 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 17 Oct 2026 13:12:57 +0200 Subject: island: corner position helper for the OBS webcam --- desktop/island/Logic.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'desktop/island/Logic.js') 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 }; +} -- cgit v1.2.3