Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <code>
- var map, GeoMarker;
- var directionsDisplay;
- var directionsService = new google.maps.DirectionsService();
- function initialize() {
- directionsDisplay = new google.maps.DirectionsRenderer();
- var arena = new google.maps.LatLng(43.684782688659126,-79.2992136269837);
- var mapOptions = {
- zoom: 12,
- center: arena,
- panControl: false,
- zoomControl: false,
- streetViewControl: false,
- mapTypeControl: false,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
- directionsDisplay.setMap(map);
- var marker1 = new MarkerWithLabel({
- position: arena,
- draggable: false,
- raiseOnDrag: false,
- map: map,
- icon: "images/lax-pin1.png",
- labelContent: "Ted Reeve Arena",
- labelAnchor: new google.maps.Point(25, 0),
- labelClass: "pin", // the CSS class for the label
- labelStyle: {opacity: 0.95}
- });
- GeoMarker = new GeolocationMarker();
- GeoMarker.setCircleOptions({fillColor: '#808080'});
- google.maps.event.addListenerOnce(GeoMarker, 'position_changed', function(e) {
- map.setCenter(e.latLng);
- map.fitBounds(e.latLngBounds);
- });
- google.maps.event.addListener(GeoMarker, 'geolocation_error', function(e) {
- alert('There was an error obtaining your position. Message: ' + e.message);
- });
- GeoMarker.setMap(map);
- }
- function calcRoute() {
- var request = {
- origin: GeoMarker,
- destination: marker1,
- travelMode: google.maps.TravelMode.DRIVING
- };
- directionsService.route(request, function(result, status) {
- if (status == google.maps.DirectionsStatus.OK) {
- directionsDisplay.setDirections(result);
- }
- });
- }
- google.maps.event.addDomListener(window, 'load', initialize);
- </code>
- TypeError: e is undefined
- map.setCenter(e.latLng);
- google.maps.event.addListenerOnce(GeoMarker, 'position_changed', function(e) {
- map.setCenter(e.latLng);
- map.fitBounds(e.latLngBounds);
- });
- google.maps.event.addListenerOnce(GeoMarker, 'position_changed', function(e) {
- //map.setCenter(e.latLng);
- //map.fitBounds(e.latLngBounds);
- map.setCenter(GeoMarker.getPosition());
- map.fitBounds(GeoMarker.getBounds());
- });
- var request = {
- origin: GeoMarker.getPosition(),
- destination: marker1.getPosition(),
- travelMode: google.maps.TravelMode.DRIVING
- };
- var map, GeoMarker;
- var directionsDisplay;
- var directionsService = new google.maps.DirectionsService();
- var marker1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement