fix(脑图): 导航器修复

--bug=1047036 --user=白奇 【测试计划】首次进入计划详情页,需要双击导航器图标才能打开预览图弹窗 https://www.tapd.cn/55049933/s/1584885
This commit is contained in:
baiqi 2024-09-24 15:38:01 +08:00 committed by 刘瑞斌
parent f9336890e8
commit b54e2d4660
1 changed files with 5 additions and 11 deletions

View File

@ -151,7 +151,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { navigatorProps } from '../props'; import { navigatorProps } from '../props';
import { getLocalStorage, setLocalStorage } from '../script/store'; import { setLocalStorage } from '../script/store';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
const props = defineProps(navigatorProps); const props = defineProps(navigatorProps);
@ -160,7 +160,7 @@
const navPreviewer: Ref<HTMLDivElement | null> = ref(null); const navPreviewer: Ref<HTMLDivElement | null> = ref(null);
const isNavOpen = ref(false); const isNavOpen = ref(window.localStorage.getItem('navigator-hidden') || false);
const previewNavigator: Ref<HTMLDivElement | null> = ref(null); const previewNavigator: Ref<HTMLDivElement | null> = ref(null);
const contentView = ref(''); const contentView = ref('');
@ -171,11 +171,6 @@
let paper = reactive<any>({}); let paper = reactive<any>({});
let minder = reactive<any>({}); let minder = reactive<any>({});
//
function getNavOpenState() {
return getLocalStorage('navigator-hidden');
}
const zoomPercent = ref(50); // 100% 50% 50 const zoomPercent = ref(50); // 100% 50% 50
/** /**
* 缩放 * 缩放
@ -291,13 +286,11 @@
} }
function toggleNavOpen() { function toggleNavOpen() {
let isNavOpenState = false; isNavOpen.value = !isNavOpen.value;
isNavOpenState = !JSON.parse(getNavOpenState());
isNavOpen.value = isNavOpenState;
setLocalStorage('navigator-hidden', isNavOpen.value); setLocalStorage('navigator-hidden', isNavOpen.value);
nextTick(() => { nextTick(() => {
if (isNavOpenState) { if (isNavOpen.value) {
bind(); bind();
updateContentView(); updateContentView();
updateVisibleView(); updateVisibleView();
@ -306,6 +299,7 @@
} }
}); });
} }
function navigate() { function navigate() {
function moveView(center: Record<string, any>, duration?: number) { function moveView(center: Record<string, any>, duration?: number) {
if (!minder.getPaper || !visibleView.width || !visibleView.height) return; if (!minder.getPaper || !visibleView.width || !visibleView.height) return;