Skip to content

Commit

Permalink
Image switching length fix (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG authored Nov 14, 2024
1 parent 53f93a1 commit ac44a09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/js/components/Product/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default {
Object.values(window.config.product.super_attributes).filter((attribute) => attribute.update_image).length
) {
self.images = simpleProduct.images
self.active = Math.min(self.active, self.images.length - 1)
}
})
})
Expand All @@ -40,10 +41,10 @@ export default {
},
keyPressed(e) {
if (e.key == 'ArrowLeft' && this.active) {
if (e.key == 'ArrowLeft' && this.active > 0) {
// left
this.active--
} else if (e.key == 'ArrowRight' && this.active != this.images.length - 1) {
} else if (e.key == 'ArrowRight' && this.active < this.images.length - 1) {
// right
this.active++
} else if (e.key == 'Escape') {
Expand Down

0 comments on commit ac44a09

Please sign in to comment.