Skip to content

Commit

Permalink
Unable creation of 0x0 rects and squares
Browse files Browse the repository at this point in the history
  • Loading branch information
olekhshch committed Jan 20, 2024
1 parent f19ac81 commit 568782b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/svgcanvas/core/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion src/editor/EditorStartup.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class EditorStartup {
cancelTool () {
const mode = this.svgCanvas.getMode()
// list of modes that are currently save to cancel
const modesToCancel = ['zoom', 'rect', 'square', 'circle', 'ellipse', 'line', 'text', 'star', 'polygon', 'eyedropper', 'shapelib']
const modesToCancel = ['zoom', 'rect', 'square', 'circle', 'ellipse', 'line', 'text', 'star', 'polygon', 'eyedropper', 'shapelib', 'image']
if (modesToCancel.includes(mode)) {
this.leftPanel.clickSelect()
}
Expand Down
2 changes: 1 addition & 1 deletion src/editor/components/seExplorerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ExplorerButton extends HTMLElement {
this.request = new XMLHttpRequest()
this.imgPath = svgEditor.configObj.curConfig.imgPath

//Closes opened (pressed) lib menu on click on the canvas
// Closes opened (pressed) lib menu on click on the canvas
const workarea = document.getElementById('workarea')
workarea.addEventListener('click', (e) => {
this.$menu.classList.remove('open')
Expand Down

0 comments on commit 568782b

Please sign in to comment.