@geode/opengeodeweb-front 9.3.1 → 9.3.2

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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ClientOnly>
3
- <div style="position: relative; width: 100%; height: 100%">
3
+ <div style="position: relative; width: 100%; height: calc(100vh - 80px)">
4
4
  <view-toolbar />
5
5
  <slot name="ui"></slot>
6
6
  <v-col
@@ -22,12 +22,17 @@
22
22
 
23
23
  <script setup>
24
24
  import vtkRemoteView from "@kitware/vtk.js/Rendering/Misc/RemoteView"
25
- import { useElementSize } from "@vueuse/core"
25
+ import { useElementSize, useWindowSize } from "@vueuse/core"
26
26
  import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json"
27
27
 
28
28
  const viewer_store = use_viewer_store()
29
29
  const { client, is_running, picking_mode } = storeToRefs(viewer_store)
30
30
 
31
+ const viewer = ref(null)
32
+ const { width, height } = useElementSize(viewer)
33
+
34
+ const { width: windowWidth, height: windowHeight } = useWindowSize()
35
+
31
36
  function get_x_y(event) {
32
37
  if (picking_mode.value === true) {
33
38
  const { offsetX, offsetY } = event
@@ -43,36 +48,38 @@
43
48
  viewId: { type: String, default: "-1" },
44
49
  })
45
50
 
46
- const viewer = ref(null)
47
- const { width, height } = useElementSize(viewer)
48
-
49
- function resize() {
50
- view.getCanvasView().setSize(0, 0)
51
- view.resize()
52
- }
53
-
54
- watch(picking_mode, (value) => {
55
- const cursor = value == true ? "crosshair" : "pointer"
56
- view.getCanvasView().setCursor(cursor)
57
- })
58
- watch(width, (value) => {
59
- resize()
60
- })
61
- watch(height, (value) => {
62
- resize()
63
- })
64
51
  const { viewId } = toRefs(props)
65
52
  const connected = ref(false)
66
53
 
67
54
  const view = vtkRemoteView.newInstance({
68
55
  rpcWheelEvent: "viewport.mouse.zoom.wheel",
69
56
  })
70
- // default of 0.5 causes 2x size labels on high-DPI screens. 1 good for demo, not for production.
57
+
71
58
  if (location.hostname.split(".")[0] === "localhost") {
72
59
  view.setInteractiveRatio(1)
73
60
  }
74
61
 
75
- watch(client, (new_client) => {
62
+ function resize() {
63
+ if (view) {
64
+ view.getCanvasView().setSize(0, 0)
65
+ view.resize()
66
+ }
67
+ }
68
+
69
+ watch([windowWidth, windowHeight], () => {
70
+ resize()
71
+ })
72
+
73
+ watch(picking_mode, (value) => {
74
+ const cursor = value ? "crosshair" : "pointer"
75
+ view.getCanvasView().setCursor(cursor)
76
+ })
77
+
78
+ watch([width, height], () => {
79
+ resize()
80
+ })
81
+
82
+ watch(client, () => {
76
83
  connect()
77
84
  })
78
85
 
@@ -83,16 +90,6 @@
83
90
  }
84
91
  })
85
92
 
86
- onMounted(async () => {
87
- if (process.client) {
88
- window.addEventListener("resize", resize)
89
- await nextTick()
90
- view.setContainer(viewer.value.$el)
91
- connect()
92
- resize()
93
- }
94
- })
95
-
96
93
  function connect() {
97
94
  if (!is_running.value) {
98
95
  return
@@ -103,6 +100,16 @@
103
100
  connected.value = true
104
101
  view.render()
105
102
  }
103
+
104
+ onMounted(async () => {
105
+ if (process.client) {
106
+ window.addEventListener("resize", resize)
107
+ await nextTick()
108
+ view.setContainer(viewer.value.$el)
109
+ connect()
110
+ resize()
111
+ }
112
+ })
106
113
  </script>
107
114
 
108
115
  <style scoped>
package/package.json CHANGED
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "description": "OpenSource Vue/Vuetify framework for web applications",
38
38
  "type": "module",
39
- "version": "9.3.1",
39
+ "version": "9.3.2",
40
40
  "main": "./nuxt.config.js",
41
41
  "dependencies": {
42
42
  "@geode/opengeodeweb-back": "5.4.0",
@@ -123,6 +123,7 @@ describe("FileSelector.vue", async () => {
123
123
  await flushPromises()
124
124
 
125
125
  const file_uploader = wrapper.findComponent(FileUploader)
126
+ console.log("wrapper", wrapper)
126
127
  expect(wrapper.vm.props.files).toEqual(files)
127
128
  const upload_files = vi.spyOn(file_uploader.vm, "upload_files")
128
129
  expect(upload_files).not.toHaveBeenCalled()