mirror of
https://github.com/nasa/openmct.git
synced 2025-02-10 21:01:31 +00:00
Closes #7936
- Significant improvements for Time Strip imagery view ahead of user-settable swimlane heights. - Imagery container height, image height and width no longer set in code. - Imagery swimlane now uses styles and hover behavior consistent with events.
This commit is contained in:
parent
5b28086f95
commit
9522040929
@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="imagery" class="c-imagery-tsv c-timeline-holder">
|
<div ref="imagery" class="c-imagery-tsv js-imagery-tsv">
|
||||||
<div ref="imageryHolder" class="c-imagery-tsv__contents u-contents"></div>
|
<div ref="imageryHolder" class="c-imagery-tsv__contents u-contents"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -37,8 +37,6 @@ import { PREVIEW_ACTION_KEY } from '@/ui/preview/PreviewAction.js';
|
|||||||
import imageryData from '../../imagery/mixins/imageryData.js';
|
import imageryData from '../../imagery/mixins/imageryData.js';
|
||||||
|
|
||||||
const PADDING = 1;
|
const PADDING = 1;
|
||||||
const ROW_HEIGHT = 100;
|
|
||||||
const IMAGE_SIZE = 85;
|
|
||||||
const IMAGE_WIDTH_THRESHOLD = 25;
|
const IMAGE_WIDTH_THRESHOLD = 25;
|
||||||
const CONTAINER_CLASS = 'c-imagery-tsv-container';
|
const CONTAINER_CLASS = 'c-imagery-tsv-container';
|
||||||
const NO_ITEMS_CLASS = 'c-imagery-tsv__no-items';
|
const NO_ITEMS_CLASS = 'c-imagery-tsv__no-items';
|
||||||
@ -73,9 +71,11 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.previewAction = this.openmct.actions.getAction(PREVIEW_ACTION_KEY);
|
this.previewAction = this.openmct.actions.getAction(PREVIEW_ACTION_KEY);
|
||||||
|
|
||||||
this.canvas = this.$refs.imagery.appendChild(document.createElement('canvas'));
|
// Why are we doing this? This element causes scroll problems in the swimlane.
|
||||||
this.canvas.height = 0;
|
// this.canvas = this.$refs.imagery.appendChild(document.createElement('canvas'));
|
||||||
this.canvasContext = this.canvas.getContext('2d');
|
// this.canvas.height = 0;
|
||||||
|
// this.canvas.width = 10;
|
||||||
|
// this.canvasContext = this.canvas.getContext('2d');
|
||||||
this.setDimensions();
|
this.setDimensions();
|
||||||
|
|
||||||
this.setScaleAndPlotImagery = this.setScaleAndPlotImagery.bind(this);
|
this.setScaleAndPlotImagery = this.setScaleAndPlotImagery.bind(this);
|
||||||
@ -207,8 +207,8 @@ export default {
|
|||||||
setDimensions() {
|
setDimensions() {
|
||||||
const imageryHolder = this.$refs.imagery;
|
const imageryHolder = this.$refs.imagery;
|
||||||
this.width = this.getClientWidth();
|
this.width = this.getClientWidth();
|
||||||
|
|
||||||
this.height = Math.round(imageryHolder.getBoundingClientRect().height);
|
this.height = Math.round(imageryHolder.getBoundingClientRect().height);
|
||||||
|
this.imageHeight = this.height - 10;
|
||||||
},
|
},
|
||||||
setScale(timeSystem) {
|
setScale(timeSystem) {
|
||||||
if (!this.width) {
|
if (!this.width) {
|
||||||
@ -233,7 +233,6 @@ export default {
|
|||||||
return imageObj.time <= this.viewBounds.end && imageObj.time >= this.viewBounds.start;
|
return imageObj.time <= this.viewBounds.end && imageObj.time >= this.viewBounds.start;
|
||||||
},
|
},
|
||||||
getImageryContainer() {
|
getImageryContainer() {
|
||||||
let containerHeight = 100;
|
|
||||||
let containerWidth = this.imageHistory.length ? this.width : 200;
|
let containerWidth = this.imageHistory.length ? this.width : 200;
|
||||||
let imageryContainer;
|
let imageryContainer;
|
||||||
|
|
||||||
@ -271,7 +270,6 @@ export default {
|
|||||||
|
|
||||||
imageryContainer = component.$el.querySelector(`.${CONTAINER_CLASS}`);
|
imageryContainer = component.$el.querySelector(`.${CONTAINER_CLASS}`);
|
||||||
imageryContainer.style.maxWidth = `${containerWidth}px`;
|
imageryContainer.style.maxWidth = `${containerWidth}px`;
|
||||||
imageryContainer.style.height = `${containerHeight}px`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return imageryContainer;
|
return imageryContainer;
|
||||||
@ -380,15 +378,11 @@ export default {
|
|||||||
//create image vertical tick indicator
|
//create image vertical tick indicator
|
||||||
let imageTickElement = document.createElement('div');
|
let imageTickElement = document.createElement('div');
|
||||||
imageTickElement.classList.add('c-imagery-tsv__image-handle');
|
imageTickElement.classList.add('c-imagery-tsv__image-handle');
|
||||||
imageTickElement.style.width = '2px';
|
|
||||||
imageTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`;
|
|
||||||
imageWrapper.appendChild(imageTickElement);
|
imageWrapper.appendChild(imageTickElement);
|
||||||
|
|
||||||
//create placeholder - this will also hold the actual image
|
//create placeholder - this will also hold the actual image
|
||||||
let imagePlaceholder = document.createElement('div');
|
let imagePlaceholder = document.createElement('div');
|
||||||
imagePlaceholder.classList.add('c-imagery-tsv__image-placeholder');
|
imagePlaceholder.classList.add('c-imagery-tsv__image-placeholder');
|
||||||
imagePlaceholder.style.width = `${IMAGE_SIZE}px`;
|
|
||||||
imagePlaceholder.style.height = `${IMAGE_SIZE}px`;
|
|
||||||
imageWrapper.appendChild(imagePlaceholder);
|
imageWrapper.appendChild(imagePlaceholder);
|
||||||
|
|
||||||
//create image element
|
//create image element
|
||||||
@ -396,8 +390,6 @@ export default {
|
|||||||
this.setNSAttributesForElement(imageElement, {
|
this.setNSAttributesForElement(imageElement, {
|
||||||
src: image.thumbnailUrl || image.url
|
src: image.thumbnailUrl || image.url
|
||||||
});
|
});
|
||||||
imageElement.style.width = `${IMAGE_SIZE}px`;
|
|
||||||
imageElement.style.height = `${IMAGE_SIZE}px`;
|
|
||||||
this.setImageDisplay(imageElement, showImagePlaceholders);
|
this.setImageDisplay(imageElement, showImagePlaceholders);
|
||||||
|
|
||||||
//handle mousedown event to show the image in a large view
|
//handle mousedown event to show the image in a large view
|
||||||
|
@ -509,45 +509,90 @@
|
|||||||
|
|
||||||
/*************************************** IMAGERY IN TIMESTRIP VIEWS */
|
/*************************************** IMAGERY IN TIMESTRIP VIEWS */
|
||||||
.c-imagery-tsv {
|
.c-imagery-tsv {
|
||||||
div.c-imagery-tsv__image-wrapper {
|
$m: $interiorMargin;
|
||||||
|
@include abs();
|
||||||
|
|
||||||
|
&-container {
|
||||||
|
background: $colorPlotBg;
|
||||||
|
box-shadow: inset $colorPlotAreaBorder 0 0 0 1px; // Using box-shadow instead of border to not affect box size
|
||||||
|
position: absolute;
|
||||||
|
top: $m; right: 0; bottom: $m; left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c-imagery-tsv__image-wrapper {
|
||||||
|
$m: $interiorMarginSm;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: $m; bottom: $m;
|
||||||
display: flex;
|
display: flex;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
margin-top: 5px;
|
|
||||||
|
|
||||||
img {
|
img {
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
[class*='__image-handle'] {
|
.c-imagery-tsv {
|
||||||
background-color: $colorBodyFg;
|
&__image-handle {
|
||||||
|
box-shadow: rgba($colorEventLine, 0.5) 0 0 0px 4px;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__image-placeholder img {
|
||||||
|
filter: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
// img can be `display: none` when there's not enough space between tick lines
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__image-placeholder {
|
||||||
|
background-color: deeppink; //pushBack($colorBodyBg, 0.3);
|
||||||
|
$m: $interiorMargin;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: $m; right: auto; bottom: $m; left: 0;
|
||||||
|
|
||||||
|
img {
|
||||||
|
filter: brightness(0.8);
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
&__image-handle {
|
||||||
|
$lineW: $eventLineW;
|
||||||
|
$hitAreaW: 7px;
|
||||||
|
background-color: $colorEventLine;
|
||||||
|
transition: box-shadow 250ms ease-out;
|
||||||
|
top: 0; bottom: 0;
|
||||||
|
width: $lineW;
|
||||||
|
z-index: 3;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
// Extend hit area
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0; bottom: 0;
|
||||||
|
z-index: 0;
|
||||||
|
width: $hitAreaW;
|
||||||
|
transform: translateX(($hitAreaW - $lineW) * -0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__no-items {
|
&__no-items {
|
||||||
fill: $colorBodyFg !important;
|
fill: $colorBodyFg !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__image-handle {
|
|
||||||
background-color: rgba($colorBodyFg, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
&__image-placeholder {
|
|
||||||
background-color: pushBack($colorBodyBg, 0.3);
|
|
||||||
display: block;
|
|
||||||
align-self: flex-end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DON'T THINK THIS IS BEING USED
|
||||||
.c-image-canvas {
|
.c-image-canvas {
|
||||||
pointer-events: auto; // This allows the image element to receive a browser-level context click
|
pointer-events: auto; // This allows the image element to receive a browser-level context click
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user