Skip to content

Commit ea58d5f

Browse files
2 parents b3b44bc + 576709f commit ea58d5f

File tree

4 files changed

+69
-84
lines changed

4 files changed

+69
-84
lines changed

components/RemoteRenderingView.vue

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<ClientOnly>
3-
<div style="position: relative; width: 100%; height: 100%">
3+
<div style="position: relative; width: 100%; height: calc(100vh - 80px)">
44
<view-toolbar />
55
<slot name="ui"></slot>
66
<v-col
@@ -22,12 +22,17 @@
2222

2323
<script setup>
2424
import vtkRemoteView from "@kitware/vtk.js/Rendering/Misc/RemoteView"
25-
import { useElementSize } from "@vueuse/core"
25+
import { useElementSize, useWindowSize } from "@vueuse/core"
2626
import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json"
2727
2828
const viewer_store = use_viewer_store()
2929
const { client, is_running, picking_mode } = storeToRefs(viewer_store)
3030
31+
const viewer = ref(null)
32+
const { width, height } = useElementSize(viewer)
33+
34+
const { width: windowWidth, height: windowHeight } = useWindowSize()
35+
3136
function get_x_y(event) {
3237
if (picking_mode.value === true) {
3338
const { offsetX, offsetY } = event
@@ -43,36 +48,38 @@
4348
viewId: { type: String, default: "-1" },
4449
})
4550
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-
})
6451
const { viewId } = toRefs(props)
6552
const connected = ref(false)
6653
6754
const view = vtkRemoteView.newInstance({
6855
rpcWheelEvent: "viewport.mouse.zoom.wheel",
6956
})
70-
// default of 0.5 causes 2x size labels on high-DPI screens. 1 good for demo, not for production.
57+
7158
if (location.hostname.split(".")[0] === "localhost") {
7259
view.setInteractiveRatio(1)
7360
}
7461
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, () => {
7683
connect()
7784
})
7885
@@ -83,16 +90,6 @@
8390
}
8491
})
8592
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-
9693
function connect() {
9794
if (!is_running.value) {
9895
return
@@ -103,6 +100,16 @@
103100
connected.value = true
104101
view.render()
105102
}
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+
})
106113
</script>
107114

108115
<style scoped>

components/Step.vue

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<v-stepper-content :step="step_index + 1">
33
<v-row
44
align="center"
5-
class="step-container"
5+
class="mb-4 py-2"
66
@click="set_current_step(step_index)"
77
>
8-
<v-col cols="auto" class="icon-container">
8+
<v-col cols="auto" class="d-flex justify-center align-center">
99
<v-icon
1010
v-if="current_step_index > step_index"
1111
icon="mdi-check-circle"
@@ -22,25 +22,29 @@
2222
color="grey"
2323
/>
2424
</v-col>
25-
<v-col class="title-container">
26-
<p class="step-title font-weight-bold">
25+
<v-col>
26+
<p class="m-0 font-weight-bold">
2727
{{ steps[step_index].step_title }}
2828
</p>
2929
</v-col>
30-
<v-col
30+
<v-chip-group
3131
v-if="
3232
steps[step_index].chips.length && current_step_index >= step_index
3333
"
34-
class="chips-container"
34+
column
35+
class="d-flex flex-wrap ma-2 overflow-y-auto"
36+
multiple
37+
style="max-height: 150px"
3538
>
3639
<v-chip
3740
v-for="(chip, chip_index) in steps[step_index].chips"
3841
:key="chip_index"
39-
class="step-chip"
42+
class="ma-1"
43+
:title="chip"
4044
>
41-
{{ chip }}
45+
{{ truncate(chip, 50) }}
4246
</v-chip>
43-
</v-col>
47+
</v-chip-group>
4448
</v-row>
4549
<component
4650
v-if="step_index == current_step_index"
@@ -55,6 +59,13 @@
5559
</template>
5660

5761
<script setup>
62+
function truncate(text, maxLength) {
63+
if (text.length > maxLength) {
64+
return text.slice(0, maxLength) + "..."
65+
}
66+
return text
67+
}
68+
5869
const props = defineProps({
5970
step_index: { type: Number, required: true },
6071
})
@@ -80,33 +91,3 @@
8091
stepper_tree.current_step_index--
8192
}
8293
</script>
83-
84-
<style scoped>
85-
.step-container {
86-
margin-bottom: 16px;
87-
padding: 8px;
88-
}
89-
90-
.icon-container {
91-
display: flex;
92-
justify-content: center;
93-
align-items: center;
94-
}
95-
96-
.title-container {
97-
margin-left: 8px;
98-
}
99-
100-
.step-title {
101-
margin: 0;
102-
}
103-
104-
.chips-container {
105-
display: flex;
106-
gap: 4px;
107-
}
108-
109-
.step-chip {
110-
background-color: #f5f5f5;
111-
}
112-
</style>

components/Stepper.vue

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<template>
2-
<v-stepper-vertical v-model="current_step_index" class="stepper-container">
2+
<v-stepper-vertical
3+
v-model="current_step_index"
4+
class="pa-4 ma-0"
5+
elevation="1"
6+
rounded
7+
>
38
<v-stepper-items>
4-
<Step v-for="(step, index) in steps" :key="step" :step_index="index" />
9+
<v-col cols="12">
10+
<Step v-for="(step, index) in steps" :key="step" :step_index="index" />
11+
</v-col>
512
</v-stepper-items>
613
</v-stepper-vertical>
714
</template>
@@ -10,14 +17,3 @@
1017
const stepper_tree = inject("stepper_tree")
1118
const { steps, current_step_index } = toRefs(stepper_tree)
1219
</script>
13-
14-
<style scoped>
15-
.stepper-container {
16-
max-width: 600px;
17-
margin: 0 auto;
18-
padding: 16px;
19-
background-color: #f9f9f9;
20-
border-radius: 8px;
21-
border: 1px solid #e0e0e0;
22-
}
23-
</style>

test/components/FileSelector.nuxt.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ describe("FileSelector.vue", async () => {
123123
await flushPromises()
124124

125125
const file_uploader = wrapper.findComponent(FileUploader)
126+
console.log("wrapper", wrapper)
126127
expect(wrapper.vm.props.files).toEqual(files)
127128
const upload_files = vi.spyOn(file_uploader.vm, "upload_files")
128129
expect(upload_files).not.toHaveBeenCalled()

0 commit comments

Comments
 (0)