Skip to content

Commit 1e87cff

Browse files
committed
removing duplicate / redundant fields. Messing with control bar behavior on resize
1 parent 6bf4122 commit 1e87cff

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/components/RenderCanvas.vue

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ let canvasMouseClicked = false;
3535
const pressedKeys = new Set<string>();
3636
3737
const canvas = useTemplateRef("canvas");
38-
const canvasWidth = ref(0);
39-
const canvasHeight = ref(0);
4038
const frameTime = ref(0);
4139
const frameID = ref(0);
4240
const fps = ref(0);
@@ -86,12 +84,6 @@ onMounted(() => {
8684
8785
window.addEventListener('keydown', handleKeyDown);
8886
window.addEventListener('keyup', handleKeyUp);
89-
90-
// initialize reported canvas size
91-
if (canvas.value) {
92-
canvasWidth.value = canvas.value.width;
93-
canvasHeight.value = canvas.value.height;
94-
}
9587
})
9688
9789
/**
@@ -292,10 +284,6 @@ function resizeCanvasHandler(entries: ResizeObserverEntry[]) {
292284
let needResize = resizeCanvas(entries);
293285
if (needResize) {
294286
handleResize();
295-
if (canvas.value) {
296-
canvasWidth.value = canvas.value.width;
297-
canvasHeight.value = canvas.value.height;
298-
}
299287
}
300288
}
301289
@@ -957,12 +945,12 @@ function onRun(runCompiledCode: CompiledPlayground) {
957945
<button @click="setFrame(frameID - 1)" title="Step backward">&#x23F4;</button>
958946
<button @click="setFrame(frameID + 1)" title="Step forward">&#x23F5;</button>
959947
<button @click="pauseRender = !pauseRender" :title="pauseRender ? 'Resume' : 'Pause'">⏯</button>
960-
<span class="frame-counter">Frame: {{ frameID }}</span>
961-
<span class="perf-info">{{ frameTime.toFixed(1) }} ms</span>
962-
<span class="fps-counter">FPS: {{ fps }}</span>
963-
<span class="fps-counter">FPS: {{ Math.round(1000 / frameTime) }}</span>
948+
<span class="frame-counter">{{ String(frameID).padStart(5, '0') }}</span>
964949
</div>
965950
<div class="controls-right">
951+
<span>{{ frameTime.toFixed(1) }} ms</span>
952+
<span>{{ Math.min(Math.round(1000 / frameTime), 60) }} fps</span>
953+
<span>{{ canvas?.width }}x{{ canvas?.height }}</span>
966954
<button @click="toggleFullscreen" title="Toggle full screen">&#x26F6;</button>
967955
</div>
968956
</div>
@@ -981,14 +969,17 @@ function onRun(runCompiledCode: CompiledPlayground) {
981969
bottom: 0;
982970
left: 0;
983971
right: 0;
984-
height: 32px;
972+
height: 36px;
985973
padding: 4px 8px;
986974
background: rgba(0, 0, 0, 0.5);
987975
display: flex;
988976
align-items: center;
989977
justify-content: space-between;
990978
color: white;
991979
font-size: 14px;
980+
overflow: hidden;
981+
white-space: nowrap;
982+
width: 100%;
992983
}
993984
.control-bar .controls-left > * {
994985
margin-right: 8px;

0 commit comments

Comments
 (0)