This commit is contained in:
2025-08-13 15:37:15 +08:00
parent 53e2687546
commit 8048584f38
27 changed files with 15071 additions and 1511 deletions
+11 -4
View File
@@ -119,12 +119,19 @@ export class SceneBgVideoLayer extends li_BaseView {
this.videoPlayer.play();
let uiT:UITransform = this.videoPlayer.node.getComponent(UITransform);
const size = uiT.contentSize;
console.log(size);
const videoSize = uiT.contentSize;
const targetSize = data.size;
console.log(targetSize);
console.log('Video size:', videoSize, 'Target size:', targetSize);
this.videoPlayer.node.setScale(new Vec3(targetSize.y/576,targetSize.y/576,1));
// 计算宽度和高度的缩放比例
const scaleX = targetSize.width / videoSize.width;
const scaleY = targetSize.height / videoSize.height;
// 选择较大的缩放比例以填满整个区域(可能超出但不会有黑边)
const scale = Math.max(scaleX, scaleY);
console.log(`Video scaling: scaleX=${scaleX}, scaleY=${scaleY}, final scale=${scale}`);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
});
}