Deactivate OSB controller immediately after clicking a new bug
authorKai Krueger <kakrueger@gmail.com>
Fri, 22 Apr 2011 16:07:36 +0000 (10:07 -0600)
committerKai Krueger <kakrueger@gmail.com>
Fri, 22 Apr 2011 16:07:36 +0000 (10:07 -0600)
app/views/site/index.html.erb
public/javascripts/openstreetbugs.js

index 08bada0b998cab34a4a2dce3030da3fa48600adb..27ecf1fa79d6bb7ab610fe5fe11af5b88f300c34 100644 (file)
@@ -133,11 +133,6 @@ end
     var loginName = "<%= @user.display_name %>"
   <% end %>
 
-  function createBugCallBack() {
-       map.osbControl.deactivate();
-       document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default";
-  }
-
   function mapInit(){
     map = createMap("map");
 
index fff37eec1479c37334f801cae47ddee54c8cebed..b7a4685b93c3d2112df158c4ad7f032cb21dcb99 100644 (file)
@@ -468,7 +468,6 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                );
-               createBugCallBack();
        },
 
        /**
@@ -634,6 +633,7 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
        */
        click: function(e) {
                if(!this.map) return true;
+               deactivateControl();
 
                var control = this;
                var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
@@ -827,6 +827,11 @@ function osbResponse(error)
 putAJAXMarker.layers = [ ];
 putAJAXMarker.bugs = { };
 
+function deactivateControl() { 
+    map.osbControl.deactivate(); 
+    document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default"; 
+  }
+
 
 /* Translations */