From a6cedbc429fa504e09859598d04c5b180187c5c4 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Mon, 6 Jul 2026 14:15:04 -0400 Subject: [PATCH] zoom issue. --- engine.js | 6 +++++- index.html | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engine.js b/engine.js index f1921e2b..743647c9 100644 --- a/engine.js +++ b/engine.js @@ -381,9 +381,13 @@ export class Engine { this.canvas.height = Math.max(this.canvas.height, targetH); } - gl.viewport(0, 0, targetW, targetH); + const viewportY = this.canvas.height - targetH; + gl.viewport(0, viewportY, targetW, targetH); + gl.enable(gl.SCISSOR_TEST); + gl.scissor(0, viewportY, targetW, targetH); gl.clearColor(0.0, 0.0, 0.0, 0.0); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.disable(gl.SCISSOR_TEST); const aspect = rect.width / rect.height; const viewProj = diorama.updateMatrices(aspect); diff --git a/index.html b/index.html index d724a94f..578b7de2 100644 --- a/index.html +++ b/index.html @@ -40,8 +40,8 @@

Static Sub-Figures

-
-
+
+
@@ -66,14 +66,14 @@ p 0 -2 0 piston facing=north extended=false `) const f_static = new WorldFrame(w_static); - const d_static_top = new Diorama('demo-2', f_static, () => engine.requestRender()); + const d_static_top = new Diorama('demo-top-static', f_static, () => engine.requestRender()); d_static_top.radius = 5; d_static_top.theta = 180; d_static_top.phi = 90; d_static_top.centerView(); d_static_top.saveState(); engine.addDiorama(d_static_top) - const d_static_iso = new Diorama('demo-3', f_static, () => engine.requestRender()); + const d_static_iso = new Diorama('demo-iso', f_static, () => engine.requestRender()); d_static_iso.radius = 5; d_static_iso.centerView(); d_static_iso.saveState();