zoom: prevent changing editor zoom level when it's disabled

This commit is contained in:
jean-emmanuel 2025-09-20 09:19:32 +02:00
parent 3e14c46c8c
commit 96cb90ed0d
2 changed files with 8 additions and 0 deletions

View file

@ -1,6 +1,11 @@
import EventEmitter from '../events/event-emitter.mjs'
import {DOM, PXSCALE, INITIALZOOM, setPXSCALE} from '../globals.mjs'
var editor
;(async()=>{
editor = (await import('../editor/index.mjs')).default
})()
var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey'
class Zoom extends EventEmitter {
@ -62,6 +67,8 @@ class Zoom extends EventEmitter {
setLocalZoom(zoom) {
if (!editor.enabled) return
zoom = Math.max(Math.min(zoom, 4), 0.25)
if (zoom !== this.localZoom) {
requestAnimationFrame(()=>{