ui: add keyboard shortcuts mod + "+" and mod + "-" to control zoom level
This commit is contained in:
parent
9d74c0e279
commit
8370f350e8
2 changed files with 19 additions and 6 deletions
|
|
@ -6,6 +6,9 @@
|
|||
- advanced syntaxes: `VAR{}` not updating when the default value is edited
|
||||
- editor: fix "Bring to front" and "Send to back" context menu actions
|
||||
|
||||
- ui
|
||||
- add keyboard shortcuts `mod + "+"` and `mod + "-"` to control zoom level
|
||||
|
||||
- widgets
|
||||
- input: add `numeric` property (allows numeric values only and displays numeric keyboard on mobile devices)
|
||||
|
||||
|
|
|
|||
|
|
@ -53,13 +53,23 @@ function applylocalZoom() {
|
|||
}
|
||||
|
||||
document.addEventListener('keydown', function(event){
|
||||
if (event[mod] && (event.keyCode == 96 || event.keyCode == 48)) {
|
||||
PXSCALE = INITIALZOOM
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
if (event[mod]) {
|
||||
console.log(event.keyCode)
|
||||
var z = false
|
||||
if (event.keyCode == 96 || event.keyCode == 48) {
|
||||
PXSCALE = INITIALZOOM
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
localZoom = 1
|
||||
applylocalZoom()
|
||||
z = true
|
||||
}
|
||||
else if (event.keyCode == 107 || event.keyCode == 109) {
|
||||
PXSCALE = (event.keyCode == 107 ? 0.1 : -0.1) + parseFloat(PXSCALE)
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
}
|
||||
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
|
||||
localZoom = 1
|
||||
applylocalZoom()
|
||||
if (z) DOM.dispatchEvent(window, 'resize')
|
||||
|
||||
}
|
||||
}, {passive: true})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue