Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ac154afa

Přidáno uživatelem Martin Sebela před více než 3 roky(ů)

Re #8191 - fixed popup bug and refactoring

Zobrazit rozdíly:

website/public/js/zcu-heatmap.js
404 404
// eslint-disable-next-line no-unused-vars
405 405
function setPreviousPageInPopup () {
406 406
  const countPagesInPopup = getCountPagesInPopup()
407
  const newPage = currentPageInPopup
407
  const page = currentPageInPopup
408 408

  
409 409
  currentPageInPopup = (currentPageInPopup + countPagesInPopup - 1) % countPagesInPopup
410
  setPageContentInPopup(newPage)
410
  setPageContentInPopup(page)
411 411
}
412 412

  
413 413
// eslint-disable-next-line no-unused-vars
414 414
function setNextPageInPopup () {
415 415
  const countPagesInPopup = getCountPagesInPopup()
416
  const newPage = currentPageInPopup
416
  const page = currentPageInPopup
417 417

  
418 418
  currentPageInPopup = (currentPageInPopup + 1) % countPagesInPopup
419
  setPageContentInPopup(newPage)
419
  setPageContentInPopup(page)
420 420
}
421 421

  
422 422
function setPageContentInPopup (page) {
......
510 510
  )
511 511
}
512 512

  
513
const formatTime = (hours, twoDigitsHours = false) => {
514
  return ((twoDigitsHours && hours < 10) ? '0' : '') + hours + ':00';
515
}
516

  
513 517
const updateHeaderControls = () => {
514 518
  $(`#time_${currentTime}`).prop('checked', true)
515
  $('#dropdownMenuButtonTime').html((currentTime < 10 ? '0' : '') + `${currentTime}:00`)
519
  $('#dropdownMenuButtonTime').html(formatTime(currentTime, true))
516 520
}
517 521

  
518 522
const setTimeline = () => {
519
  $('#player-time > span').text(currentTime + ':00')
523
  $('#player-time > span').text(formatTime(currentTime))
520 524
  $('#player-time').attr('class', 'time hour-' + currentTime)
521 525
}
522 526

  
......
691 695
  if (mergedPoints.length) {
692 696
    heatmapLayer = L.heatLayer(mergedPoints, { max: max, minOpacity: 0.5, radius: 35, blur: 30 }).addTo(mymap)
693 697
  }
698

  
699
  // timto vyresen bug #8191 - TODO: znamena to, ze muzeme smazat volani updatePopup() ve funkcich, kde se nejdriv vola drawHeatmap() a pak updatePopup()?
700
  updatePopup()
694 701
}
695 702

  
696 703
/**
......
818 825

  
819 826
    if (hour !== currentTime) {
820 827
      elem.attr('class', 'time hour-' + hour)
821
      $('#player-time span').html(hour + ':00')
828
      $('#player-time span').html(formatTime(hour))
822 829

  
823 830
      onChangeHour(hour)
824 831
    }

Také k dispozici: Unified diff