Skip to content

Commit

Permalink
- Display loader until all data is loaded when switching between stat…
Browse files Browse the repository at this point in the history
…e/county view.

   - Fixed a bug that prevented users from dragging the map when switching tabs.
   - Update leaflet to the latest version.
  • Loading branch information
kvargha committed Apr 18, 2024
1 parent 5561961 commit ab593d4
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v.0.9.5 (2024-4-18):
- Display loader until all data is loaded when switching between state/county view.
- Fixed a bug that prevented users from dragging the map when switching tabs.
- Update leaflet to the latest version.
## v.0.9.4 (2024-1-31):
- Display loader until all data is loaded.
- Modify server configuration to turn off caching.
Expand Down
22 changes: 13 additions & 9 deletions cdph/www/lib/leafletjs/leaflet.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
padding: 0;
}

.leaflet-container img.leaflet-tile {
/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
mix-blend-mode: plus-lighter;
}

.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
Expand Down Expand Up @@ -423,8 +428,11 @@ svg.leaflet-image-layer.leaflet-interactive path {
.leaflet-control-attribution a:focus {
text-decoration: underline;
}
.leaflet-control-attribution svg {
.leaflet-attribution-flag {
display: inline !important;
vertical-align: baseline !important;
width: 1em;
height: 0.6669em;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
Expand All @@ -438,12 +446,10 @@ svg.leaflet-image-layer.leaflet-interactive path {
line-height: 1.1;
padding: 2px 5px 1px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: border-box;
box-sizing: border-box;

background: #fff;
background: rgba(255, 255, 255, 0.5);
background: rgba(255, 255, 255, 0.8);
text-shadow: 1px 1px #fff;
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
Expand Down Expand Up @@ -537,8 +543,6 @@ svg.leaflet-image-layer.leaflet-interactive path {
}
.leaflet-popup-scrolled {
overflow: auto;
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}

.leaflet-oldie .leaflet-popup-content-wrapper {
Expand Down Expand Up @@ -647,11 +651,11 @@ svg.leaflet-image-layer.leaflet-interactive path {
}

/* Printing */

@media print {
/* Prevent printers from removing background-images of controls. */
.leaflet-control {
-webkit-print-color-adjust: exact;
color-adjust: exact;
print-color-adjust: exact;
}
}
6 changes: 3 additions & 3 deletions cdph/www/lib/leafletjs/leaflet.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cdph/www/lib/leafletjs/leaflet.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cdph/www/scripts/datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ function loadData(dataArr, type, taxoniumURL = '') {
}
setGridView();

// Hide loader
if (basicDataLoaded && sampleDataLoaded) {
const loadingOverlay = document.getElementById('loading_overlay');
loadingOverlay.style.display = 'none';
Expand Down
25 changes: 25 additions & 0 deletions cdph/www/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ for (j = 0; j < 2; j++) {
}
}

/*
Re-enable dragging on leaflet map when it's clicked.
Solves an issue where you move your mouse outside of the DOM
and back into it, then it doesn't let you drag the lab.
This is due to the leaflet-gesture-handling library.
*/
window.addEventListener('DOMContentLoaded', () => {
const mapDiv = document.getElementById('mapid');
if (mapDiv) {
mapDiv.addEventListener('click', () => {
console.log('test');
map.dragging.enable();
map.scrollWheelZoom.enable();
if (map.tap) {
map.tap.enable();
}
});
} else {
console.error("Element with ID 'mapid' not found.");
}
});

function maxClusterCt(region_id,timel,map_layer) {
let maxn = 0;
Expand Down Expand Up @@ -296,6 +317,10 @@ function changeScale() {
}

function swap_countystate() {
// Show loader
const loadingOverlay = document.getElementById('loading_overlay');
loadingOverlay.style.display = 'flex';

var btn = document.getElementById('btn_SC');
color_scale = 'log';
global_state = 'default';
Expand Down

0 comments on commit ab593d4

Please sign in to comment.