Add hotpot navigation and slideshow

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-10-28 13:51:46 -07:00
parent 2163f9158a
commit 6b3e1f4e19
6 changed files with 85 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
let slideShowInterval = null
/**
* Sets listener and attributes on model-viewer to
* allow for click registering of a new hotspot
@@ -151,5 +153,10 @@ prevAnnotation = function(mView) {
* @return {intervalID} ID of the created interval timer
*/
slideshowAnnotations = function(mView, slideDuration = 5000) {
return setInterval(nextAnnotation, slideDuration, mView)
if (slideShowInterval) {
clearInterval(slideShowInterval)
} else {
nextAnnotation(mView)
slideShowInterval = setInterval(nextAnnotation, slideDuration, mView)
}
}