Skip to content

Commit e0a02a0

Browse files
committed
Increase hover radius
1 parent ae9396c commit e0a02a0

File tree

2 files changed

+89
-13
lines changed

2 files changed

+89
-13
lines changed

index.html

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,24 @@
264264
overflow-x: hidden;
265265
padding: 20px 0;
266266
">
267+
<!-- Close Button (shown only when manually opened) -->
268+
<button id="loading-overlay-close" style="
269+
display: none;
270+
position: fixed;
271+
top: 20px;
272+
right: 20px;
273+
z-index: 10001;
274+
background: none;
275+
border: none;
276+
color: rgba(255, 255, 255, 0.6);
277+
font-size: 32px;
278+
line-height: 1;
279+
cursor: pointer;
280+
transition: all 0.2s ease;
281+
padding: 0;
282+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
283+
" onmouseover="this.style.color='rgba(239, 68, 68, 0.9)'; this.style.transform='scale(1.1)'" onmouseout="this.style.color='rgba(255, 255, 255, 0.6)'; this.style.transform='scale(1)'">&times;</button>
284+
267285
<!-- Animated Background -->
268286
<div style="
269287
position: absolute;
@@ -622,11 +640,12 @@
622640
proceedNormally: false,
623641
mapReady: false,
624642
manualOverlayControl: hasURLParams,
625-
shouldShowAtlasPicker: !hasURLParams && !hashLocation
643+
shouldShowAtlasPicker: false // Will be set later based on conditions
626644
};
627645

628646
const atlasPickerContainer = document.getElementById('atlas-picker-container');
629647
const atlasPickerHeading = document.getElementById('atlas-picker-heading');
648+
const loadingOverlayClose = document.getElementById('loading-overlay-close');
630649

