[]程序当中更改适配模式后,没有生效成相对应的适配模式效果是为什么?
游戏内容当中,检测横竖屏:
Laya.stage.on(Laya.Event.RESIZE, this, this.onResize);
/** 更改适配*/
public onResize() {
var stageWidth = Laya.Browser.clientWidth;
var stageHeight = Laya.Browser.clientHeight;
if (stageWidth < stageHeight) {
console.log("one", Laya.stage.scaleMode)
Laya.stage.scaleMode = Laya.Stage.SCALE_NOSCALE; //1
console.log("one1", Laya.stage.scaleMode)
} else {
console.log("two", Laya.stage.scaleMode)
Laya.stage.scaleMode = Laya.Stage.SCALE_EXACTFIT;
console.log("two2", Laya.stage.scaleMode)
}
}
从打印结果上看适配有做更新,但是ui界面没有刷新成相对应的适配模式,这是为什么?
Laya.stage.on(Laya.Event.RESIZE, this, this.onResize);
/** 更改适配*/
public onResize() {
var stageWidth = Laya.Browser.clientWidth;
var stageHeight = Laya.Browser.clientHeight;
if (stageWidth < stageHeight) {
console.log("one", Laya.stage.scaleMode)
Laya.stage.scaleMode = Laya.Stage.SCALE_NOSCALE; //1
console.log("one1", Laya.stage.scaleMode)
} else {
console.log("two", Laya.stage.scaleMode)
Laya.stage.scaleMode = Laya.Stage.SCALE_EXACTFIT;
console.log("two2", Laya.stage.scaleMode)
}
}
从打印结果上看适配有做更新,但是ui界面没有刷新成相对应的适配模式,这是为什么?
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
Monica - 知识达人
赞同来自:
shimp
赞同来自:
Monica - 知识达人
赞同来自:
至于你要实现的效果你先去看看文档吧,文档中都有写!横屏 竖屏