Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ec5e3220

Přidáno uživatelem Martin Sebela před téměř 4 roky(ů)

Re #8187 - implemented draggable timeline

Zobrazit rozdíly:

website/public/css/style.css
961 961
  height: 30px;
962 962
  flex-direction: row;
963 963
  position: relative;
964
  padding: 0 10px;
965 964
  border-radius: 100px;
966
  cursor: pointer;
967 965
  background-color: rgba(11, 21, 90, 0.7);
968 966
}
969 967

  
......
982 980
  }
983 981
}
984 982

  
983
.player .timeline .hour {
984
  cursor: pointer;
985
}
986

  
985 987
@media (max-width: 991.98px) {
986 988
  .player .timeline .hour {
987 989
    display: none;
988 990
  }
989 991
}
990 992

  
993
.player .timeline .hour:nth-of-type(2) {
994
  margin-left: 10px;
995
}
996

  
991 997
.player .timeline .hour:before {
992 998
  content: "";
993 999
  display: inline-block;
......
1012 1018
  display: inline-block;
1013 1019
  width: 6px;
1014 1020
  height: 6px;
1021
  margin-right: 10px;
1015 1022
  border-radius: 50%;
1016 1023
  background: #ffffff;
1017 1024
}
......
1026 1033
  display: flex;
1027 1034
  justify-content: center;
1028 1035
  align-items: center;
1029
  font-size: 15px;
1036
  width: 64px;
1030 1037
  padding: 3px 0 4px 0;
1031 1038
  z-index: 1000;
1039
  font-size: 15px;
1032 1040
  border-radius: 15px;
1041
  cursor: ew-resize;
1033 1042
  background: #0b155a;
1034
  width: 64px;
1035 1043
}
1036 1044

  
1037 1045
.player .time .custom-spinner-border {
website/public/css/style.scss
194 194
        margin-bottom: 20px;
195 195
        border: 0;
196 196
      }
197

  
197 198
      &:nth-of-type(3) {
198 199
        .dropdown {
199 200
          height: calc(100% + 10px) !important;
200 201
          margin: -5px;
201 202
          margin-top: -7px;
203

  
202 204
          .dropdown-menu {
203 205
            top: calc(100% - 4px);
204 206
          }
207

  
205 208
          button {
206 209
            padding-left: 20px;
207 210
            border-radius: 0px;
208 211
          }
212

  
209 213
          @include media-breakpoint-down(md) {
210 214
            height: 100% !important;
211 215
            margin: 0px;
212 216
            flex-direction: column;
217

  
213 218
            button {
214 219
              padding-left: 12px;
215 220
              border-radius: 5px;
......
217 222
          }
218 223
        }
219 224
      }
225

  
220 226
      &:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3) {
221 227
        width: 300px;
228
        
222 229
        @media (max-width: 1500px) {
223 230
          width: 280px;
224 231
        }
......
915 922
    height: 30px;
916 923
    flex-direction: row;
917 924
    position: relative;
918
    padding: 0 10px;
919 925
    border-radius: 100px;
920
    cursor: pointer;
921 926
    background-color: rgba(11, 21, 90, .7);
922 927

  
923 928
    @include media-breakpoint-down(md) {
......
932 937
    }
933 938

  
934 939
    .hour {
940
      cursor: pointer;
941

  
935 942
      @include media-breakpoint-down(md) {
936 943
        display: none;
937 944
      }
938 945

  
946
      &:nth-of-type(2) {
947
        margin-left: 10px;
948
      }
949

  
939 950
      &:before {
940 951
        content: "";
941 952
        display: inline-block;
......
961 972
      display: inline-block;
962 973
      width: 6px;
963 974
      height: 6px;
975
      margin-right: 10px;
964 976
      border-radius: 50%;
965 977
      background: $primary-text-color;
966 978

  
......
974 986
    display: flex;
975 987
    justify-content: center;
976 988
    align-items: center;
977
    font-size: 15px;
989
    width: 64px;
978 990
    padding: 3px 0 4px 0;
979 991
    z-index: 1000;
992
    font-size: 15px;
980 993
    border-radius: 15px;
994
    cursor: ew-resize;
981 995
    background: $secondary-bg-color;
982
    width: 64px;
983 996

  
984 997
    .custom-spinner-border {
985 998
      margin: 3px 0 4px 0;
website/public/js/zcu-heatmap.js
397 397
  if (loading) {
398 398
    return
399 399
  }
400

  
401
  $("#player-time").removeAttr("style");
402

  
400 403
  currentTime = (currentTime + 23) % 24
401 404
  changeHour(currentTime)
402 405
  mymap.closePopup()
......
412 415
  if (loading) {
413 416
    return
414 417
  }
418

  
419
  $("#player-time").removeAttr("style");
420
  
415 421
  currentTime = (currentTime + 1) % 24
416 422
  changeHour(currentTime)
417 423
  mymap.closePopup()
......
709 715
    datasetDictNameDisplayName[inputVal] = $(input).data('dataset-display-name')
710 716
  })
711 717
}
718

  
719
function dragTimeline() {
720
  let hourElemWidthPx = 26
721

  
722
  let elem = $("#player-time")
723
  let offset = elem.offset().left - elem.parent().offset().left
724

  
725
  elem.draggable({ containment: "parent", axis: "x", cursor: "ew-resize" })
726

  
727
  if (offset >= 0 && offset <= elem.parent().width()) {
728
    let hour = Math.round(offset / hourElemWidthPx)
729
    
730
    elem.attr("class", "time hour-" + hour)
731
    $("#player-time span").html(hour + ":00")
732

  
733
    onChangeHour(hour)
734
  }
735
}
website/templates/heatmap.html.twig
115 115
    <div class="animate-btn play" id="animate-btn" onclick="changeAnimationState()"></div>
116 116
    <div class="next-btn" onclick="next()"></div>
117 117

  
118
    <div class="timeline-wrapper" title="Animovat pouze v rámci jednoho dne">
118
    <div class="timeline-wrapper">
119 119
      {% if form.vars.value.date %}
120
      <div class="date" id="player-date" onclick="toggleDayLock()">
120
      <div class="date" id="player-date" onclick="toggleDayLock()" title="Animovat pouze v rámci jednoho dne">
121 121
        <span>{{ form.vars.value.date|date('j. n. Y') }}</span>
122 122
        <div class="lock-btn"></div>
123 123
      </div>
124 124
      {% endif %}
125 125

  
126 126
      <div class="timeline">
127
        <div class="time hour-{{ current_time }}" id="player-time">
127
        <div class="time hour-{{ current_time }}" id="player-time" draggable="true" ondrag="dragTimeline()">
128 128
          <span></span>
129 129
          <div class="spinner-border spinner-border-sm custom-spinner-border" role="status">
130
            <span class="sr-only">Loading...</span>
130
            <span class="sr-only">Loading&hellip;</span>
131 131
          </div>
132

  
133 132
        </div>
134 133
        {% for i in 0..23 %}
135 134
        <div class="hour" title="{{ i }}:00" onclick="onChangeHour('{{ i }}')"></div>
......
151 150
    <script src="{{ asset('js/vendor/bootstrap-datepicker.cs.min.js') }}"></script>
152 151
    <script src="{{ asset('js/vendor/leaflet.js') }}"></script>
153 152
    <script src="{{ asset('js/vendor/leaflet-heat.js') }}"></script>
153
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
154 154
    <script src="{{ asset('js/zcu-heatmap.js') }}"></script>
155 155
    <script>
156 156
      initDatepicker("{{ path('dates') }}");

Také k dispozici: Unified diff