This commit is contained in:
@@ -25,6 +25,13 @@ export class ExplorerButton extends HTMLElement {
|
||||
this.files = []
|
||||
this.request = new XMLHttpRequest()
|
||||
this.imgPath = svgEditor.configObj.curConfig.imgPath
|
||||
|
||||
// Closes opened (pressed) lib menu on click on the canvas
|
||||
const workarea = document.getElementById('workarea')
|
||||
workarea.addEventListener('click', (e) => {
|
||||
this.$menu.classList.remove('open')
|
||||
this.$lib.classList.remove('open-lib')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,8 +269,8 @@ export class ExplorerButton extends HTMLElement {
|
||||
ev.stopPropagation()
|
||||
switch (ev.target.nodeName) {
|
||||
case 'SE-EXPLORERBUTTON':
|
||||
this.$menu.classList.add('open')
|
||||
this.$lib.classList.add('open-lib')
|
||||
this.$menu.classList.toggle('open')
|
||||
this.$lib.classList.toggle('open-lib')
|
||||
break
|
||||
case 'SE-BUTTON':
|
||||
// change to the current action
|
||||
|
||||
@@ -24,6 +24,13 @@ export class FlyingButton extends HTMLElement {
|
||||
// the last element of the div is the slot
|
||||
// we retrieve all elements added in the slot (i.e. se-buttons)
|
||||
this.$elements = this.$menu.lastElementChild.assignedElements()
|
||||
|
||||
// Closes opened menu on click
|
||||
document.addEventListener('click', e => {
|
||||
if (this.opened) {
|
||||
this.opened = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user