|
|
@ -23,7 +23,7 @@ const css = csjs` |
|
|
|
export default class PanelsResize { |
|
|
|
export default class PanelsResize { |
|
|
|
constructor (panel) { |
|
|
|
constructor (panel) { |
|
|
|
this.panel = panel |
|
|
|
this.panel = panel |
|
|
|
let self = this; |
|
|
|
let self = this |
|
|
|
const string = panel.style.minWidth |
|
|
|
const string = panel.style.minWidth |
|
|
|
this.minWidth = string.length > 2 ? parseInt(string.substring(0, string.length - 2)) : 0 |
|
|
|
this.minWidth = string.length > 2 ? parseInt(string.substring(0, string.length - 2)) : 0 |
|
|
|
window.addEventListener('resize', function (event) { |
|
|
|
window.addEventListener('resize', function (event) { |
|
|
@ -44,7 +44,7 @@ export default class PanelsResize { |
|
|
|
document.addEventListener('keydown', cancelGhostbar) |
|
|
|
document.addEventListener('keydown', cancelGhostbar) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let cancelGhostbar = (event) => { |
|
|
|
let cancelGhostbar = (event) => { |
|
|
|
if (event.keyCode === 27) { |
|
|
|
if (event.keyCode === 27) { |
|
|
|
document.body.removeChild(this.ghostbar) |
|
|
|
document.body.removeChild(this.ghostbar) |
|
|
@ -76,7 +76,7 @@ export default class PanelsResize { |
|
|
|
setPosition (event) { |
|
|
|
setPosition (event) { |
|
|
|
let panelWidth = this.calculatePanelWidth(event) |
|
|
|
let panelWidth = this.calculatePanelWidth(event) |
|
|
|
// close the panel if the width is less than a minWidth
|
|
|
|
// close the panel if the width is less than a minWidth
|
|
|
|
if (panelWidth > this.minWidth - 10 || this.panel.style.display == 'none') { |
|
|
|
if (panelWidth > this.minWidth - 10 || this.panel.style.display === 'none') { |
|
|
|
this.panel.style.width = panelWidth + 'px' |
|
|
|
this.panel.style.width = panelWidth + 'px' |
|
|
|
this.showPanel() |
|
|
|
this.showPanel() |
|
|
|
} else this.hidePanel() |
|
|
|
} else this.hidePanel() |
|
|
|