将menu中的game.documentZoom改成get.menuZoom()便于调整
This commit is contained in:
parent
e2e0e3d154
commit
eb00fed0ad
|
@ -2226,6 +2226,12 @@ export class Get extends Uninstantable {
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
static menuZoom(){
|
||||||
|
if(game.menuZoom === undefined || game.menuZoom === null){
|
||||||
|
return game.documentZoom;
|
||||||
|
}
|
||||||
|
return game.menuZoom;
|
||||||
|
}
|
||||||
static strNumber(num) {
|
static strNumber(num) {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case 1: return 'A';
|
case 1: return 'A';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ui, game, get, lib, _status } from "../../../../noname.js";
|
||||||
|
|
||||||
export function openMenu(node, e, onclose) {
|
export function openMenu(node, e, onclose) {
|
||||||
popupContainer.innerHTML = '';
|
popupContainer.innerHTML = '';
|
||||||
var left = Math.round(e.clientX / game.documentZoom);
|
var left = Math.round(e.clientX / get.menuZoom());
|
||||||
var zoom = get.is.phoneLayout() ? 1.3 : 1;
|
var zoom = get.is.phoneLayout() ? 1.3 : 1;
|
||||||
popupContainer.appendChild(node);
|
popupContainer.appendChild(node);
|
||||||
// var rect=node.getBoundingClientRect();
|
// var rect=node.getBoundingClientRect();
|
||||||
|
@ -23,7 +23,7 @@ export function openMenu(node, e, onclose) {
|
||||||
// }
|
// }
|
||||||
// if(e){
|
// if(e){
|
||||||
var height = node.offsetHeight;
|
var height = node.offsetHeight;
|
||||||
var idealtop = e.clientY / game.documentZoom;
|
var idealtop = e.clientY / get.menuZoom();
|
||||||
if (idealtop < 10) {
|
if (idealtop < 10) {
|
||||||
idealtop = 10;
|
idealtop = 10;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ export function createMenu(connectMenu, tabs, config) {
|
||||||
var menuTab = ui.create.div('.menu-tab', menu);
|
var menuTab = ui.create.div('.menu-tab', menu);
|
||||||
var menuTabBar = ui.create.div('.menu-tab-bar', menu);
|
var menuTabBar = ui.create.div('.menu-tab-bar', menu);
|
||||||
menuTabBar.style.left = (config.bar || 0) + 'px';
|
menuTabBar.style.left = (config.bar || 0) + 'px';
|
||||||
if (Math.round(2 * game.documentZoom) < 2) {
|
if (Math.round(2 * get.menuZoom()) < 2) {
|
||||||
menuTabBar.style.height = '3px';
|
menuTabBar.style.height = '3px';
|
||||||
}
|
}
|
||||||
var menuContent = ui.create.div('.menu-content', menu);
|
var menuContent = ui.create.div('.menu-content', menu);
|
||||||
|
@ -153,7 +153,7 @@ export function createMenu(connectMenu, tabs, config) {
|
||||||
active._link.remove();
|
active._link.remove();
|
||||||
}
|
}
|
||||||
this.classList.add('active');
|
this.classList.add('active');
|
||||||
menuTabBar.style.transform = 'translateX(' + (this.getBoundingClientRect().left - this.parentNode.firstChild.getBoundingClientRect().left) / game.documentZoom + 'px)';
|
menuTabBar.style.transform = 'translateX(' + (this.getBoundingClientRect().left - this.parentNode.firstChild.getBoundingClientRect().left) / get.menuZoom() + 'px)';
|
||||||
menuContent.appendChild(this._link);
|
menuContent.appendChild(this._link);
|
||||||
};
|
};
|
||||||
ui.click.menuTab = function (tab) {
|
ui.click.menuTab = function (tab) {
|
||||||
|
|
Loading…
Reference in New Issue