commenthol / leaflet-rastercoords

Leaflet plugin for plain image map projection to display large images using tiles generated with gdal2tiles-leaflet
https://commenthol.github.io/leaflet-rastercoords
MIT License
120 stars 23 forks source link

Map bounds limited to the image size #2

Closed pauloFernandes closed 7 years ago

pauloFernandes commented 7 years ago

Apparently the plugin sets the map's bounds equals to image's size. When I put a marker on the edges of the image, and it has a popup, the map hides this popup.

Is it possible to create bounds to the map bigger than image's size?

commenthol commented 7 years ago

Yes that's possible. Please take a look at the example on https://commenthol.github.io/leaflet-rastercoords. Zooming out gives you the possibility to view the popup. You can also set map.setMaxBounds() like this: (from example/index.js)

    ...
    // assign map and image dimensions
    var rc = new L.RasterCoords(map, img)

    map.setMaxBounds(rc.unproject([0, 0]), rc.unproject(img))
    // set the view on a marker ...
    map.setView(rc.unproject([0, 0] /*[1589, 1447]*/), 4)