提交 5e3858b0 编写于 作者: Q qiang

fix: 修复获取部分安卓模拟器屏幕宽高错误的问题

上级 cb4edcea
......@@ -156,14 +156,9 @@ export function getStatusbarHeight () {
}
export function getScreenInfo () {
const orientation = plus.navigator.getOrientation()
const landscape = Math.abs(orientation) === 90
// 安卓 plus 接口获取的屏幕大小值不为整数
const width = plus.screen.resolutionWidth
const height = plus.screen.resolutionHeight
// 根据方向纠正宽高
const { resolutionWidth, resolutionHeight } = plus.screen.getCureentSize()
return {
screenWidth: Math[landscape ? 'max' : 'min'](width, height),
screenHeight: Math[landscape ? 'min' : 'max'](width, height)
screenWidth: Math.round(resolutionWidth),
screenHeight: Math.round(resolutionHeight)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册