eyeseast / datasette-geojson-map

Render a map for any query with a geometry column
23 stars 1 forks source link

Feature Request: Hover inspection #25

Closed mroswell closed 6 months ago

mroswell commented 6 months ago

I prefer the data inspection method used on mapshaper.org.

  1. The info box is available on hover
  2. The info box is located so as not to obscure the map when the field count is large.

Might be nice to have a plugin metadata option to enable these features.

eyeseast commented 6 months ago

Thanks for the feedback. I generally try to avoid hover interactions because they won't work on touch screens. I have a separate issue open (#10) to customize popups.

mroswell commented 6 months ago

I think you can just add a separate click event. I did that here. https://scorecard.njlcv.org/ (The organization hasn't maintained the legislator photo urls). Look for:

function onEachFeature(feature, layer) {
    layer.on({
        mouseover: highlightFeature,
        mouseout: resetHighlight,
        click: mapMemberDetailClick
    });
}

Here:

https://github.com/mroswell/njlcv-scorecard/blob/master/js/app-2021-senate-map-green.js