added hash + limit zoom to 50 to prevent hang

master
Michael Murtaugh 7 years ago
parent 89132b0a0c
commit 3884054005

@ -4,8 +4,9 @@
<title></title> <title></title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="/lib/leaflet-1.0.1/leaflet.js"></script> <script src="/lib/leaflet/leaflet.js"></script>
<link href="/lib/leaflet-1.0.1/leaflet.css" rel="stylesheet" type="text/css"> <link href="/lib/leaflet/leaflet.css" rel="stylesheet" type="text/css">
<script src="lib/mlevans-leaflet-hash/leaflet-hash.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css"> <link href="styles.css" rel="stylesheet" type="text/css">
</head> </head>
<body> <body>

@ -141,6 +141,7 @@
L.GridLayer.DynamicTiles = L.GridLayer.extend({ L.GridLayer.DynamicTiles = L.GridLayer.extend({
createTile: function (coords, done) { // done = (err, tile) 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'), var tile = document.createElement('div'),
node = this.options.nodes[coords.x+","+coords.y+","+coords.z], node = this.options.nodes[coords.x+","+coords.y+","+coords.z],
defer = false; defer = false;
@ -217,13 +218,16 @@ function getjson (url, callback) {
var TILESIZE = 256; var TILESIZE = 256;
var map = L.map('map', { var map = L.map('map', {
editable: true, editable: true,
maxZoom: 100, maxZoom: 50, // hangs past 50
minZoom: 0, minZoom: 0,
zoom: 0, zoom: 0,
crs: L.CRS.Simple, crs: L.CRS.Simple,
center: new L.LatLng(0,0), 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) { getjson("index.json", function (err, data) {
var nodes = (tiler.layoutxyz(tiler.expandzoom(data))); var nodes = (tiler.layoutxyz(tiler.expandzoom(data)));
map.addLayer( L.gridLayer.dynamicTiles({ map.addLayer( L.gridLayer.dynamicTiles({

Loading…
Cancel
Save