Template:Fragoria Map
From FragoriaWiki
(Difference between revisions)
Line 46: | Line 46: | ||
// like the standard Google map tiles. | // like the standard Google map tiles. | ||
function getNormalizedCoord(coord, zoom) { | function getNormalizedCoord(coord, zoom) { | ||
- | var y = | + | var y = 2coord.y; |
var x = coord.x; | var x = coord.x; | ||
Line 53: | Line 53: | ||
var tileRange = 1 << zoom; | var tileRange = 1 << zoom; | ||
+ | // don't repeat across y-axis (vertically) | ||
+ | if (y < 0 || y >= tileRange) { | ||
+ | y = (y % tileRange + tileRange) % tileRange; | ||
+ | } | ||
+ | // repeat across x-axis | ||
+ | if (x < 0 || x >= tileRange) { | ||
+ | x = (x % tileRange + tileRange) % tileRange; | ||
+ | } | ||
return { | return { |
Revision as of 09:32, 3 April 2015