Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

don't allow events to bubble up from components inside the viewport

Mike McGanne5e7c78d6f19
diff --git a/package.json b/package.json
index c33c2730c..35a1ea4f5 100644
--- a/package.json
+++ b/package.json
@@ -205,7 +205,7 @@
"node_modules/(?!(ol)/)"
],
"modulePathIgnorePatterns": [
- "build/"
+ "<rootDir>/build/"
]
},
"prettier": {
diff --git a/web/js/components/map/ol-coordinates.js b/web/js/components/map/ol-coordinates.js
index 9ff947785..cff47ee33 100644
--- a/web/js/components/map/ol-coordinates.js
+++ b/web/js/components/map/ol-coordinates.js
@@ -54,7 +54,7 @@ class OlCoordinates extends React.Component {
let cl = event.relatedTarget.classList;
// Ignore when the mouse goes over the coordinate display. Clearing
// the coordinates in this situation causes a flicker.
- if (cl.contains('map-coord') || cl.contains('coord-btn')) {
+ if (cl.contains('map-coord')) {
return;
}
}
diff --git a/web/js/map/rotation.js b/web/js/map/rotation.js
index b15397445..0584990b0 100644
--- a/web/js/map/rotation.js
+++ b/web/js/map/rotation.js
@@ -90,7 +90,11 @@ export function MapRotate(ui, models, map) {
})
.mouseout(function() {
clearInterval(self.intervalId);
- });
+ })
+ // This component is inside the map viewport container. Allowing
+ // mouse move events to bubble up displays map coordinates--let those
+ // be blank when over a component.
+ .mousemove((e) => e.stopPropagation());
$rightButton.button({
text: false
@@ -106,7 +110,9 @@ export function MapRotate(ui, models, map) {
})
.mouseout(function() {
clearInterval(self.intervalId);
- });
+ })
+ // See note above
+ .mousemove((e) => e.stopPropagation());
$resetButton.button({
label: Number(models.map.rotation * (180 / Math.PI))
@@ -121,7 +127,9 @@ export function MapRotate(ui, models, map) {
});
$resetButton.button('option', 'label', '0');
- });
+ })
+ // See note above
+ .mousemove((e) => e.stopPropagation());
};
/**
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index b46608260..6260b114d 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -793,6 +793,12 @@ export function mapui(models, config) {
createZoomButtons(map, proj);
createMousePosSel(map, proj);
+ // This component is inside the map viewport container. Allowing
+ // mouse move events to bubble up displays map coordinates--let those
+ // be blank when over a component.
+ $('.wv-map-scale-metric').mousemove((e) => e.stopPropagation());
+ $('.wv-map-scale-imperial').mousemove((e) => e.stopPropagation());
+
// allow rotation by dragging for polar projections
if (proj.id !== 'geographic' && proj.id !== 'webmerc') {
rotation.init(map, proj.id);
@@ -866,6 +872,7 @@ export function mapui(models, config) {
$zoomOut.click(() => {
mapUtilZoomAction(map, -1);
});
+ $zoomOut.mousemove((e) => e.stopPropagation());
var $zoomIn = $('<button></button>')
.addClass('wv-map-zoom-in')
@@ -882,6 +889,7 @@ export function mapui(models, config) {
$zoomIn.click(() => {
mapUtilZoomAction(map, 1);
});
+ $zoomIn.mousemove((e) => e.stopPropagation());
/*
* Sets zoom buttons as active or inactive based