launcher: fix build / avoid editor import
This commit is contained in:
parent
6322d91478
commit
f7b42fbfb2
3 changed files with 7 additions and 9 deletions
|
|
@ -14,6 +14,7 @@ import locales from '../locales/index.mjs'
|
|||
import {leftUiSidePanel, rightUiSidePanel} from '../ui/index.mjs'
|
||||
import ipc from '../ipc/index.mjs'
|
||||
import {DOM, GRIDWIDTH, GRIDWIDTH_CSS, ENV, PXSCALE, setGRIDWIDTH, READ_ONLY} from '../globals.mjs'
|
||||
import zoom from '../ui/zoom.mjs'
|
||||
|
||||
var sessionManager
|
||||
;(async()=>{
|
||||
|
|
@ -28,6 +29,8 @@ class Editor {
|
|||
|
||||
constructor() {
|
||||
|
||||
zoom.editor = this
|
||||
|
||||
this.inspector = new UiInspector({selector: '#osc-inspector'})
|
||||
this.inspector.on('update', (event)=>{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import {DOM} from '../globals.mjs'
|
||||
|
||||
var zoom, editor
|
||||
var zoom
|
||||
;(async()=>{
|
||||
zoom = (await import('../ui/zoom.mjs')).default
|
||||
editor = (await import('../editor/index.mjs')).default
|
||||
})()
|
||||
|
||||
// impot cssTransformCoords from './transform-coords.mjs'
|
||||
|
|
@ -13,7 +12,7 @@ const Touch = window.Touch || class Touch {}
|
|||
|
||||
export function fix(e) {
|
||||
|
||||
var localZoom = editor.enabled ? zoom.localZoom : 1
|
||||
var localZoom = zoom.editor.enabled ? zoom.localZoom : 1
|
||||
|
||||
return {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
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 {
|
||||
|
|
@ -16,6 +11,7 @@ class Zoom extends EventEmitter {
|
|||
|
||||
this.localZoom = 1
|
||||
this.lastWheelZoom = 0
|
||||
this.editor = null
|
||||
|
||||
document.addEventListener('wheel', (event)=>{
|
||||
if (event.ctrlKey) event.preventDefault()
|
||||
|
|
@ -67,7 +63,7 @@ class Zoom extends EventEmitter {
|
|||
|
||||
setLocalZoom(zoom) {
|
||||
|
||||
if (!editor.enabled) return
|
||||
if (this.editor && !this.editor.enabled) return
|
||||
|
||||
zoom = Math.max(Math.min(zoom, 4), 0.25)
|
||||
if (zoom !== this.localZoom) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue