Compare commits
	
		
			12 Commits
		
	
	
		
			v3.0.2
			...
			mct5867-re
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 3ba514e551 | ||
|   | 739d55b357 | ||
|   | 581d4fb2d1 | ||
|   | 41a6b7582e | ||
|   | d92e00f2dc | ||
|   | 71ef809207 | ||
|   | 7b01b955ac | ||
|   | eb36c95035 | ||
|   | 72812673d0 | ||
|   | 490c3ab8dd | ||
|   | 5aed0f3637 | ||
|   | 302351685d | 
| @@ -25,7 +25,7 @@ | ||||
|     tabindex="0" | ||||
|     class="c-imagery" | ||||
|     @keyup="arrowUpHandler" | ||||
|     @keydown="arrowDownHandler" | ||||
|     @keydown.prevent="arrowDownHandler" | ||||
|     @mouseover="focusElement" | ||||
| > | ||||
|     <div | ||||
| @@ -147,7 +147,7 @@ | ||||
|                     v-if="!isFixed" | ||||
|                     class="c-button icon-pause pause-play" | ||||
|                     :class="{'is-paused': isPaused}" | ||||
|                     @click="paused(!isPaused)" | ||||
|                     @click="handlePauseButton(!isPaused)" | ||||
|                 ></button> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -165,6 +165,9 @@ | ||||
|         <div | ||||
|             ref="thumbsWrapper" | ||||
|             class="c-imagery__thumbs-scroll-area" | ||||
|             :class="[{ | ||||
|                 'animate-scroll': animateThumbScroll | ||||
|             }]" | ||||
|             @scroll="handleScroll" | ||||
|         > | ||||
|             <ImageThumbnail | ||||
| @@ -182,7 +185,7 @@ | ||||
|         <button | ||||
|             class="c-imagery__auto-scroll-resume-button c-icon-button icon-play" | ||||
|             title="Resume automatic scrolling of image thumbnails" | ||||
|             @click="scrollToRight('reset')" | ||||
|             @click="scrollToRight" | ||||
|         ></button> | ||||
|     </div> | ||||
| </div> | ||||
| @@ -192,6 +195,7 @@ | ||||
| import eventHelpers from '../lib/eventHelpers'; | ||||
| import _ from 'lodash'; | ||||
| import moment from 'moment'; | ||||
| import Vue from 'vue'; | ||||
|  | ||||
| import RelatedTelemetry from './RelatedTelemetry/RelatedTelemetry'; | ||||
| import Compass from './Compass/Compass.vue'; | ||||
| @@ -289,7 +293,8 @@ export default { | ||||
|             pan: undefined, | ||||
|             animateZoom: true, | ||||
|             imagePanned: false, | ||||
|             forceShowThumbnails: false | ||||
|             forceShowThumbnails: false, | ||||
|             animateThumbScroll: false | ||||
|         }; | ||||
|     }, | ||||
|     computed: { | ||||
| @@ -393,6 +398,12 @@ export default { | ||||
|  | ||||
|             return disabled; | ||||
|         }, | ||||
|         isComposedInLayout() { | ||||
|             return ( | ||||
|                 this.currentView?.objectPath | ||||
|                 && !this.openmct.router.isNavigatedObject(this.currentView.objectPath) | ||||
|             ); | ||||
|         }, | ||||
|         focusedImage() { | ||||
|             return this.imageHistory[this.focusedImageIndex]; | ||||
|         }, | ||||
| @@ -570,10 +581,10 @@ export default { | ||||
|  | ||||
|                 if (!this.isPaused) { | ||||
|                     this.setFocusedImage(imageIndex); | ||||
|                     this.scrollToRight(); | ||||
|                 } else { | ||||
|                     this.scrollToFocused(); | ||||
|                 } | ||||
|  | ||||
|                 this.scrollHandler(); | ||||
|  | ||||
|             }, | ||||
|             deep: true | ||||
|         }, | ||||
| @@ -584,7 +595,7 @@ export default { | ||||
|             this.getImageNaturalDimensions(); | ||||
|         }, | ||||
|         bounds() { | ||||
|             this.scrollToFocused(); | ||||
|             this.scrollHandler(); | ||||
|         }, | ||||
|         isFixed(newValue) { | ||||
|             const isRealTime = !newValue; | ||||
| @@ -642,6 +653,8 @@ export default { | ||||
|  | ||||
|         this.listenTo(this.focusedImageWrapper, 'wheel', this.wheelZoom, this); | ||||
|         this.loadVisibleLayers(); | ||||
|         // // set after render so initial scroll event is skipped | ||||
|         setTimeout(this.setScrollBehavior, 3 * 1000); | ||||
|     }, | ||||
|     beforeDestroy() { | ||||
|         this.persistVisibleLayers(); | ||||
| @@ -848,6 +861,13 @@ export default { | ||||
|             const disableScroll = scrollWidth > Math.ceil(scrollLeft + clientWidth); | ||||
|             this.autoScroll = !disableScroll; | ||||
|         }, | ||||
|         handlePauseButton(newState) { | ||||
|             this.paused(newState); | ||||
|             if (newState) { | ||||
|                 // need to set the focused index or the paused focus will drift | ||||
|                 this.thumbnailClicked(this.focusedImageIndex); | ||||
|             } | ||||
|         }, | ||||
|         paused(state) { | ||||
|             this.isPaused = Boolean(state); | ||||
|  | ||||
| @@ -855,38 +875,63 @@ export default { | ||||
|                 this.previousFocusedImage = null; | ||||
|                 this.setFocusedImage(this.nextImageIndex); | ||||
|                 this.autoScroll = true; | ||||
|                 this.scrollToRight(); | ||||
|                 this.scrollHandler(); | ||||
|             } | ||||
|         }, | ||||
|         scrollToFocused() { | ||||
|         async scrollToFocused() { | ||||
|             const thumbsWrapper = this.$refs.thumbsWrapper; | ||||
|             if (!thumbsWrapper) { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             let domThumb = thumbsWrapper.children[this.focusedImageIndex]; | ||||
|  | ||||
|             if (domThumb) { | ||||
|                 domThumb.scrollIntoView({ | ||||
|                     behavior: 'smooth', | ||||
|                     block: 'center', | ||||
|                     inline: 'center' | ||||
|                 }); | ||||
|             } | ||||
|         }, | ||||
|         scrollToRight(type) { | ||||
|             if (type !== 'reset' && (this.isPaused || !this.$refs.thumbsWrapper || !this.autoScroll)) { | ||||
|             if (!domThumb) { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             const scrollWidth = this.$refs.thumbsWrapper.scrollWidth || 0; | ||||
|             // separate scrollTo function had to be implemented since scrollIntoView | ||||
|             // caused undesirable behavior in layouts | ||||
|             // and could not simply be scoped to the parent element | ||||
|             if (this.isComposedInLayout) { | ||||
|                 await Vue.nextTick(); | ||||
|                 const wrapperWidth = this.$refs.thumbsWrapper.clientWidth ?? 0; | ||||
|                 this.$refs.thumbsWrapper.scrollLeft = ( | ||||
|                     domThumb.offsetLeft - (wrapperWidth - domThumb.clientWidth) / 2); | ||||
|  | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             domThumb.scrollIntoView({ | ||||
|                 behavior: 'smooth', | ||||
|                 block: 'center', | ||||
|                 inline: 'center' | ||||
|             }); | ||||
|         }, | ||||
|         async scrollToRight() { | ||||
|  | ||||
|             const scrollWidth = this.$refs?.thumbsWrapper?.scrollWidth ?? 0; | ||||
|             if (!scrollWidth) { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             this.$nextTick(() => { | ||||
|                 this.$refs.thumbsWrapper.scrollLeft = scrollWidth; | ||||
|             }); | ||||
|             await Vue.nextTick(); | ||||
|             this.$refs.thumbsWrapper.scrollLeft = scrollWidth; | ||||
|         }, | ||||
|         async scrollHandler() { | ||||
|             if (this.isPaused) { | ||||
|                 await this.scrollToFocused(); | ||||
|  | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             if (this.autoScroll) { | ||||
|  | ||||
|                 this.scrollToRight(); | ||||
|             } | ||||
|  | ||||
|         }, | ||||
|         setScrollBehavior(value = true) { | ||||
|             this.animateThumbScroll = value; | ||||
|         }, | ||||
|         matchIndexOfPreviousImage(previous, imageHistory) { | ||||
|             // match logic uses a composite of url and time to account | ||||
| @@ -1087,7 +1132,7 @@ export default { | ||||
|             this.setSizedImageDimensions(); | ||||
|             this.setImageViewport(); | ||||
|             this.calculateViewHeight(); | ||||
|             this.scrollToFocused(); | ||||
|             this.scrollHandler(); | ||||
|         }, | ||||
|         setSizedImageDimensions() { | ||||
|             this.focusedImageNaturalAspectRatio = this.$refs.focusedImage.naturalWidth / this.$refs.focusedImage.naturalHeight; | ||||
| @@ -1122,9 +1167,7 @@ export default { | ||||
|             this.handleThumbWindowResizeEnded(); | ||||
|         }, | ||||
|         handleThumbWindowResizeEnded() { | ||||
|             if (!this.isPaused) { | ||||
|                 this.scrollToRight('reset'); | ||||
|             } | ||||
|             this.scrollHandler(); | ||||
|  | ||||
|             this.calculateViewHeight(); | ||||
|  | ||||
| @@ -1137,7 +1180,6 @@ export default { | ||||
|         }, | ||||
|         wheelZoom(e) { | ||||
|             e.preventDefault(); | ||||
|  | ||||
|             this.$refs.imageControls.wheelZoom(e); | ||||
|         }, | ||||
|         startPan(e) { | ||||
|   | ||||
| @@ -194,6 +194,9 @@ | ||||
|         overflow-y: hidden; | ||||
|         margin-bottom: 1px; | ||||
|         padding-bottom: $interiorMarginSm; | ||||
|         &.animate-scroll { | ||||
|             scroll-behavior: smooth;  | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     &__auto-scroll-resume-button { | ||||
|   | ||||
| @@ -481,19 +481,16 @@ describe("The Imagery View Layouts", () => { | ||||
|                 }); | ||||
|             }); | ||||
|         }); | ||||
|         it ('scrollToRight is called when clicking on auto scroll button', (done) => { | ||||
|             Vue.nextTick(() => { | ||||
|                 // use spyon to spy the scroll function | ||||
|                 spyOn(imageryView._getInstance().$refs.ImageryContainer, 'scrollToRight'); | ||||
|                 imageryView._getInstance().$refs.ImageryContainer.autoScroll = false; | ||||
|                 Vue.nextTick(() => { | ||||
|                     parent.querySelector('.c-imagery__auto-scroll-resume-button').click(); | ||||
|                     expect(imageryView._getInstance().$refs.ImageryContainer.scrollToRight).toHaveBeenCalledWith('reset'); | ||||
|                     done(); | ||||
|                 }); | ||||
|             }); | ||||
|         it ('scrollToRight is called when clicking on auto scroll button', async () => { | ||||
|             await Vue.nextTick(); | ||||
|             // use spyon to spy the scroll function | ||||
|             spyOn(imageryView._getInstance().$refs.ImageryContainer, 'scrollHandler'); | ||||
|             imageryView._getInstance().$refs.ImageryContainer.autoScroll = false; | ||||
|             await Vue.nextTick(); | ||||
|             parent.querySelector('.c-imagery__auto-scroll-resume-button').click(); | ||||
|             expect(imageryView._getInstance().$refs.ImageryContainer.scrollHandler); | ||||
|         }); | ||||
|         xit('should change the image zoom factor when using the zoom buttons', async (done) => { | ||||
|         xit('should change the image zoom factor when using the zoom buttons', async () => { | ||||
|             await Vue.nextTick(); | ||||
|             let imageSizeBefore; | ||||
|             let imageSizeAfter; | ||||
| @@ -512,7 +509,6 @@ describe("The Imagery View Layouts", () => { | ||||
|             imageSizeAfter = parent.querySelector('.c-imagery_main-image_background-image').getBoundingClientRect(); | ||||
|             expect(imageSizeAfter.height).toBeLessThan(imageSizeBefore.height); | ||||
|             expect(imageSizeAfter.width).toBeLessThan(imageSizeBefore.width); | ||||
|             done(); | ||||
|         }); | ||||
|         xit('should reset the zoom factor on the image when clicking the zoom button', async (done) => { | ||||
|             await Vue.nextTick(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user