From 475672ab721f75a510ee16f653fef69f9a31d231 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 23 Oct 2018 11:40:42 +0200 Subject: [PATCH] allow maximising --- src/app/ui/draggableContent.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/ui/draggableContent.js b/src/app/ui/draggableContent.js index 432de3f500..12e91ca5c1 100644 --- a/src/app/ui/draggableContent.js +++ b/src/app/ui/draggableContent.js @@ -41,6 +41,7 @@ module.exports = class DraggableContent { constructor (closeCb) { this.closeCb = closeCb + this.isMaximised = false } render (title, content) { @@ -68,6 +69,7 @@ module.exports = this.el.querySelector('.title span').innerHTML = title } minimize () { + this.isMaximised = false this.content.style.display = 'none' this.el.style.height = 'inherit' this.el.style.width = '150px' @@ -75,8 +77,12 @@ module.exports = } maximise () { this.content.style.display = 'block' - this.el.style.height = '500px' - this.el.style.width = '500px' + var body = document.querySelector('body') + this.el.style.height = this.isMaximised ? '500px' : body.offsetHeight + 'px' + this.el.style.width = this.isMaximised ? '500px' : body.offsetWidth + 'px' + this.isMaximised = !this.isMaximised + this.el.style.top = this.isMaximised ? '0%' : '20%' + this.el.style.left = this.isMaximised ? '0%' : '50%' this.el.querySelector('.title').style.width = 'inherit' } close () {