Changeset 35959
- Timestamp:
- 2022-01-11T14:46:55+13:00 (2 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/ocr/src/components
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/ocr/src/components/ImageMagnifier.vue
r35958 r35959 3 3 4 4 export default { 5 name: " OcrImageDisplay",5 name: "ImageMagnifier", 6 6 props: { 7 7 imageUrl: String, … … 139 139 <div ref="magContainer" class="image-container"> 140 140 <div ref="magnifier" class="magnifier" @mousemove="moveMagnifier" :style="{ 'visibility': enableMagnifier ? 'visible' : 'collapse' }" /> 141 <img v-if="!showThresholdedImage"ref="imageRef" class="image" :src="imageUrl" />141 <img ref="imageRef" class="image" :src="imageUrl" /> 142 142 </div> 143 143 </template> -
main/trunk/model-interfaces-dev/atea/ocr/src/components/MainPage.vue
r35958 r35959 2 2 import { mapState } from "vuex"; 3 3 import EditPage from "./editor/EditPage.vue"; 4 import OcrImageDisplayfrom "./ImageMagnifier.vue"4 import ImageMagnifier from "./ImageMagnifier.vue" 5 5 import { ModalController } from "./ModalDialog.vue" 6 6 import { SnackController } from "./Snackbar.vue" … … 14 14 components: { 15 15 EditPage, 16 OcrImageDisplay16 ImageMagnifier 17 17 }, 18 18 data() { … … 71 71 }, 72 72 methods: { 73 uploadFile() {73 openFilePicker() { 74 74 this.$refs.fileInput.click(); 75 75 }, … … 83 83 this.imageBuffer = await files[0].arrayBuffer(); 84 84 this.imageType = files[0].type; 85 }, 86 /** 87 * Invoked when a drop event occurs on the file upload panel. 88 * @param {DragEvent} ev The drop event. 89 */ 90 async onFilesDropped(ev) { 91 ev.preventDefault(); 92 93 if (ev.dataTransfer.items && ev.dataTransfer.items.length > 0) { 94 let index = 0; 95 while (ev.dataTransfer.items[index].kind !== "file") { 96 index++; 97 } 98 99 const file = ev.dataTransfer.items[0].getAsFile(); 100 this.imageBuffer = await file.arrayBuffer(); 101 this.imageType = file.type; 102 } 103 else if (ev.dataTransfer.files.length > 0) { 104 const file = ev.dataTransfer.files[0]; 105 this.imageBuffer = await file.arrayBuffer(); 106 this.imageType = file.type; 107 } 85 108 }, 86 109 … … 228 251 229 252 <div class="paper root-container" :class="{ 'root-container-image-state': imageUrl !== null }"> 230 <div v-if="imageUrl === null" class="upload-area" @click="uploadFile"> 253 <div v-if="imageUrl === null" class="upload-area" 254 @click="openFilePicker" @drop="onFilesDropped" @dragover="$event.preventDefault()"> 231 255 <span class="heading1">{{ translations.get("Title") }}</span> 232 256 <span class="material-icons mdi-xl">upload_file</span> … … 293 317 294 318 <div class="main-content-columns"> 295 < ocr-image-display319 <image-magnifier 296 320 v-if="!showThresholdedImage" 297 321 :imageUrl="imageUrl" … … 299 323 :magnifierZoom="magnifierZoom" /> 300 324 301 < ocr-image-display325 <image-magnifier 302 326 v-else 303 327 :imageUrl="thresholdedImageUrl" … … 312 336 :disabled="!isValidOcrResult || ocrInProgress" 313 337 autocomplete="off" 314 :spellcheck="enableSpellcheck" />338 :spellcheck="enableSpellcheck" /> 315 339 </div> 316 340 </div>
Note:
See TracChangeset
for help on using the changeset viewer.