From 9cdec354bb91d4f157bf85b6f78a1fa59c8126bf Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 15 Nov 2016 18:46:29 +0100 Subject: [PATCH] Also store pixel position in state.mousePosition (#1211) * Also store pixel position in state.mousePosition * Copy coordinates instead of storing leaflet objects --- web/client/components/map/leaflet/Map.jsx | 16 +++++++++++++--- web/client/components/map/openlayers/Map.jsx | 6 +++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/web/client/components/map/leaflet/Map.jsx b/web/client/components/map/leaflet/Map.jsx index 44528debe2..edef3f754f 100644 --- a/web/client/components/map/leaflet/Map.jsx +++ b/web/client/components/map/leaflet/Map.jsx @@ -99,8 +99,14 @@ let LeafletMap = React.createClass({ this.map.on('singleclick', (event) => { if (this.props.onClick) { this.props.onClick({ - pixel: event.containerPoint, - latlng: event.latlng + pixel: { + x: event.containerPoint.x, + y: event.containerPoint.y + }, + latlng: { + lat: event.latlng.lat, + lng: event.latlng.lng + } }); } }); @@ -268,7 +274,11 @@ let LeafletMap = React.createClass({ this.props.onMouseMove({ x: pos.lng, y: pos.lat, - crs: "EPSG:4326" + crs: "EPSG:4326", + pixel: { + x: event.containerPoint.x, + y: event.containerPoint.x + } }); }, registerHooks() { diff --git a/web/client/components/map/openlayers/Map.jsx b/web/client/components/map/openlayers/Map.jsx index f48023ae60..2f6b486041 100644 --- a/web/client/components/map/openlayers/Map.jsx +++ b/web/client/components/map/openlayers/Map.jsx @@ -152,7 +152,11 @@ var OpenlayersMap = React.createClass({ this.props.onMouseMove({ y: coords[1], x: tLng, - crs: "EPSG:4326" + crs: "EPSG:4326", + pixel: { + x: event.pixel[0], + y: event.pixel[1] + } }); } });