···
<input type="number" id="objectDist" value="30" min="1" />
24
-
<label>Zoom:</label>
23
+
<div style="display: flex; gap: 20px; align-items: center; width: 100%">
25
+
<label>Object Height:</label>
34
+
<div style="flex: 1">
35
+
<label>Zoom:</label>
<canvas id="canvas" style="flex: 1; cursor: move"></canvas>
···
const mirrorType = document.getElementById("mirrorType");
const radiusInput = document.getElementById("radius");
const objectDistInput = document.getElementById("objectDist");
73
+
const objectHeightInput = document.getElementById("objectHeight");
const zoomInput = document.getElementById("zoom");
76
+
objectHeightInput.value = Math.round(radiusInput.value / 3);
···
function drawRays(isConcave, R, objDist) {
const scale = (canvas.width / (R * 6)) * parseFloat(zoomInput.value);
247
-
const h = (R * scale) / 3;
262
+
const h = parseFloat(objectHeightInput.value) * scale;
const centerX = canvas.width / 2 + R * scale + offsetX;
const centerY = canvas.height / 2 + offsetY;
···
mirrorType.addEventListener("change", update);
radiusInput.addEventListener("input", update);
objectDistInput.addEventListener("input", update);
589
+
objectHeightInput.addEventListener("input", update);
zoomInput.addEventListener("input", update);
window.addEventListener("resize", update);