Skip to content

Commit dffe666

Browse files
committed
fix zoom
1 parent 7abe36e commit dffe666

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class AppView extends Tonic {
6161
async reloadPreviewWindows () {
6262
clearTimeout(this.debounce)
6363
this.debounce = setTimeout(() => {
64-
console.log(this.previewWindows)
6564
for (const w of Object.values(this.previewWindows)) {
6665
w.navigate(this.state.indexURL + `?zoom=${this.state.zoom[w.index]}`)
6766
}
@@ -128,13 +127,15 @@ class AppView extends Tonic {
128127
opts.minHeight = Math.floor(height / scale)
129128
}
130129

131-
const w = await application.createWindow(opts)
130+
try {
131+
const w = await application.createWindow(opts)
132132

133-
w.channel.addEventListener('message', e => {
134-
this.state.zoom[w.index] = e.data.zoom || 1
135-
})
133+
w.channel.addEventListener('message', e => {
134+
this.state.zoom[w.index] = e.data.zoom || 1
135+
})
136136

137-
this.previewWindows[w.index] = w
137+
this.previewWindows[w.index] = w
138+
} catch {}
138139
}
139140
}
140141

src/properties.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class AppProperties extends Tonic {
6767
const editor = document.querySelector('app-editor')
6868
const project = document.querySelector('app-project')
6969

70+
if (event === 'preview') {
71+
app.activatePreviewWindows()
72+
}
73+
7074
if (event === 'insert-native-extension') {
7175
await project.insert({
7276
label: 'extension.cc',

0 commit comments

Comments
 (0)