@2gis/tiny-map
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -21,4 +21,2 @@ /** | ||
function tinyMap(container, options) { | ||
container.style.cssText = 'position:relative;overflow:hidden'; | ||
var tileSize = 256; | ||
@@ -49,3 +47,3 @@ var R = 6378137; | ||
'top:' + (halfSize[1] + y * tileSize - pixelCenter[1] | 0) + 'px;' + | ||
'width:' + tileSize + 'px;' + | ||
'width:' + tileSize + 'px;' + | ||
'height:' + tileSize + 'px'; | ||
@@ -52,0 +50,0 @@ tile.src = getUrl(x, y); |
@@ -1,1 +0,1 @@ | ||
function tinyMap(t,e){function a(t){var e=Math.PI/180,a=Math.max(Math.min(n,t[1]),-n),i=Math.sin(a*e);return[o*t[0]*e,o*Math.log((1+i)/(1-i))/2]}t.style.cssText="position:relative;overflow:hidden";for(var o=6378137,n=85.0511287798,i=function(t,e){var n=a(t),i=256*Math.pow(2,e),r=.5/(Math.PI*o);return n[0]=i*(r*n[0]+.5),n[1]=i*(-r*n[1]+.5),n}(e.center,e.zoom),r=e.size||[t.offsetWidth,t.offsetHeight],s=[r[0]/2,r[1]/2],h=[(i[0]-s[0])/256|0,(i[1]-s[1])/256|0],l=[(i[0]+s[0])/256+1|0,(i[1]+s[1])/256+1|0],p=h[1];p<l[1];p++)for(var c=h[0];c<l[0];c++){var f=new Image;f.style.cssText="position: absolute;left:"+(s[0]+256*c-i[0]|0)+"px;top:"+(s[1]+256*p-i[1]|0)+"px;width:256px;height:256px",f.src=function(t,a){return e.tileUrl.replace("{s}",e.subdomains[Math.abs(t+a)%e.subdomains.length]).replace("{x}",t).replace("{y}",a).replace("{z}",e.zoom)}(c,p),t.appendChild(f)}} | ||
function tinyMap(t,e){function a(t){var e=Math.PI/180,a=Math.max(Math.min(o,t[1]),-o),r=Math.sin(a*e);return[n*t[0]*e,n*Math.log((1+r)/(1-r))/2]}for(var n=6378137,o=85.0511287798,r=function(t,e){var o=a(t),r=256*Math.pow(2,e),i=.5/(Math.PI*n);return o[0]=r*(i*o[0]+.5),o[1]=r*(-i*o[1]+.5),o}(e.center,e.zoom),i=e.size||[t.offsetWidth,t.offsetHeight],s=[i[0]/2,i[1]/2],h=[(r[0]-s[0])/256|0,(r[1]-s[1])/256|0],p=[(r[0]+s[0])/256+1|0,(r[1]+s[1])/256+1|0],l=h[1];l<p[1];l++)for(var c=h[0];c<p[0];c++){var f=new Image;f.style.cssText="position: absolute;left:"+(s[0]+256*c-r[0]|0)+"px;top:"+(s[1]+256*l-r[1]|0)+"px;width:256px;height:256px",f.src=function(t,a){return e.tileUrl.replace("{s}",e.subdomains[Math.abs(t+a)%e.subdomains.length]).replace("{x}",t).replace("{y}",a).replace("{z}",e.zoom)}(c,l),t.appendChild(f)}} |
{ | ||
"name": "@2gis/tiny-map", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A tiny script for displaying a static map with tiles", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
9530
8
69