Skip to content

Commit 7d15e81

Browse files
Merge pull request #156 from Geode-solutions/next
Next
2 parents 0baf76b + 447ee46 commit 7d15e81

File tree

7 files changed

+172
-28
lines changed

7 files changed

+172
-28
lines changed

components/FileUploader.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
4545
const { multiple, accept } = toRefs(props)
4646
47-
const label = multiple ? "Please select file(s)" : "Please select a file"
47+
const label = multiple
48+
? "Please select file(s) to import"
49+
: "Please select a file to import"
4850
const files = ref([])
4951
const loading = ref(false)
5052
const files_uploaded = ref(false)

components/ObjectSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<FetchingData v-if="loading" />
33
<v-row v-else-if="Object.keys(allowed_objects).length" class="justify-left">
4-
<v-col v-for="(value, key) in allowed_objects" :key="key" cols="2" md="2">
4+
<v-col v-for="(value, key) in allowed_objects" :key="key" cols="2" md="4">
55
<v-tooltip
66
:text="
77
value['is_loadable']

components/RemoteRenderingView.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
class="pa-0"
2727
@click="get_x_y"
2828
@keydown.esc="app_store.toggle_picking_mode(false)"
29-
/>
29+
>
30+
<slot name="ui"></slot>
31+
</v-col>
3032
</div>
3133
</ClientOnly>
3234
</template>

components/Screenshot.vue

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<template>
2+
<v-sheet
3+
v-if="props.show_dialog"
4+
:width="props.width + 'px'"
5+
class="screenshot_menu"
6+
border="md"
7+
>
8+
<v-card class="bg-primary pa-0">
9+
<v-card-title>
10+
<h3 class="mt-4">Take a screenshot</h3>
11+
</v-card-title>
12+
<v-card-text class="pa-0">
13+
<v-container>
14+
<v-row>
15+
<v-col cols="8" class="py-0">
16+
<v-text-field v-model="filename" label="File name"></v-text-field>
17+
</v-col>
18+
<v-col cols="4" class="py-0">
19+
<v-select
20+
v-model="output_extension"
21+
:items="output_extensions"
22+
label="Extension"
23+
required
24+
/>
25+
</v-col>
26+
</v-row>
27+
28+
<v-row>
29+
<v-col cols="12" class="py-0">
30+
<v-switch
31+
v-model="include_background"
32+
:disabled="output_extension !== 'png'"
33+
label="Include background"
34+
inset
35+
></v-switch>
36+
</v-col>
37+
</v-row>
38+
</v-container>
39+
</v-card-text>
40+
<v-card-actions justify-center>
41+
<v-btn
42+
variant="outlined"
43+
color="white"
44+
text
45+
@click="emit('close')"
46+
class="ml-8 mb-4"
47+
>Close</v-btn
48+
>
49+
<v-btn
50+
variant="outlined"
51+
class="mb-4"
52+
:disabled="!filename || !output_extension"
53+
color="white"
54+
text
55+
@click="takeScreenshot()"
56+
>Screenshot</v-btn
57+
>
58+
</v-card-actions>
59+
</v-card>
60+
</v-sheet>
61+
</template>
62+
63+
<script setup>
64+
import fileDownload from "js-file-download"
65+
import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json"
66+
67+
const emit = defineEmits(["close"])
68+
69+
const props = defineProps({
70+
show_dialog: { type: Boolean, required: true },
71+
width: { type: Number, required: false, default: 400 },
72+
})
73+
74+
const output_extensions =
75+
viewer_schemas.opengeodeweb_viewer.take_screenshot.properties
76+
.output_extension.enum
77+
const filename = ref("")
78+
const output_extension = ref("png")
79+
const include_background = ref(true)
80+
81+
async function takeScreenshot() {
82+
await viewer_call(
83+
{
84+
schema: viewer_schemas.opengeodeweb_viewer.take_screenshot,
85+
params: {
86+
filename: filename.value,
87+
output_extension: output_extension.value,
88+
include_background: include_background.value,
89+
},
90+
},
91+
{
92+
response_function: async (response) => {
93+
fileDownload(
94+
response.blob,
95+
filename.value + "." + output_extension.value,
96+
)
97+
},
98+
},
99+
)
100+
emit("close")
101+
}
102+
103+
watch(output_extension, (value) => {
104+
if (value !== "png") {
105+
include_background.value = true
106+
}
107+
})
108+
</script>
109+
110+
<style scoped>
111+
.screenshot_menu {
112+
position: absolute;
113+
z-index: 2;
114+
top: 90px;
115+
right: 55px;
116+
}
117+
</style>

