Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from lukemnet/btnfix
Browse files Browse the repository at this point in the history
event fix
  • Loading branch information
lwojcik authored Apr 6, 2019
2 parents 5b4f2d2 + 10e0764 commit afdd766
Show file tree
Hide file tree
Showing 61 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion dist/examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3>JavaScript</h3>
<p>See <a href="../notes/api.html">API documentation</a> for all available options or <a href="../notes/styling.html">CSS styling</a> for a minimum viable stylesheet.</p>
<p><a href="../">&laquo; Back to main page</a></p>
</div>
<script src="../js/tridi.js"></script>
<script src="../js/tridi.min.js"></script>
<script>
new Tridi({
element: '#tridi-basic',
Expand Down
6 changes: 3 additions & 3 deletions dist/examples/dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ <h3>JavaScript</h3>

switchToWhiteBtn.addEventListener('touchstart', function() {
switchColor('white');
});
}, { passive: true });

switchToBlackBtn.addEventListener('click', function() {
switchColor('black');
});

switchToBlackBtn.addEventListener('touchstart', function() {
switchColor('black');
});
}, { passive: true });

switchToRedBtn.addEventListener('click', function() {
switchColor('red');
});

switchToRedBtn.addEventListener('touchstart', function() {
switchColor('red');
});
}, { passive: true });
</script>
</body>
</html>
Binary file removed dist/images/1.png
Binary file not shown.
Binary file removed dist/images/10.png
Binary file not shown.
Binary file removed dist/images/11.png
Binary file not shown.
Binary file removed dist/images/12.png
Binary file not shown.
Binary file removed dist/images/13.png
Binary file not shown.
Binary file removed dist/images/14.png
Binary file not shown.
Binary file removed dist/images/15.png
Binary file not shown.
Binary file removed dist/images/16.png
Binary file not shown.
Binary file removed dist/images/17.png
Binary file not shown.
Binary file removed dist/images/18.png
Binary file not shown.
Binary file removed dist/images/19.png
Binary file not shown.
Binary file removed dist/images/2.png
Binary file not shown.
Binary file removed dist/images/20.png
Binary file not shown.
Binary file removed dist/images/21.png
Binary file not shown.
Binary file removed dist/images/22.png
Binary file not shown.
Binary file removed dist/images/23.png
Binary file not shown.
Binary file removed dist/images/24.png
Binary file not shown.
Binary file removed dist/images/25.png
Binary file not shown.
Binary file removed dist/images/26.png
Binary file not shown.
Binary file removed dist/images/27.png
Binary file not shown.
Binary file removed dist/images/28.png
Binary file not shown.
Binary file removed dist/images/29.png
Binary file not shown.
Binary file removed dist/images/3.png
Binary file not shown.
Binary file removed dist/images/30.png
Binary file not shown.
Binary file removed dist/images/31.png
Binary file not shown.
Binary file removed dist/images/32.png
Diff not rendered.
Binary file removed dist/images/33.png
Diff not rendered.
Binary file removed dist/images/34.png
Diff not rendered.
Binary file removed dist/images/35.png
Diff not rendered.
Binary file removed dist/images/36.png
Diff not rendered.
Binary file removed dist/images/37.png
Diff not rendered.
Binary file removed dist/images/38.png
Diff not rendered.
Binary file removed dist/images/39.png
Diff not rendered.
Binary file removed dist/images/4.png
Diff not rendered.
Binary file removed dist/images/40.png
Diff not rendered.
Binary file removed dist/images/41.png
Diff not rendered.
Binary file removed dist/images/42.png
Diff not rendered.
Binary file removed dist/images/43.png
Diff not rendered.
Binary file removed dist/images/44.png
Diff not rendered.
Binary file removed dist/images/45.png
Diff not rendered.
Binary file removed dist/images/46.png
Diff not rendered.
Binary file removed dist/images/47.png
Diff not rendered.
Binary file removed dist/images/48.png
Diff not rendered.
Binary file removed dist/images/49.png
Diff not rendered.
Binary file removed dist/images/5.png
Diff not rendered.
Binary file removed dist/images/50.png
Diff not rendered.
Binary file removed dist/images/51.png
Diff not rendered.
Binary file removed dist/images/6.png
Diff not rendered.
Binary file removed dist/images/7.png
Diff not rendered.
Binary file removed dist/images/8.png
Diff not rendered.
Binary file removed dist/images/9.png
Diff not rendered.
Binary file modified dist/images/black/36.jpg
4 changes: 2 additions & 2 deletions dist/js/tridi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ declare class Tridi {
private populateStash;
private generateViewerImage;
private updateViewerImage;
private nextMove;
private prevMove;
private nextFrame;
private prevFrame;
private nextMove;
private prevMove;
private rotateViewerImage;
private startDragging;
private stopDragging;
Expand Down
22 changes: 11 additions & 11 deletions dist/js/tridi.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/tridi.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/tridi.min.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ declare class Tridi {
private populateStash;
private generateViewerImage;
private updateViewerImage;
private nextMove;
private prevMove;
private nextFrame;
private prevFrame;
private nextMove;
private prevMove;
private rotateViewerImage;
private startDragging;
private stopDragging;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tridi.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/tridi.min.js.map

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src/tridi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,28 +352,28 @@ class Tridi {
: this.firstImage();
}

private nextMove() {
return this.inverse ? this.prevFrame() : this.nextFrame();
}

private prevMove() {
return this.inverse ? this.nextFrame() : this.prevFrame();
}

private nextFrame() {
this.imageIndex = this.imageIndex <= 1
? this.count!
: this.imageIndex - 1;

this.viewerImage().src = this.image(this.imageIndex);
this.viewerImage().src = this.image(this.imageIndex);
}

private prevFrame() {
this.imageIndex = this.imageIndex >= this.count!
? 1
: this.imageIndex + 1;

this.viewerImage().src = this.image(this.imageIndex);
this.viewerImage().src = this.image(this.imageIndex);
}

private nextMove() {
return this.inverse ? this.prevFrame() : this.nextFrame();
}

private prevMove() {
return this.inverse ? this.nextFrame() : this.prevFrame();
}

private rotateViewerImage(e: MouseEvent | TouchEvent) {
Expand Down Expand Up @@ -485,7 +485,7 @@ class Tridi {
private attachMousewheelEvents() {
if (this.mousewheel) {
this.viewerImage().addEventListener("wheel", e => {
if (e.preventDefault) e.preventDefault();
if (e.preventDefault && !this.passive) e.preventDefault();
e.deltaY / 120 > 0 ? this.nextMove() : this.prevMove();
}, { passive: this.passive });
}
Expand Down Expand Up @@ -517,8 +517,8 @@ class Tridi {

private attachButtonsEvents() {
if (this.buttons) {
if (this.leftBtn()) this.attachBtnEvents(this.leftBtn(), this.nextMove);
if (this.rightBtn()) this.attachBtnEvents(this.rightBtn(), this.prevMove);
if (this.leftBtn()) this.attachBtnEvents(this.leftBtn(), this.nextMove.bind(this));
if (this.rightBtn()) this.attachBtnEvents(this.rightBtn(), this.prevMove.bind(this));
}
}

Expand All @@ -534,13 +534,13 @@ class Tridi {

if (skipDelay) {
const autoplayInterval = window.setInterval(() => {
this.nextFrame();
this.nextMove();
}, speed);
this.intervals.push(autoplayInterval);
} else {
const autoplayTimeout = window.setTimeout(() => {
const autoplayInterval = window.setInterval(() => {
this.nextFrame();
this.nextMove();
}, speed);
this.intervals.push(autoplayInterval);
}, this.resumeAutoplayDelay);
Expand Down

0 comments on commit afdd766

Please sign in to comment.