Moved preview re-enabling logic to mixin

This commit is contained in:
Joel Collins 2019-03-21 16:32:10 +00:00
parent fb80b2cb36
commit 19494b773b
2 changed files with 4 additions and 8 deletions

View file

@ -40,13 +40,6 @@ export default {
console.log(`Toggling preview to ${state}`)
this.previewRequest(state)
})
this.$root.$on('globalReenablePreview', () => {
if (this.$store.state.settings.autoGpuPreview) {
console.log("Re-enabling preview")
this.previewRequest(true)
}
})
},
created: function () {

View file

@ -24,7 +24,10 @@ Vue.mixin({
.finally(function() {
// Reenable the GPU preview, if it was active before the modal
console.log("Re-enabling GPU preview")
self.$root.$emit('globalReenablePreview')
if (self.$store.state.settings.autoGpuPreview) {
console.log("Re-enabling preview")
self.$root.$emit('globalTogglePreview', true)
}
})
}
return new Promise(showModal)