Skip to content

Commit

Permalink
fix zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
heapwolf committed Mar 11, 2024
1 parent 7abe36e commit dffe666
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class AppView extends Tonic {
async reloadPreviewWindows () {
clearTimeout(this.debounce)
this.debounce = setTimeout(() => {
console.log(this.previewWindows)
for (const w of Object.values(this.previewWindows)) {
w.navigate(this.state.indexURL + `?zoom=${this.state.zoom[w.index]}`)
}
Expand Down Expand Up @@ -128,13 +127,15 @@ class AppView extends Tonic {
opts.minHeight = Math.floor(height / scale)
}

const w = await application.createWindow(opts)
try {
const w = await application.createWindow(opts)

w.channel.addEventListener('message', e => {
this.state.zoom[w.index] = e.data.zoom || 1
})
w.channel.addEventListener('message', e => {
this.state.zoom[w.index] = e.data.zoom || 1
})

this.previewWindows[w.index] = w
this.previewWindows[w.index] = w
} catch {}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class AppProperties extends Tonic {
const editor = document.querySelector('app-editor')
const project = document.querySelector('app-project')

if (event === 'preview') {
app.activatePreviewWindows()
}

if (event === 'insert-native-extension') {
await project.insert({
label: 'extension.cc',
Expand Down

0 comments on commit dffe666

Please sign in to comment.