- Fix left and right `alignmentData` offsets in
EventTimelineView.vue, ImageryTimeView.vue and ActivityTimeline.vue.
This commit is contained in:
Charles Hacskaylo 2024-12-19 18:09:17 -08:00
parent f163034e18
commit 0933d27ce6
4 changed files with 41 additions and 14 deletions

View File

@ -21,7 +21,7 @@
--> -->
<template> <template>
<div ref="events" class="c-events-tsv js-events-tsv" :style="{ left: leftOffset + 'px' }" /> <div ref="events" class="c-events-tsv js-events-tsv" :style="alignmentStyle" />
</template> </template>
<script> <script>
@ -69,8 +69,15 @@ export default {
}; };
}, },
computed: { computed: {
leftOffset() { alignmentStyle() {
return this.alignmentData.leftWidth + AXES_PADDING; let leftOffset = 0;
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
if (this.alignmentData.leftWidth) {
leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING;
}
return {
margin: `0 ${this.alignmentData.rightWidth + rightOffset}px 0 ${this.alignmentData.leftWidth + leftOffset}px`
};
} }
}, },
watch: { watch: {

View File

@ -21,7 +21,7 @@
--> -->
<template> <template>
<div ref="imagery" class="c-imagery-tsv js-imagery-tsv" :style="{ left: leftOffset + 'px' }"> <div ref="imagery" class="c-imagery-tsv js-imagery-tsv" :style="alignmentStyle">
<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>
@ -71,8 +71,15 @@ export default {
}; };
}, },
computed: { computed: {
leftOffset() { alignmentStyle() {
return this.alignmentData.leftWidth + AXES_PADDING; let leftOffset = 0;
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
if (this.alignmentData.leftWidth) {
leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING;
}
return {
margin: `0 ${this.alignmentData.rightWidth + rightOffset}px 0 ${this.alignmentData.leftWidth + leftOffset}px`
};
} }
}, },
watch: { watch: {

View File

@ -26,7 +26,7 @@
</template> </template>
<template #object> <template #object>
<div class="c-plan-av" :style="alignmentStyle"> <div class="c-plan-av" :style="alignmentStyle">
<svg v-if="activities.length > 0" :height="height" :width="svgWidth"> <svg v-if="activities.length > 0" class="c-plan-av__svg" :height="height">
<symbol id="activity-bar-bg" :height="rowHeight" width="2" preserveAspectRatio="none"> <symbol id="activity-bar-bg" :height="rowHeight" width="2" preserveAspectRatio="none">
<rect x="0" y="0" width="100%" height="100%" fill="currentColor" /> <rect x="0" y="0" width="100%" height="100%" fill="currentColor" />
<line <line
@ -157,24 +157,27 @@ export default {
computed: { computed: {
alignmentStyle() { alignmentStyle() {
let leftOffset = 0; let leftOffset = 0;
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
if (this.alignmentData.leftWidth) { if (this.alignmentData.leftWidth) {
leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING; leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING;
} }
return { return {
left: `${this.alignmentData.leftWidth + leftOffset}px` margin: `0 ${this.alignmentData.rightWidth + rightOffset}px 0 ${this.alignmentData.leftWidth + leftOffset}px`
}; };
}, },
svgWidth() { svgWidth() {
// Reduce the width by left axis width, then take off the right yaxis width as well // Reduce the width by left axis width, then take off the right yaxis width as well
return '100%'; // TEMP!
/*
let leftOffset = 0; let leftOffset = 0;
if (this.alignmentData.leftWidth) { if (this.alignmentData.leftWidth) {
leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING; leftOffset = this.alignmentData.multiple ? 2 * AXES_PADDING : AXES_PADDING;
} }
const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0; const rightOffset = this.alignmentData.rightWidth ? AXES_PADDING : 0;
return ( return (
this.width - this.width -
(this.alignmentData.leftWidth + leftOffset + this.alignmentData.rightWidth + rightOffset) (this.alignmentData.leftWidth + leftOffset + this.alignmentData.rightWidth + rightOffset)
); );*/
} }
}, },
methods: { methods: {

View File

@ -27,11 +27,10 @@
text { text {
stroke: none; stroke: none;
} }
}
&-av { .c-swimlane__lane-object {
// Activities view display: flex;
@include abs(); }
} }
&__activity { &__activity {
@ -58,3 +57,14 @@
display: none; display: none;
} }
} }
.c-plan-av {
// Activities view
background-color: $colorPlotBg;
flex: 1 1 auto;
height: 100%;
&__svg {
width: 100%;
}
}