allow maximising

pull/1/head
yann300 6 years ago
parent 683cdcb652
commit 2bf4240573
  1. 10
      src/app/ui/draggableContent.js

@ -41,6 +41,7 @@ module.exports =
class DraggableContent { class DraggableContent {
constructor (closeCb) { constructor (closeCb) {
this.closeCb = closeCb this.closeCb = closeCb
this.isMaximised = false
} }
render (title, content) { render (title, content) {
@ -68,6 +69,7 @@ module.exports =
this.el.querySelector('.title span').innerHTML = title this.el.querySelector('.title span').innerHTML = title
} }
minimize () { minimize () {
this.isMaximised = false
this.content.style.display = 'none' this.content.style.display = 'none'
this.el.style.height = 'inherit' this.el.style.height = 'inherit'
this.el.style.width = '150px' this.el.style.width = '150px'
@ -75,8 +77,12 @@ module.exports =
} }
maximise () { maximise () {
this.content.style.display = 'block' this.content.style.display = 'block'
this.el.style.height = '500px' var body = document.querySelector('body')
this.el.style.width = '500px' 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' this.el.querySelector('.title').style.width = 'inherit'
} }
close () { close () {

Loading…
Cancel
Save