Automatically scrolls to active cue when enable/disable the transcription panel

This commit is contained in:
mfcar 2024-05-04 12:52:04 +01:00
parent ee8e7cf958
commit 282203a30a
No known key found for this signature in database

View file

@ -16,18 +16,26 @@ export default {
},
methods: {
clickSeek() {
const time = this.cue.startTime;
this.$emit('seek', time);
const time = this.cue.startTime
this.$emit('seek', time)
},
scrollIntoView() {
this.$el.scrollIntoView({behavior: 'smooth'})
}
},
mounted() {
if (this.isActive) {
this.scrollIntoView()
}
},
created() {
this.cue.onenter = () => (this.isActive = true);
this.cue.onexit = () => (this.isActive = false);
this.cue.onenter = () => (this.isActive = true)
this.cue.onexit = () => (this.isActive = false)
},
watch: {
isActive(newVal) {
if (newVal) {
this.$el.scrollIntoView({behavior: 'smooth'});
this.scrollIntoView()
}
}
}