mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-03 18:49:23 +08:00
LayerManager添加窗口宽高比例与设计宽高比例属性
This commit is contained in:
@@ -82,6 +82,11 @@ export class LayerManager {
|
||||
/** 新手引导层 */
|
||||
guide!: Node;
|
||||
|
||||
/** 窗口宽高比例 */
|
||||
windowAspectRatio: number = 0;
|
||||
/** 设计宽高比例 */
|
||||
designAspectRatio: number = 0;
|
||||
|
||||
/** 界面层 */
|
||||
private readonly ui!: LayerUI;
|
||||
/** 弹窗层 */
|
||||
@@ -98,13 +103,13 @@ export class LayerManager {
|
||||
private initScreenAdapter() {
|
||||
const drs = view.getDesignResolutionSize();
|
||||
const ws = screen.windowSize;
|
||||
const windowAspectRatio = ws.width / ws.height;
|
||||
const designAspectRatio = drs.width / drs.height;
|
||||
this.windowAspectRatio = ws.width / ws.height;
|
||||
this.designAspectRatio = drs.width / drs.height;
|
||||
|
||||
let finalW: number = 0;
|
||||
let finalH: number = 0;
|
||||
|
||||
if (windowAspectRatio > designAspectRatio) {
|
||||
if (this.windowAspectRatio > this.designAspectRatio) {
|
||||
finalH = drs.height;
|
||||
finalW = finalH * ws.width / ws.height;
|
||||
oops.log.logView("适配屏幕高度", "【横屏】");
|
||||
|
||||
Reference in New Issue
Block a user