Extensions (#737)

- add the current document title in the toolbar
- allow user extensions to define optional parameters
- more events for renamedElement, beforeClear, afterClear, sourceChanged
- remove "message" event used for iframe integration not used anymore. can be readded through a new extension if necessary
- default precision down to 2 digits (and applied in rotation)
This commit is contained in:
JFH
2022-03-13 12:59:53 +01:00
committed by GitHub
parent 95f9ea3abb
commit a335e44dc8
25 changed files with 457 additions and 512 deletions

View File

@@ -118,11 +118,11 @@ class TopPanel {
}
$id('stroke_width').value = gWidth === null ? '' : gWidth
this.editor.bottomPanel.updateColorpickers(true)
this.editor.bottomPanel.updateColorpickers(false)
break
}
default: {
this.editor.bottomPanel.updateColorpickers(true)
this.editor.bottomPanel.updateColorpickers(false)
$id('stroke_width').value =
this.selectedElement.getAttribute('stroke-width') || 1
@@ -539,9 +539,11 @@ class TopPanel {
*/
changeRotationAngle (e) {
this.editor.svgCanvas.setRotationAngle(e.target.value)
;(Number.parseInt(e.target.value) === 0)
? $id('tool_reorient').classList.add('disabled')
: $id('tool_reorient').classList.remove('disabled')
if (Number.parseInt(e.target.value) === 0) {
$id('tool_reorient').classList.add('disabled')
} else {
$id('tool_reorient').classList.remove('disabled')
}
}
/**
@@ -628,16 +630,7 @@ class TopPanel {
}
}
// if the user is changing the id, then de-select the element first
// change the ID, then re-select it with the new ID
if (attr === 'id') {
const elem = this.editor.selectedElement
this.editor.svgCanvas.clearSelection()
elem.id = val
this.editor.svgCanvas.addToSelection([elem], true)
} else {
this.editor.svgCanvas.changeSelectedAttribute(attr, val)
}
this.editor.svgCanvas.changeSelectedAttribute(attr, val)
return true
}