From 38840540053a1efb5430694b0efb6a43a4d940f1 Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Thu, 8 Feb 2018 12:50:07 +0100 Subject: [PATCH] added hash + limit zoom to 50 to prevent hang --- index.html | 5 +++-- map.js | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 4c26e19..338f5aa 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,9 @@ - - + + + diff --git a/map.js b/map.js index e341b3c..ff55cde 100644 --- a/map.js +++ b/map.js @@ -140,7 +140,8 @@ */ L.GridLayer.DynamicTiles = L.GridLayer.extend({ createTile: function (coords, done) { // done = (err, tile) - // console.log("createTile", coords, this.options, this.options.nodes); + // console.log("createTile", coords, this.options, this.options.nodes); + // console.log("createTile", coords); var tile = document.createElement('div'), node = this.options.nodes[coords.x+","+coords.y+","+coords.z], defer = false; @@ -217,13 +218,16 @@ function getjson (url, callback) { var TILESIZE = 256; var map = L.map('map', { editable: true, - maxZoom: 100, + maxZoom: 50, // hangs past 50 minZoom: 0, zoom: 0, crs: L.CRS.Simple, center: new L.LatLng(0,0), }); +// HASH! using https://github.com/mlevans/leaflet-hash +var hash = new L.Hash(map); + getjson("index.json", function (err, data) { var nodes = (tiler.layoutxyz(tiler.expandzoom(data))); map.addLayer( L.gridLayer.dynamicTiles({