Template:Fragoria Map

From FragoriaWiki

(Difference between revisions)
Jump to: navigation, search
Line 40: Line 40:
map.setMapTypeId('moon');
map.setMapTypeId('moon');
-
var marker = new google.maps.Marker({
+
// bounds of the desired area
-
    position: new google.maps.LatLng(-89.62,33.4),
+
var allowedBounds = new google.maps.LatLngBounds(
-
    map: map,
+
new google.maps.LatLng(-50, 80),
-
    title:"Fragotown"
+
new google.maps.LatLng(50, -80)
-
});
+
);
-
}
+
var lastValidCenter = map.getCenter();
 +
 
 +
google.maps.event.addListener(map, 'center_changed', function() {
 +
if (allowedBounds.contains(map.getCenter())) {
 +
// still within valid bounds, so save the last valid position
 +
lastValidCenter = map.getCenter();
 +
return;
 +
}
 +
// not valid anymore => return to last valid position
 +
map.panTo(lastValidCenter);
 +
});
 +
 +
var marker = new google.maps.Marker({
 +
position: new google.maps.LatLng(-89.62,33.4),
 +
map: map,
 +
title:"Fragotown"
 +
});
 +
}
// Normalizes the coords that tiles repeat across the x axis (horizontally)
// Normalizes the coords that tiles repeat across the x axis (horizontally)
Line 59: Line 76:
// repeat across y-axis (vertically)
// repeat across y-axis (vertically)
if (y < 0 || y >= tileRange) {
if (y < 0 || y >= tileRange) {
-
y = (y % tileRange + tileRange) % tileRange;
+
return null;
}
}

Revision as of 21:15, 3 April 2015

Fragoria Map

Personal tools
Date/Time
Server & Cross

Super-Cross Server