From 853361ace747131f2bc85ca0c244e4bd69063716 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Thu, 29 Dec 2016 17:00:36 +0100 Subject: [PATCH] Indicate if feature is clickable --- src/components/map/InspectionMap.jsx | 6 +++++- src/components/map/MapboxGlMap.jsx | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/map/InspectionMap.jsx b/src/components/map/InspectionMap.jsx index 4b5dd736..892a7ecf 100644 --- a/src/components/map/InspectionMap.jsx +++ b/src/components/map/InspectionMap.jsx @@ -89,7 +89,11 @@ export default class InspectionMap extends React.Component { }) }) - map.on('click', this.displayPopup.bind(this)); + map.on('click', this.displayPopup.bind(this)) + map.on('mousemove', function(e) { + var features = map.queryRenderedFeatures(e.point, { layers: this.layers }) + map.getCanvas().style.cursor = (features.length) ? 'pointer' : '' + }) } displayPopup(e) { diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 1c4888ba..788a6556 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -68,6 +68,10 @@ export default class MapboxGlMap extends React.Component { }) map.on('click', this.displayPopup.bind(this)); + map.on('mousemove', function(e) { + var features = map.queryRenderedFeatures(e.point, { layers: this.layers }) + map.getCanvas().style.cursor = (features.length) ? 'pointer' : '' + }) } displayPopup(e) {