Skip to content

Commit 6ece445

Browse files
committed
fix glitch of wrong image ratio in zoom mode after maximize/restore (workaround)
1 parent c2c9e15 commit 6ece445

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

res/GUI.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ function imagezoom_size_adjust() {
408408
el_img.classList.remove("fullwidth");
409409
el_img.classList.add("fullheight");
410410
}
411+
412+
// when maximizing, there is sometimes a glitch where the image size has a wrong ratio
413+
let w_img_curr = el_img.clientWidth;
414+
let h_img_curr = el_img.clientHeight;
415+
if (Math.abs(w_img/h_img - w_img_curr/h_img_curr) > 0.05) {
416+
el_img.style.opacity = 0.999;
417+
setTimeout(() => { el_img.style.opacity = '' }, 50);
418+
}
411419
}
412420
if (window.line_profile_object !== null) {
413421
window.line_profile_object.setup(); // will set up size of canvas

0 commit comments

Comments
 (0)