Fixed sidebar show/hide events bubbling up

This commit is contained in:
Joel Collins 2019-04-14 11:16:26 +01:00
parent 1003aebdc5
commit 9f2d038aba

View file

@ -3,9 +3,9 @@
<div uk-grid class="uk-height-1-1 uk-margin-remove uk-padding-remove" margin=0> <div uk-grid class="uk-height-1-1 uk-margin-remove uk-padding-remove" margin=0>
<div id="sidebar-container" v-bind:class="responsivePanelLeft" class="uk-padding-remove uk-first-column uk-inline uk-height-1-1"> <div id="sidebar-container" v-bind:class="responsivePanelLeft" class="uk-padding-remove uk-first-column uk-inline uk-height-1-1">
<div id="overlay-toggle"> <div id="overlay-toggle">
<a href="" class="uk-icon-button uk-box-shadow-small uk-box-shadow-hover-medium action-btn-outline" uk-icon="menu" uk-toggle="target: .toggle-hidden; animation: uk-animation-slide-left-small, uk-animation-slide-left-small" ></a> <a href="" class="uk-icon-button uk-box-shadow-small uk-box-shadow-hover-medium action-btn-outline" uk-icon="menu" uk-toggle="target: #left-panel-container; animation: uk-animation-slide-left-small, uk-animation-slide-left-small" ></a>
</div> </div>
<div id="left-panel-container" class="toggle-hidden uk-padding-remove uk-card uk-card-default uk-width-auto uk-height-1-1"> <div id="left-panel-container" class="uk-padding-remove uk-card uk-card-default uk-width-auto uk-height-1-1">
<panelLeft/> <panelLeft/>
</div> </div>
</div> </div>
@ -49,15 +49,19 @@ export default {
created: function () { created: function () {
var context = this var context = this
UIkit.util.on(document, 'hidden', '.toggle-hidden', function () {
// BUG: This gets called every time a tab switches. Really shouldn't function handleSidebarEvent(context, event){
console.log("Sidebar hidden") if (event.target.id == 'left-panel-container') {
context.$root.$emit('globalResizePreview') console.log("Sidebar hidden")
context.$root.$emit('globalResizePreview')
}
}
UIkit.util.on(document, 'hidden', '#left-panel-container', function (e) {
handleSidebarEvent(context, e)
}) })
UIkit.util.on(document, 'shown', '.toggle-hidden', function () { UIkit.util.on(document, 'shown', '#left-panel-container', function (e) {
// BUG: This gets called every time a tab switches. Really shouldn't handleSidebarEvent(context, e)
console.log("Sidebar shown")
context.$root.$emit('globalResizePreview')
}) })
window.addEventListener('resize', this.handleResize) window.addEventListener('resize', this.handleResize)