Skip to content

Commit

Permalink
Closes #7936
Browse files Browse the repository at this point in the history
- Layout converted to set `min-height` on top-most `c-swimlane` element.
Interior containers now use 100% height or absolute positioning.
- Removed `c-timeline-holder` from `c-events-tsv` in EventTimelineView.vue;
Refactored `c-events-tsv__contents` to be `js-events-tsv` as that was being used as a reference.
- New theme constant `eventLineW` sets event lines to be 1px wide for more precision.
  • Loading branch information
charlesh88 committed Dec 17, 2024
1 parent 20426fe commit 6bda108
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 32 deletions.
26 changes: 10 additions & 16 deletions src/plugins/events/components/EventTimelineView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
-->

<template>
<div
ref="events"
class="c-events-tsv c-timeline-holder c-events-tsv__contents"
:style="{ left: leftOffset + 'px' }"
/>
<div ref="events" class="c-events-tsv js-events-tsv" :style="{ left: leftOffset + 'px' }" />
</template>

<script>
Expand All @@ -40,11 +36,10 @@ import { useAlignment } from '../../../ui/composables/alignmentContext.js';
import eventData from '../mixins/eventData.js';

const PADDING = 1;
const ROW_HEIGHT = 100;
const CONTAINER_CLASS = 'c-events-tsv-container';
const CONTAINER_CLASS = 'c-events-tsv__container';
const NO_ITEMS_CLASS = 'c-events-tsv__no-items';
const EVENT_WRAPPER_CLASS = 'c-events-tsv__event-wrapper';
const EVENT_SELECTED_CLASS = '.c-event-selected';
const EVENT_SELECTED_CLASS = 'is-selected';
const ID_PREFIX = 'wrapper-';
const AXES_PADDING = 20;

