Slideshow working 'well enough' for Christmas

Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James Ketrenos 2018-12-25 13:33:43 -08:00
parent 8cbf34c13e
commit 69f4d24f56
2 changed files with 28 additions and 4 deletions

View File

@ -24,9 +24,25 @@
box-sizing: border-box;
pointer-events: all;
}
#image {
display: inline-block;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-size: contain;
background-position: center center;
background-repeat: no-repeat;
transition: opacity 0.5s ease-in-out;
-webkit-transition: opacity 0.5s ease-in-out;
}
</style>
<img id="image">
<div id="image">
</div>
</template>
@ -83,10 +99,9 @@
this.showImage();
this.$.image.src = this.image.src;
this.$.image.style.backgroundImage = 'url(' + this.image.src + ')';
this.$.image.style.opacity = 1;
this.image = undefined;
this.setActive(true);
}, remaining);
}.bind(this, path);

View File

@ -1245,10 +1245,19 @@
delete this.slideshowTimeout;
return;
}
this.slideshowTimeout = window.setTimeout(this.slideshowNext.bind(this), 24 * 1000);
if (this.slideshowTimeout) {
window.cancelTimeout(this.slideshowTimeout);
delete this.slideshowTimeout;
}
if (!this.thumbnails.length) {
this.slideshowTimeout = window.setTimeout(this.slideshowNext.bind(this), 150);
return;
}
this.slideshowTimeout = window.setTimeout(this.slideshowNext.bind(this), 24 * 1000);
var photo = this.thumbnails[Math.floor(this.thumbnails.length * Math.random())].item;
this.$.kenBurns.item = photo;
this.$.kenBurns.src = this.base + photo.path + "thumbs/scaled/" + photo.filename;