Changeset 35603


Ignore:
Timestamp:
2021-10-15T10:50:08+13:00 (3 years ago)
Author:
cstephen
Message:

Fix last

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

Legend:

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

    r35602 r35603  
    1212        <ul class="list-view" v-else>
    1313            <li v-for="(word, index) in words" :key="word.id" class="word-container">
    14                 <!-- :size="word.word.length === 0 ? 1 : word.word.length" -->
    15                 <input :ref="word.id"
     14                <input :size="word.word.length === 0 ? 1 : word.word.length" :ref="word.id"
    1615                    class="editor-word" v-model="word.word" type="text" :class="{ 'word-highlight-applied': word.shouldHighlight }"
    1716                    @beforeinput="onEditorBeforeInput($event, index)" @focusout="onEditorFocusOut(index)" @focus="onEditorFocus(index)" />
     
    2120    </div>
    2221
    23     <word-timing-selector class="word-timing-selector" v-model:surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" v-if="enableEditing" />
     22    <word-timing-selector class="word-timing-selector" :surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" @wordUpdated="onWordUpdated" v-if="enableEditing" />
    2423</div>
    2524</template>
     
    128127            }
    129128        },
    130         surroundingWords: {
    131             get() {
    132                 return this.getSurroundingWords(this.selectedIndex);
    133             },
    134             set(value) {
    135                 this.setSurroundingWords(this.selectedIndex, value);
    136             }
     129        surroundingWords() {
     130            return this.getSurroundingWords(this.selectedIndex);
    137131        },
    138132        ...mapState({
     
    208202
    209203        getSurroundingWords(index) {
    210             const BUFFER = 2; // The number of words to take on each side
     204            const BUFFER = 2; // The number of words to take on each side TODO: Global constant
    211205
    212206            const min = this.getSurroundingWordMinIndex(index, BUFFER);
     
    221215        },
    222216
    223         /**
    224          * Sets the backing value of the surrounding words variable.
    225          * @param {Number} index The index in the back array at which to update the words.
    226          * @param {Array<Word>} value The updated words.
    227          */
    228         setSurroundingWords(index, value) {
    229             const BUFFER = 2; // The number of words to take on each side TODO: Global constant
    230 
    231             const startIndex = this.getSurroundingWordMinIndex(index, BUFFER);
    232             console.log(this.words);
    233             this.words.splice(startIndex, value.length - 1, value);
    234             console.log(this.words);
     217        onWordUpdated(relativeIndex, word) {
     218            const BUFFER = 2; // The number of words to take on each side
     219
     220            const min = this.getSurroundingWordMinIndex(this.selectedIndex, BUFFER);
     221
     222            this.words[min + relativeIndex] = word;
    235223        },
    236224
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue

    r35602 r35603  
    123123        }
    124124    },
    125     emits: [ "update:surroundingWords" ],
     125    emits: [ "wordUpdated" ],
    126126    computed: {
    127127        word() {
     
    338338        },
    339339        updateSurroundingWords() {
    340             const updatedWords = [];
    341 
    342340            for (let i = 0; i < this.mySurroundingWords.length; i++) {
    343                 updatedWords.push(
    344                     this.convertMyWord(this.mySurroundingWords[i], this.surroundingWords[i])
    345                 );
    346             }
    347 
    348             console.log(updatedWords);
    349             this.$emit("update:surroundingWords", updatedWords);
     341                const updatedWord = this.convertMyWord(this.mySurroundingWords[i], this.surroundingWords[i]);
     342                this.$emit("wordUpdated", i, updatedWord);
     343            }
    350344        },
    351345        convertMyWord(myWord, actualWord) {
Note: See TracChangeset for help on using the changeset viewer.