Changeset 35508


Ignore:
Timestamp:
2021-09-28T15:37:44+13:00 (3 years ago)
Author:
cstephen
Message:

Attempt to make WordTimingSelector reactive to size changes.
Restyle colors

Location:
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/App.vue

    r35454 r35508  
    11<template>
    2     <div class="app-bar theme-primary-l1">
     2    <div class="app-bar theme-primary">
    33        <div class="app-bar-content">
    44            <span class="heading1">{{ translations.get("Title") }}</span>
    55
    6             <a class="btn-primary theme-accent" href="https://koreromaori.io" target="_blank">
     6            <a class="btn-primary theme-primary-l1" href="https://koreromaori.io" target="_blank">
    77                <span class="material-icons mdi-m">open_in_new</span>
    88                <u>koreromaori.io</u>
    99            </a>
    1010
    11             <toggle-button class="theme-accent" v-model="showInfo" :reverseState="true">
     11            <toggle-button class="theme-primary-l1" v-model="showInfo" :reverseState="true">
    1212                <span class="material-icons mdi-l">info</span>
    1313            </toggle-button>
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue

    r35506 r35508  
    1010        </ul>
    1111
    12         <ul class="list-view" v-if="enableEditing">
     12        <ul class="list-view" v-else>
    1313            <li v-for="(word, index) in words" :key="word.id" class="word-container">
    14                 <input :size="word.word.length <= 1 ? 1 : word.word.length - 1" :ref="word.id"
     14                <input :size="word.word.length" :ref="word.id"
    1515                    class="editor-word" v-model="word.word" type="text" onpaste="return false;" :class="{ 'word-highlight-applied': word.shouldHighlight }"
    1616                    @input="onEditorInput($event, index)" @focusout="onEditorFocusOut(index)" @keyup="onEditorKeyUp($event, index)" @focus="onEditorFocus(index)" />
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue

    r35506 r35508  
    33    <span>{{ minTimeString }}</span>
    44
    5     <div class="words-container" ref="wordsContainer">
     5    <div class="words-container" v-width="onWordsContainerWidthChanged">
    66        <div class="word" v-for="word in mySurroundingWords" :key="word.id" :style="{ left: `${word.left}px`, width: `${word.length}px` }"
    77            :class="{ 'hoisted': shouldHoist(word) }">
     
    112112            mySurroundingWords: [],
    113113            canShiftMinValue: false,
    114             canShiftMaxValue: false
     114            canShiftMaxValue: false,
     115            wordsContainerWidth: 0
    115116        }
    116117    },
     
    118119    computed: {
    119120        myWord() {
    120             console.log("updated");
    121             return this.convertWord(this.word);
     121            return this.mySurroundingWords[this.wordIndex];
    122122        },
    123123        minTimeString() {
     
    136136        },
    137137        leftHandleLeft() {
    138             return `calc(${this.getWord().left}px - 1em)`;
     138            return `calc(${this.myWord.left}px - 1em)`;
    139139        },
    140140        rightHandleLeft() {
    141             return `calc(${this.getWord().left}px + ${this.getWord().length}px)`;
     141            return `calc(${this.myWord.left}px + ${this.myWord.length}px)`;
    142142        },
    143143        wordIndex() {
     
    146146        audioSnippetLength() {
    147147            return this.surroundingWords[this.surroundingWords.length - 1].endTime - this.surroundingWords[0].startTime;
    148         },
    149         /**
    150          * Gets the amount of pixel space in which words can be position on-screen.
    151          */
    152         wordSpacePx() {
    153             if (!this.isMounted) {
    154                 return 0;
    155             }
    156             else {
    157                 return this.$refs.wordsContainer.offsetWidth;
    158             }
    159148        },
    160149        /**
     
    163152         */
    164153        scalingFactor() {
    165             return this.wordSpacePx / this.audioSnippetLength;
     154            return this.wordsContainerWidth / this.audioSnippetLength;
    166155        },
    167156        /**
     
    179168    },
    180169    methods: {
     170        onWordsContainerWidthChanged(newValue) {
     171            this.wordsContainerWidth = newValue;
     172        },
    181173        convertSurroundingWords() {
    182174            const myWords = [];
     
    200192        shouldHoist(word) {
    201193            return word.startTime === this.word.startTime && word.word === this.word.word;
    202         },
    203         getWord() {
    204             return this.mySurroundingWords[this.wordIndex];
    205194        },
    206195        /**
     
    212201            }
    213202
    214             const word = this.getWord();
     203            const word = this.myWord;
    215204
    216205            if (event.movementX < 0 && word.left + event.movementX < 0) {
     
    230219            }
    231220
    232             const word = this.getWord();
     221            const word = this.myWord;
    233222
    234223            const lastWord = this.mySurroundingWords[this.mySurroundingWords.length - 1];
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/main.js

    r35454 r35508  
    128128AudioPlayback.initialise(store);
    129129
    130 createApp(App)
    131     .use(store)
     130const app = createApp(App);
     131
     132app.use(store)
    132133    .component("ToggleButton", ToggleButton)
     134    .directive("width", {
     135        mounted(el, binding) {
     136            binding.value(el.offsetWidth);
     137
     138            window.addEventListener("resize", function() {
     139                binding.value(el.offsetWidth);
     140            });
     141        }
     142    })
    133143    .mount("#app");
    134144
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss

    r35505 r35508  
    1919    // For the paper style, but more generally the neutral background color
    2020    --paper-color: #FCFCFC;
     21
     22    --body-font-family: Arial, sans-serif;
    2123   
    2224    --primary-box-shadow: 0 2px 4px 0 #505050;
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/theme.scss

    r35505 r35508  
    44
    55@use "./_material.scss";
    6 @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:wght@300;400;700&display=swap');
     6@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap');
    77@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
    88
     
    2727    --primary-box-shadow: 0 2px 4px 0 #524545;
    2828    --primary-box-shadow-thin: 0 1px 3px 0 #685757;
     29
     30    --hover-brightness: 110%;
     31
     32    --body-font-family: Arial, "Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif;
    2933}
    3034
     
    3236    background-color: var(--page-bg-color);
    3337    color: var(--body-color);
    34     font-family: 'Roboto', sans-serif;
     38    font-family: var(--body-font-family);
    3539   
    3640    margin: 0;
Note: See TracChangeset for help on using the changeset viewer.