mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
Fix screen-share letterboxing across skins
This commit is contained in:
1 parent
acdc7a2330
commit
833357e278
22 files changed
+67
-65
No files matched your search
@@ -10,20 +10,6 @@ interface ScreenShareResolutionOption {
|
||||
label: string;
|
||||
}
|
||||
|
||||
export function calculateScreenSharePlayerSize(
|
||||
sourceWidth: number,
|
||||
sourceHeight: number,
|
||||
maxWidth: number,
|
||||
maxHeight: number,
|
||||
): { width: number; height: number } | null {
|
||||
if (![sourceWidth, sourceHeight, maxWidth, maxHeight].every((value) => Number.isFinite(value) && value > 0)) return null;
|
||||
const scale = Math.min(maxWidth / sourceWidth, maxHeight / sourceHeight);
|
||||
return {
|
||||
width: Math.max(1, Math.floor(sourceWidth * scale)),
|
||||
height: Math.max(1, Math.floor(sourceHeight * scale)),
|
||||
};
|
||||
}
|
||||
|
||||
interface UseWebClientScreenShareOptions {
|
||||
streams: ScreenShareStream[];
|
||||
viewing: Ref<boolean>;
|
||||
|
||||
Reference in new issue
Block a user