pass map reference into options
aMadReason opened this issue · comments
The lines 'map.unproject()' inside the initialize() method assumes 'map' exists in global scope. It'd be really cool to pass in a reference to the map as an option (unless there is a better way to access the map) and if that option exists use that instead.
e.g. "const map = options.map || map; " before 'map' is used to call unproject( that way if a map is passed it it'll use that otherwise fallback to global scope.
Otherwise it's a bit awkward to render multiple on a page. Though i'm doing this for a demo so it probably doesn't matter that much.
Really cool plugin :)
just realised can work around this using a global declaration of map and just changing it for each instance.
To aMadReason: please check my pull request - it adds overlap option to the plugin. Without overlap, the images are somewhat blurred due to resizing and you occasionally see white lines between the tiles.
Given existing design of L.TileLayer
, it should not be necessary to pass map
to options, this is handled by onAdd
handler.
For map projection support, OpenLayer's Zoomify implementation is more complete: https://openlayers.org/en/latest/apidoc/module-ol_source_Zoomify-Zoomify.html#setTileGridForProjection. Note that DeepZoom format does not require/follow any specific map projection.