mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 07:07:22 +02:00
Fix:Update bookshelf on screen orientation change #602
This commit is contained in:
@@ -452,6 +452,12 @@ export default {
|
|||||||
this.libraryItemUpdated(ab)
|
this.libraryItemUpdated(ab)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
screenOrientationChange() {
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('LazyBookshelf Screen orientation change')
|
||||||
|
this.resetEntities()
|
||||||
|
}, 50)
|
||||||
|
},
|
||||||
initListeners() {
|
initListeners() {
|
||||||
const bookshelf = document.getElementById('bookshelf-wrapper')
|
const bookshelf = document.getElementById('bookshelf-wrapper')
|
||||||
if (bookshelf) {
|
if (bookshelf) {
|
||||||
@@ -466,6 +472,13 @@ export default {
|
|||||||
this.$socket.$on('item_removed', this.libraryItemRemoved)
|
this.$socket.$on('item_removed', this.libraryItemRemoved)
|
||||||
this.$socket.$on('items_updated', this.libraryItemsUpdated)
|
this.$socket.$on('items_updated', this.libraryItemsUpdated)
|
||||||
this.$socket.$on('items_added', this.libraryItemsAdded)
|
this.$socket.$on('items_added', this.libraryItemsAdded)
|
||||||
|
|
||||||
|
if (screen.orientation) {
|
||||||
|
// Not available on ios
|
||||||
|
screen.orientation.addEventListener('change', this.screenOrientationChange)
|
||||||
|
} else {
|
||||||
|
document.addEventListener('orientationchange', this.screenOrientationChange)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeListeners() {
|
removeListeners() {
|
||||||
const bookshelf = document.getElementById('bookshelf-wrapper')
|
const bookshelf = document.getElementById('bookshelf-wrapper')
|
||||||
@@ -481,6 +494,13 @@ export default {
|
|||||||
this.$socket.$off('item_removed', this.libraryItemRemoved)
|
this.$socket.$off('item_removed', this.libraryItemRemoved)
|
||||||
this.$socket.$off('items_updated', this.libraryItemsUpdated)
|
this.$socket.$off('items_updated', this.libraryItemsUpdated)
|
||||||
this.$socket.$off('items_added', this.libraryItemsAdded)
|
this.$socket.$off('items_added', this.libraryItemsAdded)
|
||||||
|
|
||||||
|
if (screen.orientation) {
|
||||||
|
// Not available on ios
|
||||||
|
screen.orientation.removeEventListener('change', this.screenOrientationChange)
|
||||||
|
} else {
|
||||||
|
document.removeEventListener('orientationchange', this.screenOrientationChange)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
|
|||||||
Reference in New Issue
Block a user