fix #832, floating btns closing, Esc to close confirmation dialog, 0x0 rects disabled (#947)

This commit is contained in:
olekhshch
2024-01-20 23:53:20 +01:00
committed by GitHub
parent f75d1a83a0
commit 9f77e9c63a
6 changed files with 43 additions and 8 deletions

View File

@@ -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

View File

@@ -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
}
})
}
/**