From 485c60cf2596cb78e566a65cfa576d438151fe6d Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 21 Dec 2025 16:06:27 +0000 Subject: [PATCH] bbox: copy rotation to next pic --- copyparty/web/baguettebox.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index 92103c82..5596eb6e 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -1014,7 +1014,9 @@ window.baguetteBox = (function () { if (index >= imagesElements.length) return bounceAnimation(options.readDirRtl ? 'left' : 'right'); + var orot; try { + orot = vidimg().getAttribute('rot'); vid().pause(); } catch (ex) { } @@ -1032,6 +1034,9 @@ window.baguetteBox = (function () { else if (toast.tag == 'bb-ded') toast.hide(); + if (orot && im.getAttribute('rot') === null) + rotn(orot / 90, 1); + if (options.animation == 'none') unvid(vid()); else @@ -1048,7 +1053,7 @@ window.baguetteBox = (function () { } var prev_cw = 0, prev_ch = 0, unrot_timer = null; - function rotn(n) { + function rotn(n, asap) { var el = vidimg(), orot = parseInt(el.getAttribute('rot') || 0), frot = orot + (n || 0) * 90; @@ -1063,6 +1068,8 @@ window.baguetteBox = (function () { if (!n && prev_cw === cw && prev_ch === ch) return; // reflow noop + clmod(el, 'asap', asap); + prev_cw = cw; prev_ch = ch; var rot = frot, @@ -1076,8 +1083,8 @@ window.baguetteBox = (function () { wmag = Math.min(vw / iw, vh / ih); if (!options.bbzoom) { - pmag = Math.min(1, pmag); - wmag = Math.min(1, wmag); + pmag = Math.min(1, pmag); + wmag = Math.min(1, wmag); } while (rot < 0) rot += 360; @@ -1122,7 +1129,7 @@ window.baguetteBox = (function () { return; clmod(el, 'nt', 1); - el.removeAttribute('rot'); + el.setAttribute('rot', 0); el.removeAttribute("style"); rot = el.offsetHeight; clmod(el, 'nt');