|
1 | 1 | <template> |
2 | | - <v-dialog |
3 | | - v-model="props.show_dialog" |
4 | | - @click:outside="emit('close')" |
5 | | - max-width="800px" |
6 | | - class="text-center" |
| 2 | + <v-sheet |
| 3 | + v-if="props.show_dialog" |
| 4 | + :width="props.width + 'px'" |
| 5 | + class="screenshot_menu" |
| 6 | + border="md" |
7 | 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="output_extensions" |
26 | | - label="Extension" |
27 | | - required |
28 | | - /> |
29 | | - </v-col> |
30 | | - </v-row> |
| 8 | + <v-card color="#3c9983" class="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> |
31 | 27 |
|
32 | | - <v-row> |
33 | | - <v-col cols="12"> |
34 | | - <v-switch |
35 | | - v-model="include_background" |
36 | | - :disabled="output_extension !== 'png'" |
37 | | - label="Include background" |
38 | | - inset |
39 | | - ></v-switch> |
40 | | - </v-col> |
41 | | - </v-row> |
42 | | - </v-container> |
43 | | - </v-card-text> |
44 | | - <v-card-actions justify-center> |
45 | | - <v-btn |
46 | | - variant="outlined" |
47 | | - color="white" |
48 | | - text |
49 | | - @click="emit('close')" |
50 | | - class="ml-8 mb-4" |
51 | | - >Cancel</v-btn |
52 | | - > |
53 | | - <v-btn |
54 | | - variant="outlined" |
55 | | - class="mb-4" |
56 | | - :disabled="!filename || !output_extension" |
57 | | - color="white" |
58 | | - text |
59 | | - @click="takeScreenshot()" |
60 | | - >Screenshot</v-btn |
61 | | - > |
62 | | - </v-card-actions> |
63 | | - </v-card> |
64 | | - </v-sheet> |
65 | | - </v-dialog> |
| 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 | + >Cancel</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> |
66 | 61 | </template> |
67 | 62 |
|
68 | 63 | <script setup> |
69 | 64 | import fileDownload from "js-file-download" |
| 65 | + import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json" |
70 | 66 |
|
71 | 67 | const emit = defineEmits(["close"]) |
72 | | - import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json" |
73 | 68 |
|
74 | 69 | const props = defineProps({ |
75 | 70 | show_dialog: { type: Boolean, required: true }, |
| 71 | + offset_top: { type: Number, required: true }, |
| 72 | + offset_left: { type: Number, required: true }, |
| 73 | + width: { type: Number, required: false, default: 400 }, |
76 | 74 | }) |
77 | 75 |
|
| 76 | + console.log("props", props) |
| 77 | +
|
78 | 78 | const output_extensions = |
79 | 79 | viewer_schemas.opengeodeweb_viewer.take_screenshot.properties |
80 | 80 | .output_extension.enum |
|
109 | 109 | include_background.value = true |
110 | 110 | } |
111 | 111 | }) |
| 112 | +
|
| 113 | + const top = computed(() => { |
| 114 | + console.log("props.offset_top", props.offset_top) |
| 115 | +
|
| 116 | + return props.offset_top + "px" |
| 117 | + }) |
| 118 | + const right = computed(() => { |
| 119 | + console.log("props.offset_left", props.offset_left) |
| 120 | + console.log("props.width", props.width) |
| 121 | +
|
| 122 | + return "200px" // Change this value to adjust the position relative to the mdi-camera icon |
| 123 | + }) |
| 124 | +
|
| 125 | + console.log("top", top) |
| 126 | + console.log("left", left) |
112 | 127 | </script> |
| 128 | + |
| 129 | +<style scoped> |
| 130 | + .screenshot_menu { |
| 131 | + position: absolute; |
| 132 | + z-index: 2; |
| 133 | + right: v-bind("right"); |
| 134 | + top: v-bind("top"); |
| 135 | + } |
| 136 | +</style> |
0 commit comments