Skip to content

Commit

Permalink
fix(MdTabs): remove ResizeObserver to improve the size and position c…
Browse files Browse the repository at this point in the history
…alculation (#1552)
  • Loading branch information
Samuell1 authored and marcosmoura committed Feb 28, 2018
1 parent 05821e2 commit ef0cd2f
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/components/MdTabs/MdTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,20 @@
}
}
},
callResizeFunctions () {
this.setIndicatorStyles()
this.calculateTabPos()
},
setupObservers () {
if ('ResizeObserver' in window) {
this.resizeObserver = new window.ResizeObserver(this.setIndicatorStyles)
this.resizeObserver.observe(this.$el)
} else {
this.resizeObserver = MdObserveElement(this.$el.querySelector('.md-tabs-content'), {
childList: true,
characterData: true,
subtree: true
}, () => {
this.setIndicatorStyles()
this.calculateTabPos()
})
this.resizeObserver = MdObserveElement(this.$el.querySelector('.md-tabs-content'), {
childList: true,
characterData: true,
subtree: true
}, () => {
this.callResizeFunctions()
})
window.addEventListener('resize', this.setIndicatorStyles)
}
window.addEventListener('resize', this.callResizeFunctions)
},
setupWatchers () {
if (this.mdSyncRoute) {
Expand Down Expand Up @@ -268,7 +266,7 @@
this.resizeObserver.disconnect()
}
window.removeEventListener('resize', this.setIndicatorStyles)
window.removeEventListener('resize', this.callResizeFunctions)
this.$refs.navigation.removeEventListener('transitionend', this.setIndicatorStyles)
}
})
Expand Down

0 comments on commit ef0cd2f

Please sign in to comment.