Fix group VN mode with reduced motion
| @@ -285,6 +285,12 @@ async function visualNovelUpdateLayers(container) { | |||
| 285 | let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction); | 285 | let images = Array.from($('#visual-novel-wrapper .expression-holder')).sort(sortFunction); |
| 286 | let imagesWidth = []; | 286 | let imagesWidth = []; |
| 287 | 287 | ||
| 288 | for (const image of images) { | ||
| 289 | if (image instanceof HTMLImageElement && !image.complete) { | ||
| 290 | await new Promise(resolve => image.addEventListener('load', resolve, { once: true })); | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 288 | images.forEach(image => { | 294 | images.forEach(image => { |
| 289 | imagesWidth.push($(image).width()); | 295 | imagesWidth.push($(image).width()); |
| 290 | }); | 296 | }); |
| @@ -320,9 +326,15 @@ async function visualNovelUpdateLayers(container) { | |||
| 320 | element.show(); | 326 | element.show(); |
| 321 | 327 | ||
| 322 | const promise = new Promise(resolve => { | 328 | const promise = new Promise(resolve => { |
| 329 | if (power_user.reduced_motion) { | ||
| 330 | element.css('left', currentPosition + 'px'); | ||
| 331 | requestAnimationFrame(() => resolve()); | ||
| 332 | } | ||
| 333 | else { | ||
| 323 | element.animate({ left: currentPosition + 'px' }, 500, () => { | 334 | element.animate({ left: currentPosition + 'px' }, 500, () => { |
| 324 | resolve(); | 335 | resolve(); |
| 325 | }); | 336 | }); |
| 337 | } | ||
| 326 | }); | 338 | }); |
| 327 | 339 | ||
| 328 | currentPosition += imagesWidth[index]; | 340 | currentPosition += imagesWidth[index]; |