Skip to content

Commit 9522040

Browse files
committed
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.
1 parent 5b28086 commit 9522040

File tree

2 files changed

+64
-27
lines changed

2 files changed

+64
-27
lines changed

src/plugins/imagery/components/ImageryTimeView.vue

+7-15
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-->
2222

2323
<template>
24-
<div ref="imagery" class="c-imagery-tsv c-timeline-holder">
24+
<div ref="imagery" class="c-imagery-tsv js-imagery-tsv">
2525
<div ref="imageryHolder" class="c-imagery-tsv__contents u-contents"></div>
2626
</div>
2727
</template>
@@ -37,8 +37,6 @@ import { PREVIEW_ACTION_KEY } from '@/ui/preview/PreviewAction.js';
3737
import imageryData from '../../imagery/mixins/imageryData.js';
3838

3939
const PADDING = 1;
40-
const ROW_HEIGHT = 100;
41-
const IMAGE_SIZE = 85;
4240
const IMAGE_WIDTH_THRESHOLD = 25;
4341
const CONTAINER_CLASS = 'c-imagery-tsv-container';
4442
const NO_ITEMS_CLASS = 'c-imagery-tsv__no-items';
@@ -73,9 +71,11 @@ export default {
7371
mounted() {
7472
this.previewAction = this.openmct.actions.getAction(PREVIEW_ACTION_KEY);
7573

76-
this.canvas = this.$refs.imagery.appendChild(document.createElement('canvas'));
77-
this.canvas.height = 0;
78-
this.canvasContext = this.canvas.getContext('2d');
74+
// Why are we doing this? This element causes scroll problems in the swimlane.
75+
// this.canvas = this.$refs.imagery.appendChild(document.createElement('canvas'));
76+
// this.canvas.height = 0;
77+
// this.canvas.width = 10;
78+
// this.canvasContext = this.canvas.getContext('2d');
7979
this.setDimensions();
8080

8181
this.setScaleAndPlotImagery = this.setScaleAndPlotImagery.bind(this);
@@ -207,8 +207,8 @@ export default {
207207
setDimensions() {
208208
const imageryHolder = this.$refs.imagery;
209209
this.width = this.getClientWidth();
210-
211210
this.height = Math.round(imageryHolder.getBoundingClientRect().height);
211+
this.imageHeight = this.height - 10;
212212
},
213213
setScale(timeSystem) {
214214
if (!this.width) {
@@ -233,7 +233,6 @@ export default {
233233
return imageObj.time <= this.viewBounds.end && imageObj.time >= this.viewBounds.start;
234234
},
235235
getImageryContainer() {
236-
let containerHeight = 100;
237236
let containerWidth = this.imageHistory.length ? this.width : 200;
238237
let imageryContainer;
239238

@@ -271,7 +270,6 @@ export default {
271270

272271
imageryContainer = component.$el.querySelector(`.${CONTAINER_CLASS}`);
273272
imageryContainer.style.maxWidth = `${containerWidth}px`;
274-
imageryContainer.style.height = `${containerHeight}px`;
275273
}
276274

277275
return imageryContainer;
@@ -380,24 +378,18 @@ export default {
380378
//create image vertical tick indicator
381379
let imageTickElement = document.createElement('div');
382380
imageTickElement.classList.add('c-imagery-tsv__image-handle');
383-
imageTickElement.style.width = '2px';
384-
imageTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`;
385381
imageWrapper.appendChild(imageTickElement);
386382

387383
//create placeholder - this will also hold the actual image
388384
let imagePlaceholder = document.createElement('div');
389385
imagePlaceholder.classList.add('c-imagery-tsv__image-placeholder');
390-
imagePlaceholder.style.width = `${IMAGE_SIZE}px`;
391-
imagePlaceholder.style.height = `${IMAGE_SIZE}px`;
392386
imageWrapper.appendChild(imagePlaceholder);
393387

394388
//create image element
395389
let imageElement = document.createElement('img');
396390
this.setNSAttributesForElement(imageElement, {
397391
src: image.thumbnailUrl || image.url
398392
});
399-
imageElement.style.width = `${IMAGE_SIZE}px`;
400-
imageElement.style.height = `${IMAGE_SIZE}px`;
401393
this.setImageDisplay(imageElement, showImagePlaceholders);
402394

403395
//handle mousedown event to show the image in a large view

src/plugins/imagery/components/imagery-view.scss

+57-12
Original file line numberDiff line numberDiff line change
@@ -509,45 +509,90 @@
509509

510510
/*************************************** IMAGERY IN TIMESTRIP VIEWS */
511511
.c-imagery-tsv {
512-
div.c-imagery-tsv__image-wrapper {
512+
$m: $interiorMargin;
513+
@include abs();
514+
515+
&-container {
516+
background: $colorPlotBg;
517+
box-shadow: inset $colorPlotAreaBorder 0 0 0 1px; // Using box-shadow instead of border to not affect box size
518+
position: absolute;
519+
top: $m; right: 0; bottom: $m; left: 0;
520+
}
521+
522+
.c-imagery-tsv__image-wrapper {
523+
$m: $interiorMarginSm;
513524
cursor: pointer;
514525
position: absolute;
515-
top: 0;
526+
top: $m; bottom: $m;
516527
display: flex;
517528
z-index: 1;
518-
margin-top: 5px;
519529

520530
img {
521531
align-self: flex-end;
522532
}
533+
523534
&:hover {
524535
z-index: 2;
525536

526-
[class*='__image-handle'] {
527-
background-color: $colorBodyFg;
537+
.c-imagery-tsv {
538+
&__image-handle {
539+
box-shadow: rgba($colorEventLine, 0.5) 0 0 0px 4px;
540+
transition: none;
541+
}
542+
543+
&__image-placeholder img {
544+
filter: none;
545+
}
528546
}
529547

530548
img {
549+
// img can be `display: none` when there's not enough space between tick lines
531550
display: block !important;
532551
}
533552
}
534553
}
535554

536-
&__no-items {
537-
fill: $colorBodyFg !important;
555+
&__image-placeholder {
556+
background-color: deeppink; //pushBack($colorBodyBg, 0.3);
557+
$m: $interiorMargin;
558+
display: block;
559+
position: absolute;
560+
top: $m; right: auto; bottom: $m; left: 0;
561+
562+
img {
563+
filter: brightness(0.8);
564+
height: 100%;
565+
}
538566
}
539567

568+
540569
&__image-handle {
541-
background-color: rgba($colorBodyFg, 0.5);
570+
$lineW: $eventLineW;
571+
$hitAreaW: 7px;
572+
background-color: $colorEventLine;
573+
transition: box-shadow 250ms ease-out;
574+
top: 0; bottom: 0;
575+
width: $lineW;
576+
z-index: 3;
577+
578+
&:before {
579+
// Extend hit area
580+
content: '';
581+
display: block;
582+
position: absolute;
583+
top: 0; bottom: 0;
584+
z-index: 0;
585+
width: $hitAreaW;
586+
transform: translateX(($hitAreaW - $lineW) * -0.5);
587+
}
542588
}
543589

544-
&__image-placeholder {
545-
background-color: pushBack($colorBodyBg, 0.3);
546-
display: block;
547-
align-self: flex-end;
590+
&__no-items {
591+
fill: $colorBodyFg !important;
548592
}
549593
}
550594

595+
// DON'T THINK THIS IS BEING USED
551596
.c-image-canvas {
552597
pointer-events: auto; // This allows the image element to receive a browser-level context click
553598
position: absolute;

0 commit comments

Comments
 (0)