diff options
| author | Zog | 2018-01-19 16:42:19 +0100 | 
|---|---|---|
| committer | Zog | 2018-02-02 14:32:09 +0100 | 
| commit | bb238237ee32f7bb96fd3add772d778a7e8c8503 (patch) | |
| tree | 984b76d60569cff5d099d9018053ed0f7bc3b7dd /app/javascript/referential_overview/index.coffee | |
| parent | 8dafca888d30a3dea4d710769d9c627ff86f8518 (diff) | |
| download | chouette-core-bb238237ee32f7bb96fd3add772d778a7e8c8503.tar.bz2 | |
Refs #3542 @2h; Various UI improvements (hopefully)
Diffstat (limited to 'app/javascript/referential_overview/index.coffee')
| -rw-r--r-- | app/javascript/referential_overview/index.coffee | 19 | 
1 files changed, 17 insertions, 2 deletions
diff --git a/app/javascript/referential_overview/index.coffee b/app/javascript/referential_overview/index.coffee index c9a266dea..31a689273 100644 --- a/app/javascript/referential_overview/index.coffee +++ b/app/javascript/referential_overview/index.coffee @@ -40,11 +40,12 @@ class window.ReferentialOverview      @currentOffset = 0      $(document).scroll (e)=>        @documentScroll(e) +    @documentScroll pageY: $(document).scrollTop()    showDay: (date)->      day = @container.find(".day.#{date}")      offset = day.offset().left -    parentOffset = @container.find(".right .inner").offset().left +    parentOffset = @currentOffset      @scrollTo parentOffset - offset    currentOffset: -> @@ -72,7 +73,21 @@ class window.ReferentialOverview      @container.find(".right .inner .lines").css "margin-left": "#{@currentOffset}px"      @container.find(".head .week:first-child").css "margin-left", "#{@currentOffset}px"      @timeTravel.scrolledTo 1 - (@minOffset() - @currentOffset) / @minOffset() - +    setTimeout => +      @movePeriodTitles() +    , 600 + +  movePeriodTitles: -> +    @_right_offset ||= @container.find('.right').offset().left +    @container.find(".shifted").removeClass("shifted").css "margin-left", 0 +    @container.find(".right .line").each (i, l) => +      $(l).find(".period").each (i, _p) => +        p = $(_p) +        offset = parseInt(p.css("left")) + @currentOffset +        if offset < 0 && - offset < p.width() +          offset = Math.min(-offset, p.width() - 100) +          p.find(".title").addClass("shifted").css "margin-left", offset + "px" +          return    documentScroll: (e)->      if @sticky  | 
