-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update code to Leaflet 1.0.0-b1 #7
base: master
Are you sure you want to change the base?
Conversation
Almost total rewrite of the original code of turban to make it compatible with Leaflet 1.0-dev. Also makes the layer more compatible with other leaflet functions, such as map.fitBounds and zooming beyond the max zoom level (by use of setting maxNativeZoom for the layer).
The re-write of the plugin looks great. Many thanks for the update! I found one issue with the update. The bounds are set for a map called "map" but if the main map layer is named something else, it fails to set the bounds, etc.
I ended up setting the bounds outside of the plugin after it initializes...but there is likely a better way that you might know of. |
@GeneGIGA maxX = maxZoomGrid.x * this.options.tileSize,
maxY = maxZoomGrid.y * this.options.tileSize,
southEast = map.unproject([maxX, maxY], maxNativeZoom);
this.options.bounds = new L.LatLngBounds([[0, 0], southEast]); Into: southEast = map.unproject([0, this.options.height], maxNativeZoom),
northEast = map.unproject([this.options.width, 0], maxNativeZoom);
this.options.bounds = new L.LatLngBounds([northEast, southEast]); Where image size data is used instead of multipliers of tile size and zoom. |
I removed the set bounds in the initialization step and moved it to a beforeAdd function, then it seems happy... beforeAdd: function (map) {
|
I'm wondering why you multiplied the number of tiles by the tile size to get the southWest and northEast borders. They seem to correspond to the size of the original images in options.height and options.width. I substituted those and got rid of the borders around my image. fitBounds() works exactly now. |
I can confirm that the PR works, if you use |
Is there any chance to merge this, and make it work with a contemporary leaflet version? |
Unfortunately, I don't have time to maintain this repo - if someone wants to take over, please tell me and I can transfer the repo. |
The beforeAdd works great, however I had to remove the |
The current codebase is not compatible anymore with Leaflet 1.0.0, as many things have changed. I needed the Zoomify plugin for a project and updated the plugin.
I am happy to share my update of the code, if you like the changes I made.
{g}
)L.GridLayer
andL.TileLayer
, and only the size is changed if the tile is on a edge (often having arbitrary tile dimensions)layer.options.bounds
, and could be used withmap.fitBounds(layer.options.bounds)
to center and zoom the Zoomify layer in the viewportL.TileLayer
to scale the tiles accordingly