Skip to content

Commit 1674a7c

Browse files
wip(screenshot): component to call take_screenshot rpc
1 parent 0baf76b commit 1674a7c

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

components/Screenshot.vue

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<template>
2+
<v-dialog
3+
v-model="props.show_dialog"
4+
@click:outside="emit('close')"
5+
max-width="800px"
6+
class="text-center"
7+
>
8+
<v-sheet border="md">
9+
<v-card color="#3c9983">
10+
<v-card-title>
11+
<h3 class="mt-4">Take a screenshot</h3>
12+
</v-card-title>
13+
<v-card-text>
14+
<v-container>
15+
<v-row>
16+
<v-col cols="8">
17+
<v-text-field
18+
v-model="filename"
19+
label="File name"
20+
></v-text-field>
21+
</v-col>
22+
<v-col cols="4">
23+
<v-select
24+
v-model="output_extension"
25+
:items="['png', 'jpg']"
26+
label="Extension"
27+
required
28+
/>
29+
</v-col>
30+
</v-row>
31+
32+
<v-row>
33+
<v-col cols="12">
34+
<v-switch
35+
v-model="include_background"
36+
label="Include background"
37+
inset
38+
></v-switch>
39+
</v-col>
40+
</v-row>
41+
</v-container>
42+
</v-card-text>
43+
<v-card-actions justify-center>
44+
<v-btn
45+
variant="outlined"
46+
color="white"
47+
text
48+
@click="emit('close')"
49+
class="ml-8 mb-4"
50+
>Cancel</v-btn
51+
>
52+
<v-btn
53+
variant="outlined"
54+
class="mb-4"
55+
color="white"
56+
text
57+
@click="takeScreenshot()"
58+
>Load</v-btn
59+
>
60+
</v-card-actions>
61+
</v-card>
62+
</v-sheet>
63+
</v-dialog>
64+
</template>
65+
66+
<script setup>
67+
const emit = defineEmits(["close"]);
68+
import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json";
69+
70+
const props = defineProps({
71+
show_dialog: { type: Boolean, required: true },
72+
});
73+
74+
const filename = ref("");
75+
const output_extension = ref("png");
76+
const include_background = ref(true);
77+
78+
async function takeScreenshot() {
79+
console.log("screenshot");
80+
81+
await viewer_call({
82+
schema: viewer_schemas.opengeodeweb_viewer.take_screenshot,
83+
params: {
84+
filename: filename.value,
85+
output_extension: output_extension.value,
86+
include_background: include_background.value,
87+
},
88+
});
89+
90+
emit("close");
91+
}
92+
</script>

0 commit comments

Comments
 (0)