media_player_client/src/common/SpecialVideoHelper.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

export interface IScreenInfo {
screen_width: number;
screen_height: number;
unit_width: number;
unit_height: number;
screen_rows: number;
screen_cols: number;
desktop_col: number;
desktop_row: number;
desktop_width: number;
desktop_height: number;
}
export class SpecialVideoHelper {
private static kScreenWidth = 3840;
private static kScreenHeight = 2160;
public static getScreenInfo(
wall_cols: number,
wall_rows: number
): IScreenInfo {
const desktp_row = Math.ceil(Math.sqrt(wall_rows * wall_cols));
const desktop_col = desktp_row;
const unit_width = SpecialVideoHelper.kScreenWidth / desktop_col;
const unit_height = SpecialVideoHelper.kScreenHeight / desktp_row;
const screen_width = wall_cols * unit_width;
const screen_height = wall_rows * unit_height;
return {
screen_width,
screen_height,
unit_width,
unit_height,
screen_rows: wall_rows,
screen_cols: wall_cols,
desktop_col,
desktop_row: desktop_col,
desktop_width: SpecialVideoHelper.kScreenWidth,
desktop_height: SpecialVideoHelper.kScreenHeight,
};
}
}