Changeset 35779


Ignore:
Timestamp:
2021-12-09T13:18:40+13:00 (2 years ago)
Author:
cstephen
Message:

Improve magnifier, improve image controls layout

Location:
main/trunk/model-interfaces-dev/atea/ocr/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-interfaces-dev/atea/ocr/src/components/OcrImageDisplay.vue

    r35776 r35779  
    1313            /** @type {DOMRect} */
    1414            magnifierBounds: null,
    15             magnifierZoom: 1.5
     15            magnifierZoom: 1.5,
     16            showControls: false,
     17            enableMagnifier: false
    1618        }
    1719    },
     
    9193            // Convert the offset to valid CSS values
    9294            const actualX = imageX < 0
    93                 ? "0"
     95                ? `${(imageX * this.magnifierZoom * -1)}px`
    9496                : `-${(imageX * this.magnifierZoom)}px`
    9597
    9698            const actualY = imageY < 0
    97                 ? "0"
     99                ? `${(imageY * this.magnifierZoom * -1)}px`
    98100                : `-${(imageY * this.magnifierZoom)}px`
    99101
     
    147149                }
    148150            }, 100);
     151        },
     152        magnifierZoom() {
     153            if (this.showThresholdedImage) {
     154                this.updateMagnifier(this.$refs.thresholdedImage);
     155            }
     156            else {
     157                this.updateMagnifier(this.$refs.ocrImage);
     158            }
    149159        }
    150160    },
     
    160170<template>
    161171<div ref="magContainer" class="ocr-image-container">
    162     <div ref="magnifier" class="magnifier" @mousemove="moveMagnifier" />
     172    <div ref="magnifier" class="magnifier" @mousemove="moveMagnifier" :style="{ 'visibility': enableMagnifier ? 'visible' : 'collapse' }" />
    163173    <img ref="ocrImage" class="ocr-image" :src="imageUrl" />
    164174    <img v-if="showThresholdedImage" ref="thresholdedImage" class="ocr-image" :src="thresholdedImageUrl" />
    165175
    166     <div v-if="thresholdedImageUrl" class="thresholded-image-controls card">
    167         <input id="chk-show-thresholded-image" type="checkbox" v-model="showThresholdedImage" />
    168         <label for="chk-show-thresholded-image">{{ translations.get('MainPage_ShowThresholdedImage') }}</label>
    169 
    170         <span class="body2">{{ translations.get('MainPage_ThresholdedImageDescription') }}</span>
     176    <button class="control-tip btn-fab" @click="showControls = !showControls">
     177        <span class="material-icons mdi-l">settings</span>
     178    </button>
     179
     180    <div v-if="showControls" class="controls card">
     181        <button class="spacer btn-fab">
     182            <span class="material-icons mdi-l">settings</span>
     183        </button>
     184
     185        <div class="flex-h">
     186            <input id="chk-enable-magnifier" type="checkbox" v-model="enableMagnifier" />
     187            <label for="chk-enable-magnifier">{{ translations.get('OcrImageDisplay_EnableMagnifier') }}</label>
     188        </div>
     189
     190        <div class="flex-h">
     191            <span>1.5x</span>
     192            <input :disabled="!enableMagnifier" type="range" min="1.5" max="3" step="0.1" v-model="magnifierZoom" />
     193            <span>3x</span>
     194        </div>
     195
     196        <div v-if="thresholdedImageUrl" class="flex-h">
     197            <input id="chk-show-thresholded-image" type="checkbox" v-model="showThresholdedImage" />
     198            <label for="chk-show-thresholded-image">{{ translations.get('OcrImageDisplay_ShowThresholdedImage') }}</label>
     199        </div>
     200
     201        <span v-if="thresholdedImageUrl" class="body2">{{ translations.get('OcrImageDisplay_ThresholdedImageDescription') }}</span>
    171202    </div>
    172203</div>
     
    187218
    188219    &:hover {
    189         .thresholded-image-controls {
    190             opacity: 0.99;
     220        .control-tip {
     221            opacity: 1;
     222        }
     223
     224        .controls {
     225            opacity: 1;
    191226        }
    192227    }
     
    202237}
    203238
    204 .thresholded-image-controls {
     239.control-tip {
    205240    position: absolute;
    206     top: 1em;
    207     left: 1em;
     241    top: 0.5em;
     242    left: 0.5em;
     243
     244    opacity: 0;
     245    z-index: 3;
     246}
     247
     248.controls {
     249    position: absolute;
     250    left: 0.2em;
     251    top: 0.2em;
    208252    max-width: 50%;
    209253
    210     display: grid;
    211     grid-template-columns: auto 1fr;
    212     grid-template-rows: auto auto;
    213     align-items: center;
    214     justify-items: start;
     254    display: flex;
     255    flex-direction: column;
    215256    gap: 0.5em;
    216257
    217258    transition-duration: var(--transition-duration);
    218259    opacity: 0;
     260    z-index: 2;
     261
     262    .spacer {
     263        visibility: hidden;
     264    }
    219265
    220266    span {
     
    228274    height: 175px;
    229275
     276    background-color: white;
    230277    background-repeat: no-repeat;
    231278    border: 2px solid #000;
  • main/trunk/model-interfaces-dev/atea/ocr/src/styles/_material.scss

    r35751 r35779  
    460460}
    461461
     462/* Helpers */
     463
     464.flex-h {
     465    display: flex;
     466    align-items: center;
     467    gap: 0.5em;
     468}
     469
    462470/* === Start Theme Definitions === */
    463471
Note: See TracChangeset for help on using the changeset viewer.