Skip to content

Commit c439273

Browse files
committed
fix(ContextMenu): Fix context menu
1 parent be959f3 commit c439273

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

app/components/Viewer/ContextMenu.vue

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup>
2-
import { useDataStore } from "@ogw_front/stores/data"
32
import { useEventListener } from "@vueuse/core"
43
import { useMenuStore } from "@ogw_front/stores/menu"
54
@@ -16,7 +15,6 @@
1615
const CLOSE_DELAY = 100
1716
1817
const menuStore = useMenuStore()
19-
const dataStore = useDataStore()
2018
2119
const { id, x, y, containerWidth, containerHeight } = defineProps({
2220
id: { type: String, required: true },
@@ -26,13 +24,7 @@
2624
containerHeight: { type: Number, required: true },
2725
})
2826
29-
const meta_data = computed(() => {
30-
const itemId = id || menuStore.current_id
31-
if (!itemId) {
32-
return {}
33-
}
34-
return dataStore.getItem(itemId).value || {}
35-
})
27+
const meta_data = computed(() => menuStore.current_meta_data || {})
3628
3729
const show_menu = ref(true)
3830
const isDragging = ref(false)

app/stores/menu.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const useMenuStore = defineStore("menu", () => {
132132
const containerTop = ref(0)
133133
const containerLeft = ref(0)
134134
const active_item_index = ref(undefined)
135+
const current_meta_data = ref({})
135136

136137
function getMenuItems(objectType, geodeObject) {
137138
if (!objectType || !geodeObject || !menus.value[objectType]) {
@@ -143,6 +144,7 @@ export const useMenuStore = defineStore("menu", () => {
143144
function closeMenu() {
144145
active_item_index.value = undefined
145146
current_id.value = undefined
147+
current_meta_data.value = {}
146148
menuX.value = 0
147149
menuY.value = 0
148150
display_menu.value = false
@@ -162,6 +164,7 @@ export const useMenuStore = defineStore("menu", () => {
162164
}
163165

164166
current_id.value = id
167+
current_meta_data.value = meta_data || {}
165168

166169
if (x !== undefined && y !== undefined) {
167170
menuX.value = x
@@ -202,6 +205,7 @@ export const useMenuStore = defineStore("menu", () => {
202205
return {
203206
display_menu,
204207
current_id,
208+
current_meta_data,
205209
menuX,
206210
menuY,
207211
containerWidth,

0 commit comments

Comments
 (0)