Skip to content

Commit

Permalink
Also store pixel position in state.mousePosition (geosolutions-it#1211)
Browse files Browse the repository at this point in the history
* Also store pixel position in state.mousePosition

* Copy coordinates instead of storing leaflet objects
  • Loading branch information
manisandro authored and mbarto committed Nov 15, 2016
1 parent b5b3eb1 commit 9cdec35
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 13 additions & 3 deletions web/client/components/map/leaflet/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
}
});
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 5 additions & 1 deletion web/client/components/map/openlayers/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
});
}
});
Expand Down

0 comments on commit 9cdec35

Please sign in to comment.