Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var _map = R;
var rectangle = new google.maps.Rectangle({
bounds: _map.getBounds(),
editable: true,
map: _map
});
function message(msg) {
$('#plexts').append('<div class="plext"><div class="pl_timestamp">'+(new Date()).getHours()+':'+(new Date()).getMinutes()+'</div><div class="pl_content pl_player"><span class="ALIENS">System: </span>'+msg+'</div></div>');
$('#plext_container').scrollTop($('#plext_container')[0].scrollHeight);
}
google.maps.event.addListener(rectangle, 'bounds_changed', function() {
var a = rectangle.getBounds();
message([Math.floor(a.getSouthWest().lat() * 1e6), Math.floor(a.getSouthWest().lng() * 1e6),
Math.floor(a.getNorthEast().lat() * 1e6), Math.floor(a.getNorthEast().lng() * 1e6)]);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment