bbox: copy rotation to next pic

This commit is contained in:
ed 2025-12-21 16:06:27 +00:00
parent c0e167fd97
commit 485c60cf25

View file

@ -1014,7 +1014,9 @@ window.baguetteBox = (function () {
if (index >= imagesElements.length) if (index >= imagesElements.length)
return bounceAnimation(options.readDirRtl ? 'left' : 'right'); return bounceAnimation(options.readDirRtl ? 'left' : 'right');
var orot;
try { try {
orot = vidimg().getAttribute('rot');
vid().pause(); vid().pause();
} }
catch (ex) { } catch (ex) { }
@ -1032,6 +1034,9 @@ window.baguetteBox = (function () {
else if (toast.tag == 'bb-ded') else if (toast.tag == 'bb-ded')
toast.hide(); toast.hide();
if (orot && im.getAttribute('rot') === null)
rotn(orot / 90, 1);
if (options.animation == 'none') if (options.animation == 'none')
unvid(vid()); unvid(vid());
else else
@ -1048,7 +1053,7 @@ window.baguetteBox = (function () {
} }
var prev_cw = 0, prev_ch = 0, unrot_timer = null; var prev_cw = 0, prev_ch = 0, unrot_timer = null;
function rotn(n) { function rotn(n, asap) {
var el = vidimg(), var el = vidimg(),
orot = parseInt(el.getAttribute('rot') || 0), orot = parseInt(el.getAttribute('rot') || 0),
frot = orot + (n || 0) * 90; frot = orot + (n || 0) * 90;
@ -1063,6 +1068,8 @@ window.baguetteBox = (function () {
if (!n && prev_cw === cw && prev_ch === ch) if (!n && prev_cw === cw && prev_ch === ch)
return; // reflow noop return; // reflow noop
clmod(el, 'asap', asap);
prev_cw = cw; prev_cw = cw;
prev_ch = ch; prev_ch = ch;
var rot = frot, var rot = frot,
@ -1122,7 +1129,7 @@ window.baguetteBox = (function () {
return; return;
clmod(el, 'nt', 1); clmod(el, 'nt', 1);
el.removeAttribute('rot'); el.setAttribute('rot', 0);
el.removeAttribute("style"); el.removeAttribute("style");
rot = el.offsetHeight; rot = el.offsetHeight;
clmod(el, 'nt'); clmod(el, 'nt');