- Timestamp:
- 2021-10-20T11:49:36+13:00 (3 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/korero-maori-asr/src
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue
r35633 r35641 5 5 6 6 <div class="words-container" v-width="onWordsContainerWidthChanged"> 7 <div class="shadow-word" v-for="word in shadowWords" :key="word.id" :style="{ left: `${word.left}px`, width: `${word.length}px` }" 8 :class="{ 'shadow-hoisted': shouldHoist(word) }"> 9 <span>{{ word.word }}</span> 10 </div> 11 7 12 <div class="word" v-for="word in mySurroundingWords" :key="word.id" :style="{ left: `${word.left}px`, width: `${word.length}px` }" 8 13 :class="{ 'hoisted': shouldHoist(word) }"> … … 67 72 } 68 73 74 .shadow-word { 75 @extend .word; 76 77 opacity: 0.7; 78 color: #BBB; 79 background-color: #DDD; 80 border: 1px solid #AAA; 81 } 82 83 .hoisted { 84 top: -100%; 85 background-color: var(--highlighted-word-bg); 86 } 87 88 .shadow-hoisted { 89 @extend .hoisted; 90 91 background-color: #DDD; 92 } 93 69 94 .word-attachment-container { 70 95 position: absolute; … … 92 117 } 93 118 } 94 95 .hoisted {96 top: -100%;97 background-color: var(--highlighted-word-bg);98 }99 119 </style> 100 120 … … 104 124 105 125 class Word { 106 constructor( word, startTime, endTime, left, length) {107 this.id = Util.generateUuid();126 constructor(id, word, startTime, endTime, left, length) { 127 this.id = id; 108 128 this.word = word; 109 129 this.startTime = startTime; … … 131 151 canAdjustWordStartTime: false, 132 152 canAdjustWordEndTime: false, 133 wordsContainerWidth: 0 153 wordsContainerWidth: 0, 154 shadowWords: [] 134 155 } 135 156 }, … … 147 168 } 148 169 170 if (this.wordIndex === 0) { 171 return Util.formatSecondsTimeString(0, false, 2); 172 } 173 149 174 return Util.formatSecondsTimeString(this.surroundingWords[0].startTime, false, 2); 150 175 }, … … 152 177 if (this.surroundingWords.length === 0) { 153 178 return 0; 179 } 180 181 if (this.wordIndex === this.surroundingWords.length - 1) { 182 return Util.formatSecondsTimeString(this.$store.getters.transcriptionPlaybackLength(this.transcriptionID), false, 2); 154 183 } 155 184 … … 222 251 } 223 252 }, 253 watch: { 254 /** 255 * Watches for changes to the myWord computed property. 256 * Updates the shadow words. 257 * @param {Word} newValue The new word. 258 * @param {Word} oldValue The old word. 259 */ 260 myWord(newValue, oldValue) { 261 if (newValue.id === oldValue.id && this.shadowWords.length > 0) { 262 console.log(`New: ${newValue.id} | Old: ${oldValue.id}`); 263 return; 264 } 265 266 console.log("Updating"); 267 this.shadowWords = []; 268 for (const word of this.mySurroundingWords) { 269 this.shadowWords.push(word); 270 } 271 } 272 }, 224 273 methods: { 225 274 onWordsContainerWidthChanged(newValue) { … … 232 281 return time * this.scalingFactor - this.wordLeftOffsetPx; 233 282 }, 283 /** 284 * Converts a {@link TWord} to a {@link Word}. 285 * @param {TWord} word The word to convert. 286 */ 234 287 convertWord(word) { 235 288 const left = this.timeToPosition(word.startTime); 236 289 const length = (word.endTime - word.startTime) * this.scalingFactor; 237 290 238 return new Word(word. word, word.startTime, word.endTime, left, length);291 return new Word(word.id, word.word, word.startTime, word.endTime, left, length); 239 292 }, 240 293 shouldHoist(word) { 241 return word === this.myWord;294 return word.id === this.myWord.id; 242 295 }, 243 296 -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/theme.scss
r35508 r35641 16 16 --monospace-font: 1rem 'Roboto Mono', sans-serif; 17 17 --page-bg-color: #f7f4f0; 18 --highlighted-word-bg: rgb a(255, 255, 0, 0.4);18 --highlighted-word-bg: rgb(255, 255, 100); 19 19 20 20 --primary-bg-color-l1: 196, 36, 44;
Note:
See TracChangeset
for help on using the changeset viewer.