components/ViewToolbar.vue

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,48 @@
11
<template>
2-
<v-row dense :class="[$style.floatToolbar, 'flex-column']">
3-
<v-col>
4-
<v-btn
5-
density="comfortable"
6-
icon
7-
@click.stop="reset_camera"
8-
v-tooltip:left="'Reset camera'"
9-
>
10-
<v-icon icon="mdi-cube-scan" size="32" />
11-
</v-btn>
12-
</v-col>
13-
</v-row>
2+
<v-container :class="[$style.floatToolbar, 'pa-0']" width="auto">
3+
<v-row
4+
v-for="camera_option in camera_options"
5+
:key="camera_option.icon"
6+
dense
7+
>
8+
<v-col>
9+
<v-btn
10+
density="comfortable"
11+
icon
12+
@click.stop="camera_option.action"
13+
v-tooltip:left="camera_option.tooltip"
14+
>
15+
<v-icon :icon="camera_option.icon" size="32" />
16+
</v-btn>
17+
</v-col>
18+
</v-row>
19+
</v-container>
20+
<Screenshot :show_dialog="take_screenshot" @close="take_screenshot = false" />
1421
</template>
1522

1623
<script setup>
1724
import schemas from "@geode/opengeodeweb-viewer/schemas.json"
1825
19-
function reset_camera() {
20-
viewer_call({
21-
schema: schemas.opengeodeweb_viewer.reset_camera,
22-
})
23-
}
26+
const take_screenshot = ref(false)
27+
28+
const camera_options = [
29+
{
30+
tooltip: "Reset camera",
31+
icon: "mdi-cube-scan",
32+
action: () => {
33+
viewer_call({
34+
schema: schemas.opengeodeweb_viewer.reset_camera,
35+
})
36+
},
37+
},
38+
{
39+
tooltip: "Take a screenshot",
40+
icon: "mdi-camera",
41+
action: () => {
42+
take_screenshot.value = !take_screenshot.value
43+
},
44+
},
45+
]
2446
</script>
2547

2648
<style module>
@@ -29,7 +51,6 @@
2951
z-index: 2;
3052
right: 20px;
3153
top: 20px;
32-
background-color: rgba(0, 0, 0, 0.4);
33-
border-radius: 16px;
54+
background-color: rgba(0, 0, 0, 0);
3455
}
3556
</style>

nuxt.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ export default defineNuxtConfig({
3636
vite: {
3737
optimizeDeps: {
3838
include: [
39-
"is-electron",
40-
"fast-deep-equal",
41-
"seedrandom",
42-
"lodash",
4339
"ajv",
40+
"fast-deep-equal",
4441
"globalthis",
42+
"is-electron",
43+
"js-file-download",
44+
"lodash",
45+
"seedrandom",
4546
],
4647
},
4748
},

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"version": "0.0.0-semantically-released",
4141
"main": "./nuxt.config.js",
4242
"dependencies": {
43-
"@geode/opengeodeweb-back": "5.3.0",
44-
"@geode/opengeodeweb-viewer": "0.2.0",
43+
"@geode/opengeodeweb-back": "5.3.1",
44+
"@geode/opengeodeweb-viewer": "0.3.0",
4545
"@kitware/vtk.js": "30.3.1",
4646
"@mdi/font": "^7.4.47",
4747
"@pinia/nuxt": "^0.5.4",
@@ -50,6 +50,7 @@
5050
"@vueuse/nuxt": "^11.0.3",
5151
"ajv": "^8.17.1",
5252
"is-electron": "^2.2.2",
53+
"js-file-download": "^0.4.12",
5354
"pinia": "^2.2.2",
5455
"sass": "^1.77.8",
5556
"semver": "^7.6.3",

0 commit comments

Comments
 (0)