mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix group VN mode with reduced motion
This commit is contained in:
@ -285,6 +285,12 @@ async function visualNovelUpdateLayers(container) {
|
|||||||
let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction);
|
let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction);
|
||||||
let imagesWidth = [];
|
let imagesWidth = [];
|
||||||
|
|
||||||
|
for (const image of images) {
|
||||||
|
if (image instanceof HTMLImageElement && !image.complete) {
|
||||||
|
await new Promise(resolve => image.addEventListener('load', resolve, { once: true }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
images.forEach(image => {
|
images.forEach(image => {
|
||||||
imagesWidth.push($(image).width());
|
imagesWidth.push($(image).width());
|
||||||
});
|
});
|
||||||
@ -320,9 +326,15 @@ async function visualNovelUpdateLayers(container) {
|
|||||||
element.show();
|
element.show();
|
||||||
|
|
||||||
const promise = new Promise(resolve => {
|
const promise = new Promise(resolve => {
|
||||||
|
if (power_user.reduced_motion) {
|
||||||
|
element.css('left', currentPosition + 'px');
|
||||||
|
requestAnimationFrame(() => resolve());
|
||||||
|
}
|
||||||
|
else {
|
||||||
element.animate({ left: currentPosition + 'px' }, 500, () => {
|
element.animate({ left: currentPosition + 'px' }, 500, () => {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
currentPosition += imagesWidth[index];
|
currentPosition += imagesWidth[index];
|
||||||
|
Reference in New Issue
Block a user