Changeset 35957 for main/trunk


Ignore:
Timestamp:
2022-01-11T13:57:48+13:00 (2 years ago)
Author:
cstephen
Message:

Refactor OcrImageDisplay to act as a magnification container for an image

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/MainPage.vue

    r35956 r35957  
    294294            <div class="main-content-columns">
    295295                <ocr-image-display
     296                    v-if="!showThresholdedImage"
    296297                    :imageUrl="imageUrl"
    297                     :thresholdedImageUrl="thresholdedImageUrl"
    298298                    :enableMagnifier="enableMagnifier"
    299                     :magnifierZoom="magnifierZoom"
    300                     :showThresholdedImage="showThresholdedImage" />
     299                    :magnifierZoom="magnifierZoom" />
     300
     301                <ocr-image-display
     302                    v-else
     303                    :imageUrl="thresholdedImageUrl"
     304                    :enableMagnifier="enableMagnifier"
     305                    :magnifierZoom="magnifierZoom" />
    301306
    302307                <textarea
  • main/trunk/model-interfaces-dev/atea/ocr/src/components/OcrImageDisplay.vue

    r35956 r35957  
    66    props: {
    77        imageUrl: String,
    8         thresholdedImageUrl: String,
    98        enableMagnifier: Boolean,
    10         magnifierZoom: Number,
    11         showThresholdedImage: Boolean
     9        magnifierZoom: Number
    1210    },
    1311    data() {
     
    123121        imageUrl() {
    124122            setTimeout(() => {
    125                 this.updateMagnifier(this.$refs.ocrImage);
    126             }, 100);
    127         },
    128         thresholdedImageUrl() {
    129             if (!this.showThresholdedImage) {
    130                 return;
    131             }
    132 
    133             setTimeout(() => {
    134                 this.updateMagnifier(this.$refs.thresholdedImage);
    135             }, 100);
    136         },
    137         showThresholdedImage(newValue) {
    138             setTimeout(() => {
    139                 if (newValue) {
    140                     this.updateMagnifier(this.$refs.thresholdedImage);
    141                 }
    142                 else {
    143                     this.updateMagnifier(this.$refs.ocrImage);
    144                 }
     123                this.updateMagnifier(this.$refs.imageRef);
    145124            }, 100);
    146125        },
    147126        magnifierZoom() {
    148             if (this.showThresholdedImage) {
    149                 this.updateMagnifier(this.$refs.thresholdedImage);
    150             }
    151             else {
    152                 this.updateMagnifier(this.$refs.ocrImage);
    153             }
     127            this.updateMagnifier(this.$refs.imageRef);
    154128        }
    155129    },
    156130    mounted() {
    157131        setTimeout(() => {
    158             this.updateMagnifier(this.$refs.ocrImage);
     132            this.updateMagnifier(this.$refs.imageRef);
    159133        }, 100);
    160134    }
     
    163137
    164138<template>
    165 <div ref="magContainer" class="ocr-image-container">
     139<div ref="magContainer" class="image-container">
    166140    <div ref="magnifier" class="magnifier" @mousemove="moveMagnifier" :style="{ 'visibility': enableMagnifier ? 'visible' : 'collapse' }" />
    167     <img v-if="!showThresholdedImage" ref="ocrImage" class="ocr-image" :src="imageUrl" />
    168     <img v-if="showThresholdedImage" ref="thresholdedImage" class="ocr-image" :src="thresholdedImageUrl" />
     141    <img v-if="!showThresholdedImage" ref="imageRef" class="image" :src="imageUrl" />
    169142</div>
    170143</template>
    171144
    172145<style lang="scss" scoped>
    173 .ocr-image-container {
     146.image-container {
    174147    position: relative;
    175148
     
    189162}
    190163
    191 .ocr-image {
     164.image {
    192165    border: 1px solid #444;
    193166    max-width: 100%;
Note: See TracChangeset for help on using the changeset viewer.