javascript - ImageMap type repeating itself -
i have posted image map type in site image repeats if zoom in , zoom out image. platform using joomla. editor jce editor.this how looks in web http://logic.al/qtu2/index.php/maptest. missing here ???
var moontypeoptions = { gettileurl: function(coord, zoom) { var normalizedcoord = getnormalizedcoord(coord, zoom); if (!normalizedcoord) { return null; } var bound = math.pow(2, zoom); return 'http://i.imgur.com/9igczkv.png' + '/' + zoom + '/' + normalizedcoord.x + '/' + (bound - normalizedcoord.y - 1) + '.png'; }, tilesize: new google.maps.size(1130, 604), maxzoom: 3, minzoom: 0, radius: 1738000, name: 'moon' }; var moonmaptype = new google.maps.imagemaptype(moontypeoptions); function initialize() { var mylatlng = new google.maps.latlng(0, 0); var mapoptions = { center: mylatlng, zoom: 5, streetviewcontrol: false, maptypecontroloptions: { maptypeids: ['moon'] } }; var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); map.maptypes.set('moon', moonmaptype); map.setmaptypeid('moon'); } // normalizes coords tiles repeat across x axis (horizontally) // standard google map tiles. function getnormalizedcoord(coord, zoom) { var y = coord.y; var x = coord.x; // tile range in 1 direction range dependent on zoom level // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc var tilerange = 1 << zoom; // don't repeat across y-axis (vertically) if (y < 0 || y >= tilerange) { return null; } // repeat across x-axis if (x < 0 || x >= tilerange) { x = (x % tilerange + tilerange) % tilerange; } return { x: x, y: y }; } google.maps.event.adddomlistener(window, 'load', initialize);
Comments
Post a Comment