fix: zoom functions (#739)

master
mertmit 2022-03-16 19:12:19 +03:00 committed by GitHub
parent ca5107f599
commit d8db82ee8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -116,6 +116,18 @@ class Zoom extends ListComboBox {
this.$input.shadowRoot.querySelector('[part~="input"]').style.width = this[internal.state].inputsize this.$input.shadowRoot.querySelector('[part~="input"]').style.width = this[internal.state].inputsize
} }
if (changed.inputPartType) { if (changed.inputPartType) {
const self = this
this.$input.setAttribute('step', '10')
this.$input.setAttribute('min', '0')
// Handle NumberSpinBox input.
this.$input.addEventListener('change', function (e) {
e.preventDefault()
const value = e.detail?.value
if (value) {
const changeEvent = new CustomEvent('change', { detail: { value } })
self.dispatchEvent(changeEvent)
}
})
// Wire up handler on new input. // Wire up handler on new input.
this.addEventListener('close', (e) => { this.addEventListener('close', (e) => {
e.preventDefault() e.preventDefault()

View File

@ -56,7 +56,7 @@ class BottomPanel {
break break
default: default:
{ {
const zoomlevel = Number(value) > 0.1 ? Number(value) > 0.1 : 0.1 const zoomlevel = Number(value) > 0.1 ? Number(value) * 0.01 : 0.1
const zoom = this.editor.svgCanvas.getZoom() const zoom = this.editor.svgCanvas.getZoom()
const { workarea } = this.editor const { workarea } = this.editor
this.editor.zoomChanged(window, { this.editor.zoomChanged(window, {