Skip to content

Commit

Permalink
fix(preview): removes redundant resolution display and keeps preview …
Browse files Browse the repository at this point in the history
…in view (#904)

* fix: keeps preview in view

* fix: removes redundant resolution display
  • Loading branch information
2xAA committed May 4, 2024
1 parent c1fedad commit cb955ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
9 changes: 0 additions & 9 deletions src/application/worker/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,6 @@ function loop(delta, features, fftOutput) {
debugCanvas.width,
debugCanvas.height
);
debugContext.font = "32px monospace";
debugContext.textBaseline = "hanging";
debugContext.fillStyle = "#fff";
debugContext.globalCompositeOperation = "difference";
debugContext.fillText(
`${canvasToDebug.context.canvas.width} × ${canvasToDebug.context.canvas.height}`,
10,
10
);
}
}

Expand Down
20 changes: 17 additions & 3 deletions src/components/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</Select>
</c>

<c span="1..">
<c span="1.." class="canvas-container">
<canvas ref="canvas"></canvas>
</c>
</grid>
Expand All @@ -41,7 +41,7 @@ export default {
},
mounted() {
const { canvas, container } = this.$refs;
const { canvas } = this.$refs;
const offscreen = canvas.transferControlToOffscreen();
this.$modV.$worker.postMessage(
Expand All @@ -61,7 +61,7 @@ export default {
this.resize(entries);
});
}).observe(container);
}).observe(canvas);
this.$modV.store.commit("outputs/TOGGLE_DEBUG", true);
},
Expand Down Expand Up @@ -107,17 +107,31 @@ export default {
identifier: "outputs/resizeDebug",
payload: { width }
});
// this.$refs.canvas.style.width = `${e[0].contentRect.width}px`;
// this.$refs.canvas.style.height = `${e[0].contentRect.height}px`;
}
}
};
</script>

<style scoped>
.preview {
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
}
.canvas-container {
height: 100%;
flex-grow: 1;
min-height: 0;
}
canvas {
object-fit: contain;
width: 100%;
height: 100%;
}
</style>

0 comments on commit cb955ae

Please sign in to comment.