Compare commits

...

9 Commits

Author SHA1 Message Date
Michael Rogers
8ed4aa4338 Duplicate sizedImageHeight with thumbnail height calculation 2022-04-21 17:59:05 -05:00
Michael Rogers
6190908e25 Adjust constant minimums 2022-04-21 16:54:18 -05:00
Michael Rogers
0ccf75b135 Trailing spaces 2022-04-21 16:27:09 -05:00
Michael Rogers
b839a651de Fixed linting errors 2022-04-21 16:23:01 -05:00
Michael Rogers
ad3185ab7f Cleanup 2022-04-21 16:10:13 -05:00
Michael Rogers
2f453fdeed Set an arbitrary threshold to maintain visibility after image resize 2022-04-21 16:07:09 -05:00
Michael Rogers
b6101387e9 Externalize consts 2022-04-21 15:46:01 -05:00
Michael Rogers
178532c218 Display flex instead of block 2022-04-21 15:44:10 -05:00
Michael Rogers
0740b863d3 show timestrip computed value 2022-04-19 17:21:36 -05:00
2 changed files with 43 additions and 3 deletions

View File

@@ -162,7 +162,8 @@
class="c-imagery__thumbs-wrapper"
:class="[
{ 'is-paused': isPaused && !isFixed },
{ 'is-autoscroll-off': !resizingWindow && !autoScroll && !isPaused }
{ 'is-autoscroll-off': !resizingWindow && !autoScroll && !isPaused },
{ 'show-thumbnail': showImageThumbnails}
]"
>
<div
@@ -229,6 +230,9 @@ const SCROLL_LATENCY = 250;
const ZOOM_SCALE_DEFAULT = 1;
const THUMBNAIL_LAYOUT_MIN_WIDTH = 400;
const THUMBNAIL_LAYOUT_MIN_HEIGHT = 300;
export default {
components: {
Compass,
@@ -286,7 +290,8 @@ export default {
imageTranslateY: 0,
pan: undefined,
animateZoom: true,
imagePanned: false
imagePanned: false,
showImageThumbnails: false
};
},
computed: {
@@ -458,6 +463,7 @@ export default {
height: this.sizedImageHeight
};
}
},
watch: {
imageHistory: {
@@ -502,6 +508,10 @@ export default {
this.resetAgeCSS();
this.updateRelatedTelemetryForFocusedImage();
this.getImageNaturalDimensions();
},
sizedImageDimensions() {
const previousVisibility = this.showImageThumbnails;
this.showImageThumbnails = this.shouldDisplayThumbnails(previousVisibility);
}
},
async mounted() {
@@ -1050,6 +1060,31 @@ export default {
},
setCursorStates(states) {
this.cursorStates = states;
},
shouldDisplayThumbnails(previousVisibility) {
const focusedImageNaturalAspectRatio = this.$refs.focusedImage.naturalWidth / this.$refs.focusedImage.naturalHeight;
// FIXME: magic number of thumbnail height;
// cannot use this.$refs.thumbsWrapper.getBoundingClientRect since zeroed out by display:none
const thumbnailContainerHeight = 135;
let sizedImageWidth;
let sizedImageHeight;
// if the image thumbnail strip is not visible, subtract from container height
let imageContainerHeight = previousVisibility ? this.imageContainerHeight : this.imageContainerHeight - thumbnailContainerHeight;
let imageContainerWidth = this.imageContainerWidth;
if ((imageContainerWidth / imageContainerHeight) > focusedImageNaturalAspectRatio) {
// container is wider than image
sizedImageWidth = imageContainerHeight * focusedImageNaturalAspectRatio;
sizedImageHeight = imageContainerHeight;
} else {
// container is taller than image
sizedImageWidth = imageContainerWidth;
sizedImageHeight = imageContainerWidth / focusedImageNaturalAspectRatio;
}
return (
sizedImageWidth >= THUMBNAIL_LAYOUT_MIN_WIDTH
&& sizedImageHeight >= THUMBNAIL_LAYOUT_MIN_HEIGHT
);
}
}
};

View File

@@ -142,9 +142,9 @@
}
}
&__thumbs-scroll-area {
flex: 0 1 auto;
display: flex;
flex-direction: row;
height: 135px;
overflow-x: auto;
@@ -200,6 +200,11 @@
// When Imagery is in a layout, hide the thumbs area
display: none;
}
.show-thumbnail {
.c-imagery__thumbs-scroll-area {
display: flex;
}
}
}
/*************************************** IMAGERY LOCAL CONTROLS*/