Skip to content

Commit

Permalink
Merge pull request #159 from os2display/feature/2922-slideshow-bug
Browse files Browse the repository at this point in the history
Fixed issue where slideshow flickered first image before transitioning to next slide
  • Loading branch information
tuj authored Nov 12, 2024
2 parents 3266dec + b356caf commit a15b444
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

- [#159](https://github.com/os2display/display-templates/pull/159)
- Fixed issue where slideshow flickered first image before transitioning to next slide.

## [2.1.0] - 2024-10-23

- [#158](https://github.com/os2display/display-templates/pull/158)
Expand Down
6 changes: 3 additions & 3 deletions build/slideshow-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FP2SNSC9VXD10ZKXQR819NS9",
"description": "Skabelon til slideshow af billeder med forskellige effekter",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow.js?ts=1723805672543",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-admin.json?ts=1723805672543",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-schema.json?ts=1723805672543",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow.js?ts=1731317499358",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-admin.json?ts=1731317499358",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-schema.json?ts=1731317499358",
"assets": [],
"options": {},
"content": {}
Expand Down
6 changes: 3 additions & 3 deletions build/slideshow-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FP2SNSC9VXD10ZKXQR819NS9",
"description": "Skabelon til slideshow af billeder med forskellige effekter",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow.js?ts=1723805672543",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-admin.json?ts=1723805672543",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-schema.json?ts=1723805672543",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow.js?ts=1731317499358",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-admin.json?ts=1731317499358",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-schema.json?ts=1731317499358",
"assets": [],
"options": {},
"content": {}
Expand Down
2 changes: 1 addition & 1 deletion build/slideshow.js

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions src/slideshow/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ function Slideshow({ slide, content, run, slideDone, executionId }) {
newIndex = 0;
}

setAnimationIndex(newIndex);
if (newIndex !== 0) {
setAnimationIndex(newIndex);
}

if (fadeEnabled) {
if (fadeEnabled && newIndex !== 0) {
// Fade to next image.
setFade(true);

Expand All @@ -215,17 +217,17 @@ function Slideshow({ slide, content, run, slideDone, executionId }) {

fadeRef.current = setTimeout(() => {
setFade(false);
setIndex(newIndex);

if (newIndex === 0) {
slideDone(slide);
} else {
setIndex(newIndex);
}
}, fadeDuration - fadeSafeMargin);
} else if (newIndex === 0) {
slideDone(slide);
} else {
setIndex(newIndex);
if (newIndex === 0) {
slideDone(slide);
}
}
}, imageDurationInMilliseconds);
}, [index]);
Expand Down

0 comments on commit a15b444

Please sign in to comment.