Expand Down Expand Up @@ -295,7 +290,7 @@ export default {
let existingContainer = this.$el.querySelector(`.${CONTAINER_CLASS}`);
if (existingContainer) {
eventContainer = existingContainer;
eventContainer.style.maxWidth = `${containerWidth}px`;
// eventContainer.style.maxWidth = `${containerWidth}px`;
} else {
if (this.destroyEventsContainer) {
this.destroyEventsContainer();
Expand All @@ -315,7 +310,7 @@ export default {
},
template: `<swim-lane :is-nested="isNested" :hide-label="true">
<template v-slot:object>
<div class="c-events-tsv-container"/>
<div class="c-events-tsv__container"/>
</template>
</swim-lane>`
},
Expand All @@ -329,8 +324,8 @@ export default {
this.$refs.events.appendChild(component.$el);

eventContainer = component.$el.querySelector(`.${CONTAINER_CLASS}`);
eventContainer.style.maxWidth = `${containerWidth}px`;
eventContainer.style.height = `${containerHeight}px`;
// eventContainer.style.maxWidth = `${containerWidth}px`;
// eventContainer.style.height = `${containerHeight}px`;
}

return eventContainer;
Expand All @@ -348,7 +343,7 @@ export default {
}
},
plotNoItems(containerElement) {
const textElement = document.createElement('text');
const textElement = document.createElement('div');
textElement.classList.add(NO_ITEMS_CLASS);
textElement.innerHTML = 'No events within timeframe';

Expand All @@ -357,7 +352,7 @@ export default {
getEventWrapper(item) {
const id = `${ID_PREFIX}${item.time}`;

return this.$el.querySelector(`.c-events-tsv__contents div[id=${id}]`);
return this.$el.querySelector(`.js-events-tsv div[id=${id}]`);
},
plotEvents(item, containerElement) {
const existingEventWrapper = this.getEventWrapper(item);
Expand Down Expand Up @@ -433,8 +428,6 @@ export default {
eventWrapper.style.left = `${this.xScale(event.time)}px`;
const eventTickElement = document.createElement('div');
eventTickElement.classList.add('c-events-tsv__event-handle');
eventTickElement.style.width = '2px';
eventTickElement.style.height = `${String(ROW_HEIGHT - 10)}px`;
if (this.titleKey) {
const textToShow = event[this.titleKey];
eventWrapper.addEventListener('mouseover', () => {
Expand Down Expand Up @@ -492,6 +485,7 @@ export default {
}
},
toggleEventSelection(clickedEvent) {
console.log(clickedEvent);
this.selectedEvent?.classList.remove(EVENT_SELECTED_CLASS);
clickedEvent.classList.add(EVENT_SELECTED_CLASS);
this.selectedEvent = clickedEvent;
Expand Down
21 changes: 17 additions & 4 deletions src/plugins/events/components/events-view.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
.c-events-tsv {
$m: $interiorMargin;
overflow: hidden;
@include abs();

&__container {
// Holds event lines
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;
}

&__event-wrapper {
// Wraps an individual event line
// Also holds the hover flyout element
$c: $colorEventLine;
$lineW: 2px;
$hitAreaW: 6px;
$m: $interiorMargin;
$lineW: $eventLineW;
$hitAreaW: 7px;
$m: $interiorMarginSm;
background-color: rgba($c, 0.6);
cursor: pointer;
position: absolute;
Expand Down Expand Up @@ -38,7 +48,10 @@
}

&__no-items {
fill: $colorBodyFg !important;
position: absolute;
left: $interiorMargin;
top: 50%;
transform: translateY(-50%);
}
}

Expand Down
15 changes: 9 additions & 6 deletions src/plugins/timeline/timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,25 @@
.c-timeline {
&__objects {
display: contents;

.c-swimlane {
min-height: 100px; // TEMP!! Will be replaced when heights are set by user
}
}

&__overlay-lines {
//background: rgba(deeppink, 0.2);
@include abs();
pointer-events: none; /* Allows clicks to pass through */
z-index: 10; /* Ensure it sits atop swimlanes */
pointer-events: none; // Allows clicks to pass through
z-index: 10; // Ensure it sits atop swimlanes
}

&__extended-line {
opacity: 0.3;
position: absolute;
top: 20px; // Offset down to line up with time axis ticks line
width: 2px;
pointer-events: auto;
background-color: $colorEventLine; //$colorBodyFg; /* Use desired color */
width: $eventLineW;
pointer-events: auto; // TODO: don't think we want this, extended lines shouldn't be accepting pointer events
background-color: $colorEventLineExtended;
}

&__extended-line-hovered {
Expand Down
1 change: 1 addition & 0 deletions src/styles/_constants-darkmatter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ $colorInProgressFgEm: $colorTimeRealtimeFg;
$colorGanttSelectedBorder: rgba(#fff, 0.3);
$colorEventLine: $colorBodyFg;
$colorEventLineExtended: rgba($colorEventLine, 0.3);
$eventLineW: 1px;

// Tree
$colorTreeBg: transparent;
Expand Down
1 change: 1 addition & 0 deletions src/styles/_constants-espresso.scss
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ $colorInProgressFgEm: $colorTimeRealtimeFg;
$colorGanttSelectedBorder: rgba(#fff, 0.3);
$colorEventLine: $colorBodyFg;
$colorEventLineExtended: rgba($colorEventLine, 0.3);
$eventLineW: 1px;

// Tree
$colorTreeBg: transparent;
Expand Down
1 change: 1 addition & 0 deletions src/styles/_constants-maelstrom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ $colorInProgressFgEm: $colorTimeRealtimeFg;
$colorGanttSelectedBorder: rgba(#fff, 0.3);
$colorEventLine: $colorBodyFg;
$colorEventLineExtended: rgba($colorEventLine, 0.3);
$eventLineW: 1px;

// Tree
$colorTreeBg: transparent;
Expand Down
1 change: 1 addition & 0 deletions src/styles/_constants-snow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ $colorInProgressFgEm: $colorCurrentFgEm;
$colorGanttSelectedBorder: #fff;
$colorEventLine: $colorBodyFg;
$colorEventLineExtended: rgba($colorEventLine, 0.3);
$eventLineW: 1px;

// Tree
$colorTreeBg: transparent;
Expand Down
6 changes: 1 addition & 5 deletions src/ui/components/swim-lane/SwimLane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@
/>
</div>
</div>
<div
class="c-swimlane__lane-object"
:style="{ 'min-height': minHeight }"
:class="{ 'u-contents': showUcontents }"
>
<div class="c-swimlane__lane-object" :class="{ 'u-contents': showUcontents }">
<slot name="object"></slot>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/ui/components/swim-lane/swimlane.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
display: grid;
grid-template-columns: 100px 100px 1fr;
grid-column-gap: 1px;
grid-row-gap: 1px; // Is this being used?
grid-row-gap: 1px; // Used for grid within a swimlane for Plan views
width: 100%;

&.is-status--draft {
Expand All @@ -43,6 +43,7 @@

&__lane-object {
background: rgba(black, 0.1);
height: 100%;

.c-plan {
display: contents;
Expand Down

0 comments on commit 6bda108

Please sign in to comment.