From 25568f8d24fbc77a034ddb1de37bae8ef37f9fda Mon Sep 17 00:00:00 2001 From: Matevz Tadel Date: Fri, 13 Nov 2026 23:57:08 -0800 Subject: [PATCH] [eve7] Fit the orthographic camera to the canvas Orthographic views were stretched sideways until a resize, because the camera was fitted to the whole view, toolbar included, instead of the canvas. Changes: - Take the aspect ratio from the canvas. - Use 1 for a canvas of zero size. Assisted-by: Claude:Opus 5.5 --- ui5/eve7/lib/GlViewerRCore.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui5/eve7/lib/GlViewerRCore.js b/ui5/eve7/lib/GlViewerRCore.js index ac991e193e6e8..822b60126ee4e 100644 --- a/ui5/eve7/lib/GlViewerRCore.js +++ b/ui5/eve7/lib/GlViewerRCore.js @@ -782,8 +782,11 @@ sap.ui.define([ { this.controls.setCamBaseMtx(new RC.Vector3(v1[0], v1[1], v1[2]), new RC.Vector3(v2[0], v2[1], v2[2])); // Fit the height, or the width if that is what limits the panel. - let ey = 1.02 * Math.max(extV.y, extV.x * this.get_height() / this.get_width()); - let ex = ey / this.get_height() * this.get_width(); + // Measure the canvas, not the view, which also holds the toolbar. + let cw = this.canvas.width, ch = this.canvas.height; + let asp = (cw > 0 && ch > 0) ? cw / ch : 1; + let ey = 1.02 * Math.max(extV.y, extV.x / asp); + let ex = ey * asp; this.camera._left = -ex; this.camera._right = ex; this.camera._top = ey;