diff --git a/app/assets/stylesheets/content/work_packages/timelines/_slider.sass b/app/assets/stylesheets/content/work_packages/timelines/_slider.sass new file mode 100644 index 0000000000..41a9076b45 --- /dev/null +++ b/app/assets/stylesheets/content/work_packages/timelines/_slider.sass @@ -0,0 +1,46 @@ +.wp-timeline--slider-wrapper + position: absolute + bottom: 0 + z-index: 101 + + +// Slider +.noUi-horizontal.wp-timeline--slider + padding-right: 32px + + .noUi-handle + left: -1px + height: calc(1rem - 2px) + top: 0 + box-shadow: none + background: $gray + + &:before, &:after + height: calc(1rem - 6px) + top: 1px + background: $light-gray + + &:before + left: calc(50% - 1px) + &:after + left: calc(50% + 1px) + + .noUi-origin + right: -32px + + +// Scroll slider +.wp-timeline--slider + position: relative + height: 1rem + border-radius: none + + .ui-slider-handle + position: absolute + top: 0 + width: 1rem + height: 100% + cursor: default + touch-action: none + border-radius: none + background: $primary-color diff --git a/app/assets/stylesheets/content/work_packages/timelines/_timelines.sass b/app/assets/stylesheets/content/work_packages/timelines/_timelines.sass index a6f6da4e5b..fbd8ce044e 100644 --- a/app/assets/stylesheets/content/work_packages/timelines/_timelines.sass +++ b/app/assets/stylesheets/content/work_packages/timelines/_timelines.sass @@ -11,7 +11,7 @@ .wp-timeline-header-container.generic-table--sort-header-outer padding: 0 z-index: 100 - margin-left: -2px + margin-left: -5px height: $generic-table--header-height &:hover @@ -20,7 +20,7 @@ display: block .wp-timeline--scroll-wrapper - border-left: 2px solid $primary-color-dark + border-left: 5px solid $gray // The scroll wrapper is resized to span the entire table. // Without this, scroll is caught by the header. @@ -30,25 +30,4 @@ // Overflow must be hidden since the width of the column is fixed. // Since height is explicitly set, this is effectively // overflow-x: hidden / overflow-y: visible - overflow: hidden - -// Scroll slider container -// (To maintain border style) -.wp-timeline--slider-wrapper - border-left: 2px solid $primary-color-dark - -// Scroll slider -.wp-timeline--slider - position: relative - height: 1rem - border-radius: none - - .ui-slider-handle - position: absolute - top: 0 - width: 1rem - height: 100% - cursor: default - touch-action: none - border-radius: none - background: $primary-color \ No newline at end of file + overflow: hidden \ No newline at end of file diff --git a/app/assets/stylesheets/open_project_global/_variables.sass b/app/assets/stylesheets/open_project_global/_variables.sass index b6db85d8bf..d7493fe415 100644 --- a/app/assets/stylesheets/open_project_global/_variables.sass +++ b/app/assets/stylesheets/open_project_global/_variables.sass @@ -223,5 +223,5 @@ $table-header-shadow-color: #DDDDDD !default $generic-table--font-size: 0.875rem $generic-table--header-font-size: 0.875rem -$generic-table--header-height: 60px +$generic-table--header-height: 45px $generic-table--footer-height: 34px \ No newline at end of file diff --git a/frontend/app/components/wp-table/timeline/wp-timeline.header.ts b/frontend/app/components/wp-table/timeline/wp-timeline.header.ts index 7578b6c3c6..5762953df9 100644 --- a/frontend/app/components/wp-table/timeline/wp-timeline.header.ts +++ b/frontend/app/components/wp-table/timeline/wp-timeline.header.ts @@ -57,6 +57,7 @@ export class WpTimelineHeader { /** UI Scrollbar */ private scrollBar: HTMLElement; + private scrollWrapper: JQuery; private scrollBarHandle: JQuery; private scrollBarOrigin: JQuery; @@ -91,7 +92,8 @@ export class WpTimelineHeader { } setupScrollbar() { - this.scrollBar = this.outerHeader.find('.wp-timeline--slider')[0]; + this.scrollWrapper = jQuery('.wp-timeline--slider-wrapper'); + this.scrollBar = this.scrollWrapper.find('.wp-timeline--slider')[0]; noUiSlider.create(this.scrollBar, { start: [0], range: { @@ -106,21 +108,10 @@ export class WpTimelineHeader { let value = values[0]; this.wpTimeline.viewParameterSettings.scrollOffsetInDays = -value; this.wpTimeline.refreshScrollOnly(); - - //this.recalculateScrollBarLeftMargin(value); }); - // this.scrollBar.slider({ - // min: 0, - // slide: (evt, ui) => { - // this.wpTimeline.viewParameterSettings.scrollOffsetInDays = -ui.value; - // this.wpTimeline.refreshScrollOnly();≥ - - // this.recalculateScrollBarLeftMargin(ui.value); - // } - // }); - - this.scrollBarHandle = this.outerHeader.find('.noUi-handle'); - this.scrollBarOrigin = this.outerHeader.find('.noUi-origin'); + + this.scrollBarHandle = this.scrollWrapper.find('.noUi-handle'); + this.scrollBarOrigin = this.scrollWrapper.find('.noUi-origin'); } // noUiSlider doesn't extend the HTMLElement interface @@ -130,6 +121,9 @@ export class WpTimelineHeader { } private updateScrollbar(vp: TimelineViewParameters) { + // Update the scollbar to match the current width + this.scrollWrapper.css('width', this.outerHeader.width() + 'px'); + let maxWidth = this.scrollBar.offsetWidth, daysDisplayed = Math.min(vp.maxSteps, Math.floor(maxWidth / vp.pixelPerDay)), newMax = Math.max(vp.maxSteps - daysDisplayed, 1), diff --git a/frontend/app/components/wp-table/wp-table.directive.html b/frontend/app/components/wp-table/wp-table.directive.html index dbe98ccdc3..16f000f441 100644 --- a/frontend/app/components/wp-table/wp-table.directive.html +++ b/frontend/app/components/wp-table/wp-table.directive.html @@ -42,10 +42,10 @@