Revize 815159f3
Přidáno uživatelem Tomáš Ballák před více než 4 roky(ů)
website/public/js/zcu-heatmap.js | ||
---|---|---|
5 | 5 |
var heatmapLayer = null |
6 | 6 |
var marksLayer = null |
7 | 7 |
|
8 |
// values for arrow keys |
|
9 |
const arrowKeyLEFT = 37 |
|
10 |
const arrowKeyRIGHT = 39 |
|
11 |
|
|
8 | 12 |
var startX = 49.7248 |
9 | 13 |
var startY = 13.3521 |
10 | 14 |
var startZoom = 17 |
... | ... | |
186 | 190 |
} |
187 | 191 |
} |
188 | 192 |
|
193 |
const onArrowLeftRightKeysDownRegister = () => { |
|
194 |
$(document).keydown(function (e) { |
|
195 |
const { which } = e |
|
196 |
if (which === arrowKeyLEFT) { |
|
197 |
previous() |
|
198 |
} else if (which === arrowKeyRIGHT) { |
|
199 |
next() |
|
200 |
} |
|
201 |
e.preventDefault() |
|
202 |
}) |
|
203 |
} |
|
204 |
|
|
189 | 205 |
const debounce = (func, delay) => { |
190 | 206 |
let inDebounce |
191 | 207 |
return function () { |
... | ... | |
398 | 414 |
return |
399 | 415 |
} |
400 | 416 |
|
401 |
$("#player-time").removeAttr("style"); |
|
402 |
|
|
403 | 417 |
currentTime = (currentTime + 23) % 24 |
404 | 418 |
changeHour(currentTime) |
405 | 419 |
mymap.closePopup() |
... | ... | |
416 | 430 |
return |
417 | 431 |
} |
418 | 432 |
|
419 |
$("#player-time").removeAttr("style"); |
|
420 |
|
|
421 | 433 |
currentTime = (currentTime + 1) % 24 |
422 | 434 |
changeHour(currentTime) |
423 | 435 |
mymap.closePopup() |
... | ... | |
470 | 482 |
} |
471 | 483 |
|
472 | 484 |
const changeHour = (hour) => { |
485 |
$('#player-time').removeAttr('style') |
|
473 | 486 |
changeCurrentTime(hour) |
474 | 487 |
updateHeaderControls() |
475 | 488 |
setTimeline() |
... | ... | |
700 | 713 |
changeCurrentTime() |
701 | 714 |
changeCurrentDate() |
702 | 715 |
onValueChangeRegister() |
716 |
onArrowLeftRightKeysDownRegister() |
|
703 | 717 |
} |
704 | 718 |
|
705 | 719 |
const loadCheckboxDatasetNameData = () => { |
... | ... | |
716 | 730 |
}) |
717 | 731 |
} |
718 | 732 |
|
719 |
function dragTimeline() { |
|
720 |
let hourElemWidthPx = 26
|
|
733 |
function dragTimeline () {
|
|
734 |
const hourElemWidthPx = 26
|
|
721 | 735 |
|
722 |
let elem = $("#player-time")
|
|
723 |
let offset = elem.offset().left - elem.parent().offset().left
|
|
736 |
const elem = $('#player-time')
|
|
737 |
const offset = elem.offset().left - elem.parent().offset().left
|
|
724 | 738 |
|
725 |
elem.draggable({ containment: "parent", axis: "x", cursor: "ew-resize" })
|
|
739 |
elem.draggable({ containment: 'parent', axis: 'x', cursor: 'ew-resize' })
|
|
726 | 740 |
|
727 | 741 |
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")
|
|
742 |
const hour = Math.round(offset / hourElemWidthPx)
|
|
743 |
|
|
744 |
elem.attr('class', 'time hour-' + hour)
|
|
745 |
$('#player-time span').html(hour + ':00')
|
|
732 | 746 |
|
733 | 747 |
onChangeHour(hour) |
734 | 748 |
} |
735 |
} |
|
749 |
} |
Také k dispozici: Unified diff
done