diff options
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 }; +} |
