Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This file contains some delegate classes for you to extend.
- function NewRoutePageControllerDelegate()
- {
- // Save 'this' so we can refer to public attributes and methods.
- var self = this;
- mapOptions = {
- enableHighAccuracy: true,
- timeout: 6000,
- maximumAge: 0,
- }
- mapError = function(err) {
- console.warn('ERROR(' + err.code + '): ' + err.message);
- }
- // The MapPageController class controls the 'New Route' page.
- // This class provides a couple of useful methods:
- // displayMessage(message):
- // Causes a short message string to be displayed on the
- // page for a brief period. Useful for showing quick
- // notifications to the user.
- // panToLocation(latitude, longitude):
- // Pans the map to the given latitude and longitude.
- // repaintOverlay():
- // Causes the map overlay to be redrawn, triggering a
- // call to our mapPageDrawOverlay() method. You might
- // wish to call this when you update information that
- // is displayed on the canvas overlay.
- // canvasPointFromLocation(latitude, longitude):
- // Given a latitude and longitude, returns the
- // corresponding point on the canvas overlay.
- // The return value is an object with an 'x' and a 'y'
- // property.
- var newRoutePageController = null;
- // NOTE: You should not remove any of the five public methods below.
- // This method is called by the MapPageController when the user
- // has switched to the page and it has been intialised.
- this.mapPageInitialisedWithOptions = function(controller, options)
- {
- console.log("Record Route - mapPageInitialisedWithOptions");
- newRoutePageController = controller;
- //calling this function will pan to the location only once
- findUser = function(position){
- var latitude = position.coords.latitude
- var longitude= position.coords.longitude
- newRoutePageController.panToLocation(latitude, longitude)
- }
- navigator.geolocation.getCurrentPosition(findUser,mapError,mapOptions)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement