@geode/opengeodeweb-front 10.3.0 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/app/assets/geode_objects.js +1 -3
  3. package/app/components/Carousel.vue +7 -4
  4. package/app/components/CrsSelector.vue +5 -6
  5. package/app/components/DragAndDrop.vue +18 -8
  6. package/app/components/ExtensionSelector.vue +9 -17
  7. package/app/components/FeedBack/ErrorBanner.vue +1 -1
  8. package/app/components/FeedBack/Snackers.vue +4 -1
  9. package/app/components/FileSelector.vue +21 -10
  10. package/app/components/FileUploader.vue +15 -32
  11. package/app/components/HybridRenderingView.vue +5 -3
  12. package/app/components/Inspector/InspectionButton.vue +2 -2
  13. package/app/components/Inspector/ResultPanel.vue +4 -4
  14. package/app/components/Launcher.vue +1 -1
  15. package/app/components/Loading.vue +6 -6
  16. package/app/components/MissingFilesSelector.vue +23 -29
  17. package/app/components/ObjectSelector.vue +11 -10
  18. package/app/components/OptionCard.vue +1 -1
  19. package/app/components/PackagesVersions.vue +5 -3
  20. package/app/components/Recaptcha.vue +6 -4
  21. package/app/components/RemoteRenderingView.vue +4 -3
  22. package/app/components/Screenshot.vue +4 -4
  23. package/app/components/Step.vue +7 -7
  24. package/app/components/VeaseViewToolbar.vue +3 -3
  25. package/app/components/Viewer/BreadCrumb.vue +2 -4
  26. package/app/components/Viewer/ContextMenu.vue +77 -45
  27. package/app/components/Viewer/ContextMenuItem.vue +42 -33
  28. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
  29. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
  30. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
  31. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
  32. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
  33. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
  34. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
  35. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
  36. package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
  37. package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
  38. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
  39. package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
  40. package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
  41. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
  42. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
  43. package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
  44. package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
  45. package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
  46. package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
  47. package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
  48. package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
  49. package/app/components/Viewer/Options/ColorMapList.vue +75 -50
  50. package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
  51. package/app/components/Viewer/Options/ColorPicker.vue +3 -3
  52. package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
  53. package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
  54. package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
  55. package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
  56. package/app/components/Viewer/Options/TextureItem.vue +5 -5
  57. package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
  58. package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
  59. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
  60. package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
  61. package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
  62. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
  63. package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
  64. package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
  65. package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
  66. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
  67. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
  68. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
  69. package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
  70. package/app/components/Viewer/TreeComponent.vue +9 -13
  71. package/app/components/Viewer/TreeObject.vue +8 -9
  72. package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
  73. package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
  74. package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
  75. package/app/components/Wrapper.vue +1 -2
  76. package/app/components/ZScaling.vue +1 -1
  77. package/app/composables/project_manager.js +6 -6
  78. package/app/plugins/auto_store_register.js +1 -1
  79. package/app/stores/app.js +45 -41
  80. package/app/stores/data.js +52 -51
  81. package/app/stores/data_style.js +12 -11
  82. package/app/stores/feedback.js +5 -1
  83. package/app/stores/geode.js +16 -13
  84. package/app/stores/hybrid_viewer.js +72 -44
  85. package/app/stores/infra.js +18 -16
  86. package/app/stores/lambda.js +1 -9
  87. package/app/stores/menu.js +13 -13
  88. package/app/stores/treeview.js +15 -13
  89. package/app/stores/viewer.js +39 -33
  90. package/app/utils/app_mode.js +4 -3
  91. package/app/utils/default_styles.js +55 -47
  92. package/app/utils/file_import_workflow.js +4 -17
  93. package/app/utils/local.js +195 -184
  94. package/app/utils/upload_file.js +1 -2
  95. package/eslint.config.js +2 -2
  96. package/internal/database/database.js +17 -32
  97. package/internal/database/extended_database.js +25 -0
  98. package/internal/stores/data_style/mesh/cells/cell.js +3 -3
  99. package/internal/stores/data_style/mesh/cells/color.js +1 -1
  100. package/internal/stores/data_style/mesh/cells/index.js +7 -7
  101. package/internal/stores/data_style/mesh/cells/textures.js +1 -1
  102. package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
  103. package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
  104. package/internal/stores/data_style/mesh/edges/color.js +1 -1
  105. package/internal/stores/data_style/mesh/edges/edge.js +22 -22
  106. package/internal/stores/data_style/mesh/edges/index.js +7 -7
  107. package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
  108. package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
  109. package/internal/stores/data_style/mesh/edges/width.js +1 -1
  110. package/internal/stores/data_style/mesh/index.js +4 -5
  111. package/internal/stores/data_style/mesh/points/color.js +1 -1
  112. package/internal/stores/data_style/mesh/points/index.js +6 -6
  113. package/internal/stores/data_style/mesh/points/size.js +1 -1
  114. package/internal/stores/data_style/mesh/points/vertex.js +3 -3
  115. package/internal/stores/data_style/mesh/points/visibility.js +1 -1
  116. package/internal/stores/data_style/mesh/polygons/color.js +1 -1
  117. package/internal/stores/data_style/mesh/polygons/index.js +7 -7
  118. package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
  119. package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
  120. package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
  121. package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
  122. package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
  123. package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
  124. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
  125. package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
  126. package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
  127. package/internal/stores/data_style/model/edges.js +1 -1
  128. package/internal/stores/data_style/model/index.js +32 -22
  129. package/internal/utils/api_fetch.js +8 -5
  130. package/internal/utils/viewer_call.js +42 -46
  131. package/nuxt.config.js +3 -3
  132. package/package.json +1 -1
  133. package/scripts/generate_geode_objects.js +8 -7
  134. package/tests/integration/setup.js +28 -21
  135. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
  136. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
  137. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
  138. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
  139. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
  140. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
  141. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
  142. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
  143. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
  144. package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
  145. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
  146. package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
  147. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
  148. package/tests/integration/stores/viewer.nuxt.test.js +55 -39
  149. package/tests/setup_indexeddb.js +1 -0
  150. package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
  151. package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
  152. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
  153. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
  154. package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
  155. package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
  156. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
  157. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
  158. package/tests/unit/components/Launcher.nuxt.test.js +12 -17
  159. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
  160. package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
  161. package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
  162. package/tests/unit/components/Step.nuxt.test.js +8 -7
  163. package/tests/unit/components/Stepper.nuxt.test.js +14 -12
  164. package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
  165. package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
  166. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
  167. package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
  168. package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
  169. package/tests/unit/stores/App.nuxt.test.js +45 -43
  170. package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
  171. package/tests/unit/stores/Geode.nuxt.test.js +135 -137
  172. package/tests/unit/stores/Infra.nuxt.test.js +20 -26
  173. package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
  174. package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
  175. package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
  176. package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
  177. package/tests/utils.js +15 -2
  178. package/tests/vitest.config.js +6 -2
