Changeset 35608 for main/trunk
- Timestamp:
- 2021-10-15T12:46:35+13: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
r35603 r35608 20 20 </div> 21 21 22 <word-timing-selector class="word-timing-selector" :surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" @wordUpdated="onWordUpdated" v-if="enableEditing" /> 22 <word-timing-selector class="word-timing-selector" @wordUpdated="onWordUpdated" v-if="enableEditing" 23 :surroundingWords="surroundingWords" :wordIndex="surroundingWordPrincipleIndex" /> 23 24 </div> 24 25 </template> -
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/WordTimingSelector.vue
r35604 r35608 119 119 canAdjustWordStartTime: false, 120 120 canAdjustWordEndTime: false, 121 wordsContainerWidth: 0, 122 isProduction: false 121 wordsContainerWidth: 0 123 122 } 124 123 }, … … 168 167 if (this.wordIndex !== 0) { 169 168 length -= this.surroundingWords[0].startTime; 169 } 170 171 // Gives 0.5s of time to play with while adjusting the last word. 172 if (this.wordIndex === this.surroundingWords.length - 1) { 173 length += 0.5; 170 174 } 171 175 … … 225 229 return word === this.myWord; 226 230 }, 231 227 232 onDocumentMouseMove(event) { 228 if (this.isProduction) {229 return;230 }231 232 233 if (this.canAdjustWordStartTime) { 233 234 this.onMinHandleMouseMove(event); … … 245 246 } 246 247 247 // const word = this.mySurroundingWords[this.wordIndex];248 249 // if (event.movementX < 0 && word.left + event.movementX < 0) {250 // return;251 // }252 253 // if (event.movementX > 0 && word.left + event.movementX >= word.right()) {254 // return;255 // }256 257 // word.left += event.movementX;258 // word.length -= event.movementX;259 260 248 this.adjustWordStartTime(event.movementX); 261 249 … … 267 255 } 268 256 269 const word = this.myWord; 270 271 const lastWord = this.mySurroundingWords[this.mySurroundingWords.length - 1]; 272 273 if (event.movementX > 0 && word.right() + event.movementX > lastWord.right()) { 274 return; 275 } 276 277 if (event.movementX < 0 && word.right() + event.movementX <= word.left) { 278 return; 279 } 280 281 word.length += event.movementX; 257 this.adjustWordEndTime(event.movementX); 282 258 283 259 this.updateSurroundingWords(); … … 287 263 this.canAdjustWordEndTime = false; 288 264 }, 265 289 266 adjustWordStartTime(amount) { 290 267 const word = this.myWord; … … 324 301 } 325 302 else { 326 if (word.left > (word.right() - this.scaleTime(0.1))) { 327 const diff = word.left - (word.right() - this.scaleTime(0.1)) // Will be positive 303 const rightBoundary = word.right() - this.scaleTime(0.1); 304 if (word.left > rightBoundary) { 305 const diff = word.left - rightBoundary // Will be positive 328 306 word.left -= diff; 329 307 word.length += diff; … … 331 309 } 332 310 }, 311 adjustWordEndTime(amount) { 312 const word = this.myWord; 313 word.length += amount; 314 315 if (amount > 0) { 316 if (this.wordIndex === this.mySurroundingWords.length - 1) { 317 const rightBoundary = this.scaleTime(this.audioSnippetLength); 318 319 if (word.right() < rightBoundary) { 320 return; 321 } 322 323 const diff = word.right() - rightBoundary; 324 word.length -= diff; 325 } 326 else { 327 const nextWord = this.mySurroundingWords[this.wordIndex + 1]; 328 329 if (word.right() < nextWord.left) { 330 return; 331 } 332 333 nextWord.left += amount; 334 nextWord.length -= amount; 335 336 const rightBoundary = nextWord.right() - this.scaleTime(0.1); 337 338 if (nextWord.left < rightBoundary) { 339 return; 340 } 341 342 const diff = word.right() - rightBoundary; 343 word.length -= diff; 344 nextWord.left -= diff; 345 nextWord.length += diff; 346 } 347 } 348 else { 349 const leftBoundary = word.left + this.scaleTime(0.1); 350 if (word.right() < leftBoundary) { 351 const diff = leftBoundary - word.right(); 352 word.length += diff; 353 } 354 } 355 }, 356 333 357 updateSurroundingWords() { 334 358 for (let i = 0; i < this.mySurroundingWords.length; i++) { … … 344 368 } 345 369 }, 346 beforeMount() {347 this.isProduction = process.env.NODE_ENV === "production";348 },349 370 mounted() { 350 371 this.isMounted = true;
Note:
See TracChangeset
for help on using the changeset viewer.