public getMenuTop(btn,type=false): void {
let get1 = () => {
var h2 = Main.app.mScreenHeight / 1334;
var w = Main.app.mScreenWidth / 750;
if (Main.app.mScreenHeight != 812) {
btn.y = 20 / h2 - 30 -86;
} else if (Main.app.mScreenHeight == 812) {
btn.y = 94 -86;
}
}
if (Main.app.mSDKVersion < '2.1.0') {
get1()
} else {
if (!Main.app.mWX.menuLayout) {
Main.app.mWX.menuLayout = wx.getMenuButtonBoundingClientRect()
console.log(Main.app.mWX.menuLayout)
}
if (!Main.app.mWX.menuLayout || !Main.app.mWX.menuLayout.top) {
get1()
} else {
let h = Main.app.mWX.menuLayout.height;
let t = Main.app.mWX.menuLayout.top;
let center_y = (t + h / 2) * Laya.stage.height / wxCore.uo.mPhone['screenHeight'];
if(!type)
{
btn.y = center_y - btn.height / 2 - 86 -( Laya.stage.height-1334)/2;
}
else
{
btn.y = center_y - 108 / 2 - 86;
}
}
}
}
网友评论