2026-04-02 08:56:49 +08:00
|
|
|
import { defineStore } from 'pinia';
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
|
|
export const useUiStore = defineStore('ui', () => {
|
|
|
|
|
// 右侧抽屉状态
|
|
|
|
|
const drawerOpen = ref(true);
|
2026-05-18 09:03:20 +08:00
|
|
|
const mapType = ref('2D');
|
2026-07-10 17:56:16 +08:00
|
|
|
const mapSwitchCompletedTick = ref(0);
|
2026-07-16 17:58:11 +08:00
|
|
|
// 3d 流域三维漫游
|
|
|
|
|
const isRoaming = ref(false);
|
2026-07-22 16:23:10 +08:00
|
|
|
// dim 切换时跳过漫游相机还原(由地图模式切换自行处理)
|
|
|
|
|
const skipRoamCameraRestore = ref(false);
|
2026-08-07 17:55:27 +08:00
|
|
|
// 搜索抽屉状态
|
|
|
|
|
const searchDrawerOpen = ref(false);
|
2026-04-02 08:56:49 +08:00
|
|
|
|
|
|
|
|
// 切换抽屉状态
|
|
|
|
|
const toggleDrawer = () => {
|
|
|
|
|
drawerOpen.value = !drawerOpen.value;
|
|
|
|
|
};
|
|
|
|
|
// 设置抽屉状态
|
|
|
|
|
const setDrawerOpen = (open: boolean) => {
|
|
|
|
|
drawerOpen.value = open;
|
|
|
|
|
};
|
2026-08-07 17:55:27 +08:00
|
|
|
// 设置搜索抽屉状态
|
|
|
|
|
const setSearchDrawerOpen = (open: boolean) => {
|
|
|
|
|
console.log(open);
|
|
|
|
|
|
|
|
|
|
searchDrawerOpen.value = open;
|
|
|
|
|
};
|
2026-04-02 08:56:49 +08:00
|
|
|
|
2026-07-10 17:56:16 +08:00
|
|
|
const markMapSwitchCompleted = () => {
|
|
|
|
|
mapSwitchCompletedTick.value += 1;
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-02 08:56:49 +08:00
|
|
|
return {
|
|
|
|
|
drawerOpen,
|
2026-07-16 17:58:11 +08:00
|
|
|
isRoaming,
|
2026-07-22 16:23:10 +08:00
|
|
|
skipRoamCameraRestore,
|
2026-04-02 08:56:49 +08:00
|
|
|
toggleDrawer,
|
|
|
|
|
setDrawerOpen,
|
2026-08-07 17:55:27 +08:00
|
|
|
setSearchDrawerOpen,
|
|
|
|
|
searchDrawerOpen,
|
2026-07-10 17:56:16 +08:00
|
|
|
mapType,
|
|
|
|
|
mapSwitchCompletedTick,
|
|
|
|
|
markMapSwitchCompleted
|
2026-04-02 08:56:49 +08:00
|
|
|
};
|
2026-05-18 09:03:20 +08:00
|
|
|
});
|