From 0c74042fad1f0f47ead402e4d65dc0a447a9e316 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Wed, 9 Jan 2019 21:23:03 +0000 Subject: [PATCH] current image shows in image viewer --- components/GalleryImageViewer.vue | 26 +++++++++++++++++++++++++- components/GalleryPage.vue | 18 ++++++++++++++++-- components/GalleryThumbs.vue | 19 ++++++++++++------- components/ThumbNav.vue | 2 +- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/components/GalleryImageViewer.vue b/components/GalleryImageViewer.vue index 271143b..bda77cc 100644 --- a/components/GalleryImageViewer.vue +++ b/components/GalleryImageViewer.vue @@ -1,6 +1,7 @@ @@ -39,13 +41,25 @@ export default { return { featuredImageHeight: '16rem', imageViewerIsVisible: false, - activeRow: 0 + activeRow: 0, + activeGalleryIndex: 0, + activeImageIndex: 0 + } + }, + + computed: { + viewingImageUrl () { + return this.galleries[this.activeGalleryIndex].images[this.activeImageIndex].url } }, methods: { handleFeaturedClick (index) { this.activeRow = index + }, + handleThumbClick(gallery, image) { + this.activeGalleryIndex = gallery + this.activeImageIndex = image } } } diff --git a/components/GalleryThumbs.vue b/components/GalleryThumbs.vue index 6fa3b05..eed6b6b 100644 --- a/components/GalleryThumbs.vue +++ b/components/GalleryThumbs.vue @@ -19,7 +19,8 @@
  • + :key="galleryIndex + '.' + imageIndex + '.' + image.url" + @click="$emit('thumbClick', galleryIndex, imageIndex)"> @@ -100,12 +101,14 @@ export default { methods: { initLeftNav () { - let offset = this.thumbRowOffsets[this.activeRow] - let totalRowWidth = this.$refs.galleryThumbsRowContainers[this.activeRow].clientWidth - let visibleRowWidth = this.$refs.galleryThumbsList.clientWidth - let maxOffset = totalRowWidth - visibleRowWidth - this.isLeftDesktopNavActive = (totalRowWidth > visibleRowWidth) - && (offset < maxOffset) + if (this.$refs.galleryThumbsRowContainers[this.activeRow] && this.$refs.galleryThumbsList) { + let offset = this.thumbRowOffsets[this.activeRow] + let totalRowWidth = this.$refs.galleryThumbsRowContainers[this.activeRow].clientWidth + let visibleRowWidth = this.$refs.galleryThumbsList.clientWidth + let maxOffset = totalRowWidth - visibleRowWidth + this.isLeftDesktopNavActive = (totalRowWidth > visibleRowWidth) + && (offset < maxOffset) + } }, resetOffsets() { for (let index = 0; index < this.thumbRowOffsets.length; index++) { @@ -254,10 +257,12 @@ export default { transition: opacity .5s; opacity: 0; + pointer-events: none; &.is-active { transition: opacity .5s .3s; opacity: 1; + pointer-events: auto; } } diff --git a/components/ThumbNav.vue b/components/ThumbNav.vue index 016c452..9315d1e 100644 --- a/components/ThumbNav.vue +++ b/components/ThumbNav.vue @@ -1,5 +1,5 @@