From 7046e88ad8334d19b0425bcc1177508af84f5d38 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 16 Feb 2024 16:47:13 +0300 Subject: [PATCH] fixed image copy bug... need to test if this is linux-specific... Signed-off-by: Alex A. Naanou --- Viewer/features/app.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Viewer/features/app.js b/Viewer/features/app.js index a17a0fcd..04edd2bf 100755 --- a/Viewer/features/app.js +++ b/Viewer/features/app.js @@ -63,8 +63,15 @@ function({url, orientation, flipped}, callback){ var img = new Image img.onload = function(){ - var width = this.naturalWidth - var height = this.naturalHeight + // XXX .naturalWidth/.naturalHeight seem to ignore .imageOrientation + // setting and orient the image via exif while .width/.height + // seem to respect it but only when atached to DOM... + // XXX for some reason noticed this on Linux, need to test under + // Windows if this is a platform-specific thing... + //var width = this.naturalWidth + //var height = this.naturalHeight + var width = this.width + var height = this.height var c = document.createElement('canvas') c.style.imageOrientation = 'none' @@ -76,12 +83,12 @@ function({url, orientation, flipped}, callback){ // prepare for rotate... // 90 / 270 if(orientation == 90 || orientation == 270){ - var w = c.width = this.naturalHeight - var h = c.height = this.naturalWidth + var w = c.width = height + var h = c.height = width // 0 / 180 } else { - var w = c.width = this.naturalWidth - var h = c.height = this.naturalHeight } + var w = c.width = width + var h = c.height = height } // prepare for flip... var x = flipped && flipped.includes('horizontal') ? -1