- Timestamp:
- 2021-09-23T15:07:13+12:00 (3 years ago)
- 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
r35454 r35455 20 20 </div> 21 21 22 <word-timing-selector :surroundingWords=" getSurroundingWords()" />22 <word-timing-selector :surroundingWords="surroundingWords" :word="selectedWord" :wordIndex="selectedIndex" /> 23 23 24 24 <div class="editor-controls"> … … 127 127 enableEditing: false, 128 128 words: [], 129 lastHighlightedWordIndex: 0 129 lastHighlightedWordIndex: 0, 130 selectedIndex: 0 130 131 } 131 132 }, … … 142 143 return this.$store.getters.transcriptionPlaybackLength(this.transcription.id); 143 144 }, 145 surroundingWords() { 146 return this.getSurroundingWords(this.selectedIndex); 147 }, 148 selectedWord() { 149 return this.words[this.selectedIndex]; 150 }, 144 151 ...mapState({ 145 152 playbackState: state => state.playbackState, … … 151 158 await AudioPlayback.play(this.transcription.id, startTime); 152 159 }, 153 getSurroundingWords() { 154 return this.words.slice(2, 7); 160 getSurroundingWords(index) { 161 const BUFFER = 2; // The number of words to take on each side 162 163 let min = index; 164 for (let i = index; i > index - BUFFER && i > 0; i--) { 165 min--; 166 } 167 168 let max = index + 1; 169 for (let i = index; i < index + BUFFER && i < this.words.length; i++) { 170 max++; 171 } 172 173 const words = this.words.slice(min, max); 174 // words.splice(index - min, 1); // Remove the index word, as it is not a 'surrounding' word 175 176 return words; 155 177 }, 156 178 /** … … 180 202 const wordStartTime = this.words[index].startTime + 0.01; 181 203 this.$store.commit("playbackStateSetTime", { id: this.transcription.id, time: wordStartTime }); 204 this.selectedIndex = index; 182 205 }, 183 206 onEditorFocusOut(index) { … … 273 296 if (word.startTime < newValue && word.endTime > newValue) { 274 297 word.shouldHighlight = true; 298 299 if (this.$refs[word.id]) { 300 this.$refs[word.id].focus(); 301 } 302 275 303 this.lastHighlightedWordIndex = i; 276 304 break; -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue
r35454 r35455 62 62 surroundingWords: Array, 63 63 word: { word: String, startTime: Number, endTime: Number }, 64 wordIndex: Number, 64 65 upperBound: Number 65 66 },
Note:
See TracChangeset
for help on using the changeset viewer.