@@ -2,7 +2,7 @@
2
2
  import Status from "@ogw_front/utils/status"
3
3
  import { useGeodeStore } from "@ogw_front/stores/geode"
4
4
 
5
- const props = defineProps({
5
+ const { schema } = defineProps({
6
6
  schema: { type: Object, required: true },
7
7
  })
8
8
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  async function get_packages_versions() {
13
13
  await geodeStore.request(
14
- props.schema,
14
+ schema,
15
15
  {},
16
16
  {
17
17
  response_function: (response) => {
@@ -24,7 +24,9 @@
24
24
  watch(
25
25
  () => geodeStore.status,
26
26
  (value) => {
27
- if (value == Status.CONNECTED) get_packages_versions()
27
+ if (value === Status.CONNECTED) {
28
+ get_packages_versions()
29
+ }
28
30
  },
29
31
  )
30
32
 
@@ -2,7 +2,9 @@
2
2
  import { appMode } from "@ogw_front/utils/app_mode"
3
3
  import { useInfraStore } from "@ogw_front/stores/infra"
4
4
 
5
- const props = defineProps({
5
+ const RESPONSE_STATUS_OK = 200
6
+
7
+ const { button_label, button_color, color } = defineProps({
6
8
  button_label: {
7
9
  type: String,
8
10
  required: false,
@@ -58,7 +60,7 @@
58
60
  },
59
61
  })
60
62
  infraStore.$patch({
61
- is_captcha_validated: response.status === 200,
63
+ is_captcha_validated: response.status === RESPONSE_STATUS_OK,
62
64
  })
63
65
  }
64
66
  </script>
@@ -95,8 +97,8 @@
95
97
  <VRow align="center" justify="center">
96
98
  <VCol cols="4" class="d-flex justify-center align-center">
97
99
  <VBtn
98
- :text="props.button_label"
99
- :color="props.color || props.button_color"
100
+ :text="button_label"
101
+ :color="color || button_color"
100
102
  @click="submit_recaptcha"
101
103
  />
102
104
  </VCol>
@@ -1,12 +1,12 @@
1
1
  <script setup>
2
- import vtkRemoteView from "@kitware/vtk.js/Rendering/Misc/RemoteView"
3
2
  import { useElementSize, useWindowSize } from "@vueuse/core"
4
- import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
5
3
  import Status from "@ogw_front/utils/status"
6
4
  import ViewToolbar from "@ogw_front/components/ViewToolbar"
7
5
  import { useViewerStore } from "@ogw_front/stores/viewer"
6
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
7
+ import vtkRemoteView from "@kitware/vtk.js/Rendering/Misc/RemoteView"
8
8
 
9
- const props = defineProps({
9
+ const { viewId } = defineProps({
10
10
  viewId: { type: String, default: "-1" },
11
11
  })
12
12
 
@@ -28,6 +28,7 @@
28
28
  }
29
29
 
30
30
  const connected = ref(false)
31
+ // oxlint-disable-next-line import/no-named-as-default-member
31
32
  const view = vtkRemoteView.newInstance({
32
33
  rpcWheelEvent: "viewport.mouse.zoom.wheel",
33
34
  })
@@ -6,7 +6,7 @@
6
6
 
7
7
  const emit = defineEmits(["close"])
8
8
 
9
- const props = defineProps({
9
+ const { show_dialog, width } = defineProps({
10
10
  show_dialog: { type: Boolean, required: true },
11
11
  width: { type: Number, required: false, default: 400 },
12
12
  })
@@ -31,7 +31,7 @@
31
31
  response_function: async (response) => {
32
32
  fileDownload(
33
33
  response.blob,
34
- filename.value + "." + output_extension.value,
34
+ `${filename.value}.${output_extension.value}`,
35
35
  )
36
36
  },
37
37
  },
@@ -47,9 +47,9 @@
47
47
  </script>
48
48
  <template>
49
49
  <OptionCard
50
- v-if="props.show_dialog"
50
+ v-if="show_dialog"
51
51
  title="Take a screenshot"
52
- :width="props.width"
52
+ :width="width"
53
53
  class="position-absolute"
54
54
  style="z-index: 2; top: 90px; right: 55px"
55
55
  >
@@ -1,12 +1,12 @@
1
1
  <script setup>
2
2
  function truncate(text, maxLength) {
3
3
  if (text.length > maxLength) {
4
- return text.slice(0, maxLength) + "..."
4
+ return `${text.slice(0, maxLength)}...`
5
5
  }
6
6
  return text
7
7
  }
8
8
 
9
- const props = defineProps({
9
+ const { step_index } = defineProps({
10
10
  step_index: { type: Number, required: true },
11
11
  })
12
12
 
@@ -26,17 +26,17 @@
26
26
  }
27
27
 
28
28
  function increment_step() {
29
- stepper_tree.current_step_index++
29
+ stepper_tree.current_step_index += 1
30
30
  }
31
31
 
32
32
  function decrement_step() {
33
- stepper_tree.current_step_index--
33
+ stepper_tree.current_step_index -= 1
34
34
  }
35
35
 
36
36
  const sortedChips = computed(() => {
37
- const chips = steps.value[props.step_index]?.chips || []
38
- return [...chips].sort((a, b) =>
39
- a.localeCompare(b, undefined, {
37
+ const chips = steps.value[step_index]?.chips || []
38
+ return chips.toSorted((chipA, chipB) =>
39
+ chipA.localeCompare(chipB, undefined, {
40
40
  numeric: true,
41
41
  sensitivity: "base",
42
42
  }),
@@ -4,8 +4,8 @@
4
4
  import Screenshot from "@ogw_front/components/Screenshot"
5
5
  import ZScaling from "@ogw_front/components/ZScaling"
6
6
 
7
- import { useViewerStore } from "@ogw_front/stores/viewer"
8
7
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
8
+ import { useViewerStore } from "@ogw_front/stores/viewer"
9
9
 
10
10
  const hybridViewerStore = useHybridViewerStore()
11
11
  const viewerStore = useViewerStore()
@@ -21,7 +21,7 @@
21
21
  },
22
22
  )
23
23
 
24
- const handleZScalingClose = async () => {
24
+ async function handleZScalingClose() {
25
25
  await hybridViewerStore.setZScaling(zScale.value)
26
26
  showZScaling.value = false
27
27
  }
@@ -33,7 +33,7 @@
33
33
  action: () => {
34
34
  const { genericRenderWindow } = storeToRefs(hybridViewerStore)
35
35
  const renderWindow = genericRenderWindow.value.value.getRenderWindow()
36
- const renderer = renderWindow.getRenderers()[0]
36
+ const [renderer] = renderWindow.getRenderers()
37
37
  renderer.resetCamera()
38
38
  renderWindow.render()
39
39
  hybridViewerStore.syncRemoteCamera()
@@ -7,15 +7,13 @@
7
7
 
8
8
  const selectedTree = computed(() => treeviewStore.selectedTree)
9
9
 
10
- const goBackToFileTree = () => {
10
+ function goBackToFileTree() {
11
11
  treeviewStore.displayFileTree()
12
12
  }
13
13
 
14
14
  const model_id = computed(() => treeviewStore.model_id)
15
15
 
16
- const metaDatas = computed(() => {
17
- return dataStore.getItem(model_id.value).value
18
- })
16
+ const metaDatas = computed(() => dataStore.getItem(model_id.value).value)
19
17
  </script>
20
18
 
21
19
  <template>
@@ -1,12 +1,24 @@
1
1
  <script setup>
2
- import { useMenuStore } from "@ogw_front/stores/menu"
3
2
  import { useDataStore } from "@ogw_front/stores/data"
4
3
  import { useEventListener } from "@vueuse/core"
4
+ import { useMenuStore } from "@ogw_front/stores/menu"
5
+
6
+ const RADIUS = 80
7
+ const MARGIN_OFFSET = 40
8
+ const Z_INDEX_MENU = 1000
9
+ const Z_INDEX_ACTIVE_ITEM = 10
10
+ const Z_INDEX_BASE_ITEM = 1
11
+ const FULL_ANGLE = 360
12
+ const ANGLE_45 = 45
13
+ const ANGLE_135 = 135
14
+ const ANGLE_225 = 225
15
+ const ANGLE_315 = 315
16
+ const CLOSE_DELAY = 100
5
17
 
6
18
  const menuStore = useMenuStore()
7
19
  const dataStore = useDataStore()
8
20
 
9
- const props = defineProps({
21
+ const { id, x, y, containerWidth, containerHeight } = defineProps({
10
22
  id: { type: String, required: true },
11
23
  x: { type: Number, required: true },
12
24
  y: { type: Number, required: true },
@@ -15,21 +27,22 @@
15
27
  })
16
28
 
17
29
  const meta_data = computed(() => {
18
- const itemId = props.id || menuStore.current_id
19
- if (!itemId) return {}
30
+ const itemId = id || menuStore.current_id
31
+ if (!itemId) {
32
+ return {}
33
+ }
20
34
  return dataStore.getItem(itemId).value || {}
21
35
  })
22
36
 
23
- const radius = 80
24
37
  const show_menu = ref(true)
25
38
  const isDragging = ref(false)
26
39
  const dragStartX = ref(0)
27
40
  const dragStartY = ref(0)
28
- const menuX = ref(props.x)
29
- const menuY = ref(props.y)
41
+ const menuX = ref(x)
42
+ const menuY = ref(y)
30
43
 
31
44
  watch(
32
- () => [props.x, props.y],
45
+ () => [x, y],
33
46
  ([newX, newY]) => {
34
47
  const { x, y } = clampPosition(newX, newY)
35
48
  menuX.value = x
@@ -40,94 +53,113 @@
40
53
  )
41
54
 
42
55
  useEventListener(
43
- window,
56
+ globalThis,
44
57
  "mousemove",
45
- (e) => {
46
- if (!isDragging.value) return
47
- handleDrag(e)
58
+ (event) => {
59
+ if (!isDragging.value) {
60
+ return
61
+ }
62
+ handleDrag(event)
48
63
  },
49
64
  { passive: true },
50
65
  )
51
66
 
52
- useEventListener(window, "mouseup", (e) => {
53
- if (!isDragging.value) return
54
- stopDrag(e)
67
+ useEventListener(globalThis, "mouseup", (event) => {
68
+ if (!isDragging.value) {
69
+ return
70
+ }
71
+ stopDrag(event)
55
72
  })
56
73
 
57
74
  const menu_items = shallowRef([])
58
75
  watch(
59
76
  () => [meta_data.value.viewer_type, meta_data.value.geode_object_type],
60
- ([v, g]) => {
61
- menu_items.value = menuStore.getMenuItems(v, g)
77
+ ([viewer_type, geode_object_type]) => {
78
+ menu_items.value = menuStore.getMenuItems(viewer_type, geode_object_type)
62
79
  },
63
80
  { immediate: true },
64
81
  )
65
82
 
66
83
  const menuItemCount = computed(() => menu_items.value.length)
67
84
 
68
- function startDrag(e) {
85
+ function startDrag(event) {
69
86
  isDragging.value = true
70
- dragStartX.value = e.clientX - menuX.value
71
- dragStartY.value = e.clientY - menuY.value
72
- e.preventDefault()
87
+ dragStartX.value = event.clientX - menuX.value
88
+ dragStartY.value = event.clientY - menuY.value
89
+ event.preventDefault()
73
90
  }
74
91
 
75
92
  function clampPosition(x, y) {
76
- const margin = radius + 40
93
+ const margin = RADIUS + MARGIN_OFFSET
77
94
  return {
78
- x: Math.min(Math.max(x, margin), props.containerWidth - margin),
79
- y: Math.min(Math.max(y, margin), props.containerHeight - margin),
95
+ x: Math.min(Math.max(x, margin), containerWidth - margin),
96
+ y: Math.min(Math.max(y, margin), containerHeight - margin),
80
97
  }
81
98
  }
82
99
 
83
- function handleDrag(e) {
100
+ function handleDrag(event) {
84
101
  const { x, y } = clampPosition(
85
- e.clientX - dragStartX.value,
86
- e.clientY - dragStartY.value,
102
+ event.clientX - dragStartX.value,
103
+ event.clientY - dragStartY.value,
87
104
  )
88
105
  menuX.value = x
89
106
  menuY.value = y
90
107
  menuStore.setMenuPosition(x, y)
91
108
  }
92
109
 
93
- function stopDrag(e) {
110
+ function stopDrag(event) {
94
111
  isDragging.value = false
95
- e.stopPropagation()
112
+ event.stopPropagation()
96
113
  menuStore.setMenuPosition(menuX.value, menuY.value)
97
114
  }
98
115
 
99
116
  function getMenuStyle() {
100
117
  return {
101
118
  position: "fixed",
102
- left: `${menuStore.containerLeft + menuX.value - radius}px`,
103
- top: `${menuStore.containerTop + menuY.value - radius}px`,
104
- zIndex: 1000,
119
+ left: `${menuStore.containerLeft + menuX.value - RADIUS}px`,
120
+ top: `${menuStore.containerTop + menuY.value - RADIUS}px`,
121
+ zIndex: Z_INDEX_MENU,
105
122
  }
106
123
  }
107
124
 
108
125
  function getTooltipLocation(index) {
109
- const angle = (index / menuItemCount.value) * 360
110
- if (angle < 45 || angle >= 315) return "right"
111
- if (angle >= 45 && angle < 135) return "top"
112
- if (angle >= 135 && angle < 225) return "left"
126
+ const angle = (index / menuItemCount.value) * FULL_ANGLE
127
+ if (angle < ANGLE_45 || angle >= ANGLE_315) {
128
+ return "right"
129
+ }
130
+ if (angle >= ANGLE_45 && angle < ANGLE_135) {
131
+ return "top"
132
+ }
133
+ if (angle >= ANGLE_135 && angle < ANGLE_225) {
134
+ return "left"
135
+ }
113
136
  return "bottom"
114
137
  }
115
138
 
116
139
  function getTooltipOrigin(index) {
117
- const angle = (index / menuItemCount.value) * 360
118
- if (angle < 45 || angle >= 315) return "left"
119
- if (angle >= 45 && angle < 135) return "bottom"
120
- if (angle >= 135 && angle < 225) return "right"
140
+ const angle = (index / menuItemCount.value) * FULL_ANGLE
141
+ if (angle < ANGLE_45 || angle >= ANGLE_315) {
142
+ return "left"
143
+ }
144
+ if (angle >= ANGLE_45 && angle < ANGLE_135) {
145
+ return "bottom"
146
+ }
147
+ if (angle >= ANGLE_135 && angle < ANGLE_225) {
148
+ return "right"
149
+ }
121
150
  return "top"
122
151
  }
123
152
 
124
153
  function getItemStyle(index) {
125
154
  const angle = (index / menuItemCount.value) * 2 * Math.PI
126
155
  return {
127
- transform: `translate(${Math.cos(angle) * radius}px, ${Math.sin(angle) * radius}px)`,
156
+ transform: `translate(${Math.cos(angle) * RADIUS}px, ${Math.sin(angle) * RADIUS}px)`,
128
157
  transition: "opacity 0.2s ease, transform 0.2s ease",
129
158
  position: "absolute",
130
- zIndex: menuStore.active_item_index === index ? 10 : 1,
159
+ zIndex:
160
+ menuStore.active_item_index === index
161
+ ? Z_INDEX_ACTIVE_ITEM
162
+ : Z_INDEX_BASE_ITEM,
131
163
  }
132
164
  }
133
165
  </script>
@@ -138,13 +170,13 @@
138
170
  content-class="circular-menu-container"
139
171
  :style="getMenuStyle()"
140
172
  :close-on-content-click="false"
141
- :close-delay="100"
173
+ :close-delay="CLOSE_DELAY"
142
174
  :overlay="false"
143
175
  >
144
176
  <div class="circular-menu-drag-handle" @mousedown.stop="startDrag">
145
177
  <div
146
178
  class="circular-menu-items"
147
- :style="{ width: `${radius * 2}px`, height: `${radius * 2}px` }"
179
+ :style="{ width: `${RADIUS * 2}px`, height: `${RADIUS * 2}px` }"
148
180
  >
149
181
  <component
150
182
  v-for="(item, index) in menu_items"
@@ -152,7 +184,7 @@
152
184
  :key="index"
153
185
  :index="index"
154
186
  :itemProps="{
155
- id: props.id,
187
+ id: id,
156
188
  tooltip_location: getTooltipLocation(index),
157
189
  tooltip_origin: getTooltipOrigin(index),
158
190
  totalItems: menuItemCount,
@@ -1,66 +1,79 @@
1
1
  <script setup>
2
- import { useTheme } from "vuetify"
3
- import { useMenuStore } from "@ogw_front/stores/menu"
4
2
  import { useElementSize } from "@vueuse/core"
3
+ import { useMenuStore } from "@ogw_front/stores/menu"
4
+ import { useTheme } from "vuetify"
5
+
6
+ const CARD_WIDTH = 320
7
+ const CARD_HEIGHT = 500
8
+ const MARGIN = 60
9
+ const RADIUS = 80
10
+ const OFFSET = 40
5
11
 
6
12
  const menuStore = useMenuStore()
7
13
  const theme = useTheme()
8
14
  const primaryColor = computed(() => theme.current.value.colors.primary)
9
- const props = defineProps({
15
+ const { index, itemProps, tooltip, btn_image } = defineProps({
10
16
  index: { type: Number, required: true },
11
17
  itemProps: { type: Object, required: true },
12
18
  tooltip: { type: String, required: true },
13
19
  btn_image: { type: String, required: true },
14
20
  })
15
21
 
16
- const is_active = computed(() => menuStore.active_item_index === props.index)
17
- const optionsRef = ref(null)
22
+ const is_active = computed(() => menuStore.active_item_index === index)
23
+ const optionsRef = ref(undefined)
18
24
  const { height: optionsHeight } = useElementSize(optionsRef)
19
25
 
20
26
  const maxCardHeight = computed(() =>
21
- Math.min(500, menuStore.containerHeight - 40),
27
+ Math.min(CARD_HEIGHT, menuStore.containerHeight - OFFSET),
22
28
  )
23
29
 
24
30
  const optionsStyle = computed(() => {
25
- if (!is_active.value || !optionsHeight.value) return {}
26
- const angle = (props.index / props.itemProps.totalItems) * 2 * Math.PI
27
- const radius = 80
31
+ if (!is_active.value || !optionsHeight.value) {
32
+ return {}
33
+ }
34
+ const angle = (index / itemProps.totalItems) * 2 * Math.PI
35
+ const radius = RADIUS
28
36
  const absoluteButtonY = menuStore.menuY + Math.sin(angle) * radius
29
- const h = optionsHeight.value
30
- const margin = 20
31
- let dy = 0
32
-
33
- if (absoluteButtonY - h / 2 < margin) {
34
- dy = margin - (absoluteButtonY - h / 2)
35
- } else if (absoluteButtonY + h / 2 > menuStore.containerHeight - margin) {
36
- dy = menuStore.containerHeight - margin - (absoluteButtonY + h / 2)
37
+ const height = optionsHeight.value
38
+ const margin = MARGIN
39
+ let offsetY = 0
40
+
41
+ if (absoluteButtonY - height / 2 < margin) {
42
+ offsetY = margin - (absoluteButtonY - height / 2)
43
+ } else if (
44
+ absoluteButtonY + height / 2 >
45
+ menuStore.containerHeight - margin
46
+ ) {
47
+ offsetY =
48
+ menuStore.containerHeight - margin - (absoluteButtonY + height / 2)
37
49
  }
38
- return { top: `calc(50% + ${dy}px)` }
50
+ return { top: `calc(50% + ${offsetY}px)` }
39
51
  })
40
52
 
41
53
  const optionsClass = computed(() => {
42
- const loc = props.itemProps.tooltip_location
43
- const cardWidth = 320
44
- const margin = 60
45
- const radius = 80
54
+ const loc = itemProps.tooltip_location
55
+ const margin = MARGIN
56
+ const radius = RADIUS
46
57
  if (loc === "right") {
47
- return menuStore.menuX + radius + margin + cardWidth >
58
+ return menuStore.menuX + radius + margin + CARD_WIDTH >
48
59
  menuStore.containerWidth
49
60
  ? "options-left"
50
61
  : "options-right"
51
62
  }
52
- return menuStore.menuX - radius - margin - cardWidth < 0
63
+ return menuStore.menuX - radius - margin - CARD_WIDTH < 0
53
64
  ? "options-right"
54
65
  : "options-left"
55
66
  })
56
67
 
57
- const toggleOptions = () => menuStore.toggleItemOptions(props.index)
68
+ function toggleOptions() {
69
+ menuStore.toggleItemOptions(index)
70
+ }
58
71
  </script>
59
72
  <template>
60
73
  <v-sheet class="menu-item-container transition-swing" color="transparent">
61
74
  <v-tooltip
62
- :location="props.itemProps.tooltip_location"
63
- :origin="props.itemProps.tooltip_origin"
75
+ :location="itemProps.tooltip_location"
76
+ :origin="itemProps.tooltip_origin"
64
77
  >
65
78
  <template v-slot:activator="{ props: tooltipProps }">
66
79
  <v-btn
@@ -74,7 +87,7 @@
74
87
  <v-img :src="btn_image" height="28" width="28" />
75
88
  </v-btn>
76
89
  </template>
77
- <span>{{ props.tooltip }}</span>
90
+ <span>{{ tooltip }}</span>
78
91
  </v-tooltip>
79
92
 
80
93
  <v-sheet
@@ -86,11 +99,7 @@
86
99
  color="transparent"
87
100
  @click.stop
88
101
  >
89
- <OptionCard
90
- :title="props.tooltip"
91
- width="320"
92
- :max-height="maxCardHeight"
93
- >
102
+ <OptionCard :title="tooltip" width="320" :max-height="maxCardHeight">
94
103
  <slot name="options" />
95
104
  </OptionCard>
96
105
  </v-sheet>
@@ -1,15 +1,15 @@
1
1
  <script setup>
2
- import ViewerGenericMeshPointsOptions from "@ogw_front/components/Viewer/Generic/Mesh/PointsOptions"
3
2
  import EdgedCurvePoints from "@ogw_front/assets/viewer_svgs/edged_curve_points.svg"
3
+ import ViewerGenericMeshPointsOptions from "@ogw_front/components/Viewer/Generic/Mesh/PointsOptions"
4
4
 
5
- const props = defineProps({
5
+ const { itemProps } = defineProps({
6
6
  itemProps: { type: Object, required: true },
7
7
  })
8
8
  </script>
9
9
 
10
10
  <template>
11
11
  <ViewerGenericMeshPointsOptions
12
- :itemProps="props.itemProps"
12
+ :itemProps="itemProps"
13
13
  :btn_image="EdgedCurvePoints"
14
14
  />
15
15
  </template>
@@ -1,8 +1,8 @@
1
1
  <script setup>
2
+ import EdgedCurveEdges from "@ogw_front/assets/viewer_svgs/edged_curve_edges.svg"
2
3
  import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenuItem"
3
- import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch"
4
4
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector"
5
- import EdgedCurveEdges from "@ogw_front/assets/viewer_svgs/edged_curve_edges.svg"
5
+ import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch"
6
6
 
7
7
  import { useDataStyleStore } from "@ogw_front/stores/data_style"
8
8
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
@@ -10,11 +10,11 @@
10
10
  const dataStyleStore = useDataStyleStore()
11
11
  const hybridViewerStore = useHybridViewerStore()
12
12
 
13
- const props = defineProps({
13
+ const { itemProps } = defineProps({
14
14
  itemProps: { type: Object, required: true },
15
15
  })
16
16
 
17
- const id = toRef(() => props.itemProps.id)
17
+ const id = toRef(() => itemProps.id)
18
18
 
19
19
  const visibility = computed({
20
20
  get: () => dataStyleStore.meshEdgesVisibility(id.value),
@@ -102,7 +102,7 @@
102
102
  </script>
103
103
  <template>
104
104
  <ViewerContextMenuItem
105
- :itemProps="props.itemProps"
105
+ :itemProps="itemProps"
106
106
  tooltip="Edges options"
107
107
  :btn_image="EdgedCurveEdges"
108
108
  >
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenuItem"
3
- import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch"
4
3
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector"
4
+ import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch"
5
5
 
6
6
  import { useDataStyleStore } from "@ogw_front/stores/data_style"
7
7
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
@@ -9,13 +9,13 @@
9
9
  const dataStyleStore = useDataStyleStore()
10
10
  const hybridViewerStore = useHybridViewerStore()
11
11
 
12
- const props = defineProps({
12
+ const { itemProps, btn_image, tooltip } = defineProps({
13
13
  itemProps: { type: Object, required: true },
14
14
  btn_image: { type: String, required: true },
15
15
  tooltip: { type: String, required: false, default: "Cells options" },
16
16
  })
17
17
 
18
- const id = toRef(() => props.itemProps.id)
18
+ const id = toRef(() => itemProps.id)
19
19
 
20
20
  const visibility = computed({
21
21
  get: () => dataStyleStore.meshCellsVisibility(id.value),
@@ -106,9 +106,9 @@
106
106
 
107
107
  <template>
108
108
  <ViewerContextMenuItem
109
- :itemProps="props.itemProps"
110
- :tooltip="props.tooltip"
111
- :btn_image="props.btn_image"
109
+ :itemProps="itemProps"
110
+ :tooltip="tooltip"
111
+ :btn_image="btn_image"
112
112
  >
113
113
  <template #options>
114
114
  <ViewerOptionsVisibilitySwitch v-model="visibility" />