Skip to content

Instantly share code, notes, and snippets.

@binux
Last active December 11, 2015 15:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save binux/4620963 to your computer and use it in GitHub Desktop.
Save binux/4620963 to your computer and use it in GitHub Desktop.
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