Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/core/WebProvider/DocPIPWebProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ export default class DocPIPWebProvider extends WebProvider {
}
}

// 调整宽高,使其能被4整除
width = Math.floor(width / 4) * 4;
height = Math.floor(height / 4) * 4;

// 确保宽高比不变
const aspectRatio = vw / vh;
if (width / height > aspectRatio) {
// 如果宽高比大于原始比率,调整高度
height = Math.floor(width / aspectRatio);
} else {
// 如果宽高比小于或等于原始比率,调整宽度
width = Math.floor(height * aspectRatio);
}

await this.miniPlayer.init()
const playerEl = this.miniPlayer.playerRootEl
if (!playerEl) {
Expand Down