Hide menu with tab

This commit is contained in:
Devine Lu Linvega
2019-01-12 16:22:38 +12:00
parent f4aa6fae54
commit dd549617b5
4 changed files with 21 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ function Interface (dotgrid) {
this.el.appendChild(this.menu_el = document.createElement('div'))
this.menu_el.id = 'menu'
this.is_visible = true
this.isVisible = true
this.zoom = false
this.install = function (host) {
@@ -142,7 +142,14 @@ function Interface (dotgrid) {
}
this.toggle = function () {
this.is_visible = !this.is_visible
this.el.className = this.is_visible ? 'visible' : 'hidden'
this.isVisible = !this.isVisible
this.el.className = this.isVisible ? 'visible' : 'hidden'
}
document.onkeydown = function (e) {
if (e.key === 'Tab') {
DOTGRID.interface.toggle()
e.preventDefault()
}
}
}