]> git.openstreetmap.org Git - rails.git/commitdiff
Allow users to get default contextmenu on shift-click
authorDan Stowell <danstowell@users.sourceforge.net>
Sun, 9 Aug 2015 11:11:07 +0000 (12:11 +0100)
committerDan Stowell <danstowell@users.sourceforge.net>
Sun, 9 Aug 2015 11:11:07 +0000 (12:11 +0100)
app/assets/javascripts/index.js

index dbc4b8c338e0723154e6f70e90e4062f25c112bc..69e223b22a74e71bbb2a2f997fafbf36fefac9fc 100644 (file)
@@ -98,6 +98,7 @@ $(document).ready(function () {
     }));
   }
 
+  // TODO only allow this if zoomed in enough
   var context_addnote = function(e){
     // TODO this currently doesn't work correctly - I think the "route" needs to be chained to ensure it comes once the pan has finished.
     map.panTo(e.latlng, {animate: false});
@@ -144,6 +145,14 @@ $(document).ready(function () {
     }]
   });
 
+  $(document).on('mousedown', function(e){
+    if(e.shiftKey){
+      map.contextmenu.disable(); // on firefox, shift disables our contextmenu. we explicitly do this for all browsers.
+    }else{
+      map.contextmenu.enable();
+    }
+  });
+
   map.attributionControl.setPrefix('');
 
   map.updateLayers(params.layers);