页面h5适配

This commit is contained in:
2025-08-15 18:17:12 +08:00
parent 599c98f135
commit 92277f0ff1
9 changed files with 4975 additions and 4580 deletions
+2 -2
View File
@@ -178,11 +178,11 @@ export default class Utils {
//let windowSize = view.getVisibleSize();
let bgTf = node.getComponent(UITransform);
if (bgTf) {
if (mod == 1 && bgTf.height <= windowSize.height) {
if (mod == 1) {
let scale = windowSize.height / bgTf.height;
bgTf.height = bgTf.height * scale;
bgTf.width = bgTf.width * scale;
} else if (mod == 2 && bgTf.width <= windowSize.width) {
} else if (mod == 2) {
let scale = windowSize.width / bgTf.width;
bgTf.height = bgTf.height * scale;
bgTf.width = bgTf.width * scale;