smartour icon indicating copy to clipboard operation
smartour copied to clipboard

Fixed run/next/prev methods

Open Bochesan opened this issue 1 year ago • 0 comments

Thank you so much for your work!

I encountered a small error. In the current version, you can't use the prev() method if we are on the last slide.

https://github.com/jrainlau/smartour/blob/master/src/smartour.ts#L150 this.tourIndex of the last slide will always be equal to this.tourListLength - 1 and the prev() method will not switch to the previous slide.

I suggest using the run() method to run and switch to the next slide, the code logic will remain the same for the next() method.

There will be a separate code for the prev() method with this.tourIndex guard so that it won't switch to a non-existent slide.

Bochesan avatar May 14 '24 16:05 Bochesan