Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: window resize
Browse files Browse the repository at this point in the history
robertsLando committed May 14, 2024
1 parent 4874ad7 commit db1b336
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/views/Zniffer.vue
Original file line number Diff line number Diff line change
@@ -244,23 +244,18 @@ export default {
this.setZnifferState(data)
})
const onWindowResize = () => {
this.onWindowResize = () => {
const oneThird = window.innerHeight / 3
this.topPaneHeight = oneThird * 2
}
this.ro = new ResizeObserver(onWindowResize)
this.ro.observe(this.$el)
window.addEventListener('resize', this.onWindowResize)
onWindowResize()
this.onWindowResize()
this.scrollBottom()
},
beforeDestroy() {
if (this.ro) {
// call both unoobserve and disconnect to avoid memory leaks
this.ro.unobserve(this.$el)
this.ro.disconnect()
}
window.removeEventListener('resize', this.onWindowResize)
if (this.roTopPane) {
this.roTopPane.unobserve(this.$refs.topPane)

0 comments on commit db1b336

Please sign in to comment.