From f2dae5685031c024f91104e473ee425357092eef Mon Sep 17 00:00:00 2001 From: Warinyourself Date: Sun, 11 Dec 2022 23:32:49 +0300 Subject: [PATCH] Adaptive menu position for zoom property --- src/components/app/AppMenu.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/app/AppMenu.tsx b/src/components/app/AppMenu.tsx index 149ccda..8a256fd 100644 --- a/src/components/app/AppMenu.tsx +++ b/src/components/app/AppMenu.tsx @@ -2,6 +2,7 @@ import { Component, Prop, Vue, Watch } from 'vue-property-decorator' import { PageModule } from '@/store/page' import AppIcon from '@/components/app/AppIcon.vue' import { AppMenuItem, AppMenuPosition } from '@/models/page' +import { AppModule } from '@/store/app' @Component({ components: { AppIcon } @@ -70,6 +71,7 @@ export default class AppMenu extends Vue { calculatePosition() { const node = this.menu.node + const { zoom } = AppModule if (!node || !this.menu.view) return @@ -77,12 +79,15 @@ export default class AppMenu extends Vue { const allHeight = window.innerHeight const positionY = bottom > top ? 'bottom' : 'top' - const position: AppMenuPosition = { left, width } + const position: AppMenuPosition = { + left: left * zoom, + width: width * zoom + } if (positionY === 'bottom') { - position.top = top + height + position.top = (top + height) * zoom } else { - position.bottom = allHeight - bottom + height + position.bottom = (allHeight - bottom + height) * zoom } this.innerPositioned = position