631650
/**
632651
* Create an atlas card element
@@ -904,6 +923,11 @@
904923
userInteracted = true; // Prevent auto-close when manually opened
905924
autoProceedCancelled = true;
906925

926+
// Show close button when manually opened
927+
if (loadingOverlayClose) {
928+
loadingOverlayClose.style.display = 'block';
929+
}
930+
907931
// Always show atlas picker when manually opening
908932
if (atlasPickerHeading) atlasPickerHeading.style.display = 'block';
909933
if (atlasPickerContainer) atlasPickerContainer.style.display = 'grid';
@@ -916,8 +940,29 @@
916940
}
917941
}
918942

919-
// Expose openLoadingScreen globally
943+
function closeLoadingScreen() {
944+
if (loadingOverlay) {
945+
loadingOverlay.style.opacity = '0';
946+
loadingOverlay.style.transition = 'opacity 0.3s ease';
947+
setTimeout(() => {
948+
loadingOverlay.style.display = 'none';
949+
}, 300);
950+
951+
// Hide close button
952+
if (loadingOverlayClose) {
953+
loadingOverlayClose.style.display = 'none';
954+
}
955+
}
956+
}
957+
958+
// Close button click handler
959+
if (loadingOverlayClose) {
960+
loadingOverlayClose.addEventListener('click', closeLoadingScreen);
961+
}
962+
963+
// Expose functions globally
920964
window.openLoadingScreen = openLoadingScreen;
965+
window.closeLoadingScreen = closeLoadingScreen;
921966

922967

923968
async function handleGeolocation(showStatusMessages = true) {
@@ -1059,14 +1104,18 @@
10591104
// Always show requested-map-section
10601105
requestedMapSection.style.display = 'block';
10611106

1107+
// Always show atlas picker for quick access
1108+
if (atlasPickerHeading) atlasPickerHeading.style.display = 'block';
1109+
if (atlasPickerContainer) atlasPickerContainer.style.display = 'grid';
1110+
1111+
// Load atlas cards immediately
1112+
loadFeaturedAtlases();
1113+
10621114
// Determine if we should show atlas picker
10631115
const shouldShowAtlasPicker = !hasURLParams && !hashLocation;
1116+
window.loadingStartupState.shouldShowAtlasPicker = shouldShowAtlasPicker;
10641117

10651118
if (hasURLParams) {
1066-
// Hide atlas picker for URL params
1067-
if (atlasPickerHeading) atlasPickerHeading.style.display = 'none';
1068-
if (atlasPickerContainer) atlasPickerContainer.style.display = 'none';
1069-
10701119
// Show URL info and cancel button for URL params
10711120
const urlParams = new URLSearchParams(window.location.search);
10721121
const atlas = urlParams.get('atlas');
@@ -1101,12 +1150,13 @@
11011150
cancelAutoProceedBtn.addEventListener('click', cancelAutoProceed);
11021151
}
11031152

1153+
// Update heading to indicate current and alternative options
1154+
if (atlasPickerHeading) {
1155+
atlasPickerHeading.textContent = 'Or explore other atlases:';
1156+
}
1157+
11041158
window.loadingStartupState.proceedNormally = true;
11051159
} else if (hashLocation) {
1106-
// Hide atlas picker for hash location
1107-
if (atlasPickerHeading) atlasPickerHeading.style.display = 'none';
1108-
if (atlasPickerContainer) atlasPickerContainer.style.display = 'none';
1109-
11101160
// Location hash detected - use coordinates from URL
11111161
urlInfoContent.style.display = 'none';
11121162
if (cancelAutoProceedBtn) {
@@ -1115,6 +1165,11 @@
11151165

11161166
requestedMapStatus.innerHTML = `Using location from URL: <a href="${window.location.href}" style="color: #60a5fa; text-decoration: underline;">${hashLocation.lat.toFixed(6)}, ${hashLocation.lng.toFixed(6)}</a>`;
11171167

1168+
// Update heading
1169+
if (atlasPickerHeading) {
1170+
atlasPickerHeading.textContent = 'Or explore other atlases:';
1171+
}
1172+
11181173
// Automatically proceed with hash location
11191174
setTimeout(() => {
11201175
requestedMapStatus.textContent = 'Loading map...';
@@ -1126,9 +1181,6 @@
11261181
cancelAutoProceedBtn.style.display = 'none';
11271182
}
11281183

1129-
// Atlas picker is already visible by default, just load the data
1130-
loadFeaturedAtlases();
1131-
11321184
// Check for device geolocation first, then fall back to IP
11331185
(async () => {
11341186
const geolocationSuccess = await checkAndUseGeolocation();

js/map-feature-control.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4329,6 +4329,18 @@ export class MapFeatureControl {
43294329
let features = [];
43304330
try {
43314331
features = this._map.queryRenderedFeatures(e.point);
4332+
4333+
// If no features found at exact point, query within 5px buffer
4334+
if (!features.length) {
4335+
const bbox = [
4336+
[e.point.x - 5, e.point.y - 5],
4337+
[e.point.x + 5, e.point.y + 5]
4338+
];
4339+
const featuresInBuffer = this._map.queryRenderedFeatures(bbox);
4340+
if (featuresInBuffer.length) {
4341+
features = [featuresInBuffer[0]];
4342+
}
4343+
}
43324344
} catch (error) {
43334345
// Handle DEM data range errors gracefully
43344346
if (error.message && error.message.includes('out of range source coordinates for DEM data')) {
@@ -5311,6 +5323,18 @@ export class MapFeatureControl {
53115323
let features = [];
53125324
try {
53135325
features = this._map.queryRenderedFeatures(e.point);
5326+
5327+
// If no features found at exact point, query within 3px buffer
5328+
if (!features.length) {
5329+
const bbox = [
5330+
[e.point.x - 3, e.point.y - 3],
5331+
[e.point.x + 3, e.point.y + 3]
5332+
];
5333+
const featuresInBuffer = this._map.queryRenderedFeatures(bbox);
5334+
if (featuresInBuffer.length) {
5335+
features = [featuresInBuffer[0]];
5336+
}
5337+
}
53145338
} catch (error) {
53155339
// Handle DEM data range errors gracefully
53165340
if (error.message && error.message.includes('out of range source coordinates for DEM data')) {

0 commit comments

Comments
 (0)