[OpenLayers-Commits] r11149 - trunk/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Sun Feb 20 10:06:53 EST 2011


Author: tschaub
Date: 2011-02-20 07:06:53 -0800 (Sun, 20 Feb 2011)
New Revision: 11149

Modified:
   trunk/openlayers/examples/mobile.js
Log:
Use OpenLayers.Console.log.  Make gg and sm globally available so we can transform position.

Modified: trunk/openlayers/examples/mobile.js
===================================================================
--- trunk/openlayers/examples/mobile.js	2011-02-20 14:43:05 UTC (rev 11148)
+++ trunk/openlayers/examples/mobile.js	2011-02-20 15:06:53 UTC (rev 11149)
@@ -1,9 +1,9 @@
 
 // initialize map when page ready
 var map;
+var gg = new OpenLayers.Projection("EPSG:4326");
+var sm = new OpenLayers.Projection("EPSG:900913");
 function init() {
-    var gg = new OpenLayers.Projection("EPSG:4326");
-    var sm = new OpenLayers.Projection("EPSG:900913");
     
     // layer for drawn features
     var vector = new OpenLayers.Layer.Vector();
@@ -42,7 +42,7 @@
         navigator.geolocation.getCurrentPosition(
             updatePosition,
             function failure(error) {
-                updateLog(error.message);
+                OpenLayers.Console.log(error.message);
             },
             {
                 enableHighAccuracy: true
@@ -58,25 +58,14 @@
     position = pos;
     var lon =  position.coords.longitude;
     var lat = position.coords.latitude;
-    updateLog("position: lon " + lon + ", lat " + lat);
+    OpenLayers.Console.log("position: lon " + lon + ", lat " + lat);
     map.setCenter(
         new OpenLayers.LonLat(lon, lat).transform(gg, sm)
     );
 }
 
-// allow simple logging
-var log = [];
-function updateLog(message) {
-    log.push(message);
-    if (window.console) {
-        console.log(message);
-    }
-}
-function clearLog() {
-    log.length = 0;
-}    
-
 function pan(fx, fy) {
     var size = map.getSize();
     map.pan(size.w * fx, size.h * fy);
 }
+



More information about the Commits mailing list