Fit resolutions to less than 2k x 2k (#1065)

* Fit resolutions to less than 2k x 2k

* Integer resolutions

* Scale mouse clicks

* Move stream maxResolution logic to getDimensions
This commit is contained in:
Adam Sunderland
2023-11-13 19:32:07 -05:00
committed by GitHub
parent 381d0b3bc8
commit 251971238d
3 changed files with 11 additions and 24 deletions

View File

@ -82,9 +82,14 @@ export function useSetupEngineManager(
}
function getDimensions(streamWidth?: number, streamHeight?: number) {
const maxResolution = 2000
const width = streamWidth ? streamWidth : 0
const quadWidth = Math.round(width / 4) * 4
const height = streamHeight ? streamHeight : 0
const quadHeight = Math.round(height / 4) * 4
const ratio = Math.min(
Math.min(maxResolution / width, maxResolution / height),
1.0
)
const quadWidth = Math.round((width * ratio) / 4) * 4
const quadHeight = Math.round((height * ratio) / 4) * 4
return { width: quadWidth, height: quadHeight }
}