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

@@ -713,7 +713,9 @@ const mouseUpEvent = (evt) => {
const width = element.getAttribute('width')
const height = element.getAttribute('height')
// Image should be kept regardless of size (use inherit dimensions later)
keep = (width || height) || svgCanvas.getCurrentMode() === 'image'
const widthNum = Number(width)
const heightNum = Number(height)
keep = widthNum >= 1 || heightNum >= 1 || svgCanvas.getCurrentMode() === 'image'
}
break
case 'circle':
@@ -886,8 +888,8 @@ const mouseUpEvent = (evt) => {
if (svgCanvas.getCurrentMode() === 'path') {
svgCanvas.pathActions.toEditMode(element)
} else if (svgCanvas.getCurConfig().selectNew) {
const modes = ['circle', 'ellipse', 'square', 'rect', 'fhpath', 'line', 'fhellipse', 'fhrect', 'star', 'polygon']
if (modes.indexOf(svgCanvas.getCurrentMode()) !== -1) {
const modes = ['circle', 'ellipse', 'square', 'rect', 'fhpath', 'line', 'fhellipse', 'fhrect', 'star', 'polygon', 'shapelib']
if (modes.indexOf(svgCanvas.getCurrentMode()) !== -1 && !evt.altKey) {
svgCanvas.setMode('select')
}
svgCanvas.selectOnly([element], true)