]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/assets/leaflet/leaflet.locationfilter.js
Merge remote-tracking branch 'openstreetmap/pull/1426'
[rails.git] / vendor / assets / leaflet / leaflet.locationfilter.js
index a17f1a5affbc5e779be21299ef0333c543258448..0a977ed413182bb4d659834f45f929c72f0717f0 100644 (file)
@@ -90,7 +90,7 @@ L.Control.ButtonContainer = L.Control.extend({
     }
 });
 
-L.LocationFilter = L.Class.extend({
+L.LocationFilter = L.Layer.extend({
     includes: L.Mixin.Events,
 
     options: {
@@ -100,7 +100,8 @@ L.LocationFilter = L.Class.extend({
         },
         adjustButton: {
             text: "Select area within current zoom"
-        }
+        },
+        buttonPosition: 'topleft'
     },
 
     initialize: function(options) {
@@ -114,7 +115,6 @@ L.LocationFilter = L.Class.extend({
 
     onAdd: function(map) {
         this._map = map;
-        this._layer = new L.LayerGroup();
 
         if (this.options.enableButton || this.options.adjustButton) {
             this._initializeButtonContainer();
@@ -285,6 +285,8 @@ L.LocationFilter = L.Class.extend({
             return;
         }
 
+        this._layer = new L.LayerGroup();
+
         // Calculate filter bounds
         this._calculateBounds();
 
@@ -467,7 +469,10 @@ L.LocationFilter = L.Class.extend({
        toggles the location filter */
     _initializeButtonContainer: function() {
         var that = this;
-        this._buttonContainer = new L.Control.ButtonContainer({className: "location-filter button-container"});
+        this._buttonContainer = new L.Control.ButtonContainer({
+           className: "location-filter button-container",
+           position: this.options.buttonPosition
+       });
 
         if (this.options.enableButton) {
             this._enableButton = new L.Control.Button({