Skip to content

Commit

Permalink
change events namespace search:eventname
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocudini committed Sep 13, 2016
1 parent 766cfb5 commit 689c3de
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 39 deletions.
12 changes: 0 additions & 12 deletions BUGS

This file was deleted.

2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "leaflet-search",
"version": "2.6.1",
"version": "2.7.0",
"main": [
"dist/leaflet-search.src.js",
"dist/leaflet-search.src.css"
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet-search.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/leaflet-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/leaflet-search.mobile.min.css
@@ -1,5 +1,5 @@
/*
* Leaflet Control Search v2.6.1 - 2016-08-17
* Leaflet Control Search v2.7.0 - 2016-09-13
*
* Copyright 2016 Stefano Cudini
* stefano.cudini@gmail.com
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet-search.mobile.src.css
@@ -1,5 +1,5 @@
/*
* Leaflet Control Search v2.6.1 - 2016-08-17
* Leaflet Control Search v2.7.0 - 2016-09-13
*
* Copyright 2016 Stefano Cudini
* stefano.cudini@gmail.com
Expand Down
2 changes: 1 addition & 1 deletion dist/leaflet-search.src.css
@@ -1,5 +1,5 @@
/*
* Leaflet Control Search v2.6.1 - 2016-08-17
* Leaflet Control Search v2.7.0 - 2016-09-13
*
* Copyright 2016 Stefano Cudini
* stefano.cudini@gmail.com
Expand Down
14 changes: 7 additions & 7 deletions dist/leaflet-search.src.js
@@ -1,5 +1,5 @@
/*
* Leaflet Control Search v2.6.1 - 2016-08-17
* Leaflet Control Search v2.7.0 - 2016-09-13
*
* Copyright 2016 Stefano Cudini
* stefano.cudini@gmail.com
Expand Down Expand Up @@ -55,9 +55,9 @@ L.Control.Search = L.Control.extend({
// Name Data passed Description
//
//Managed Events:
// search_locationfound {latlng, title, layer} fired after moved and show markerLocation
// search_expanded {} fired after control was expanded
// search_collapsed {} fired after control was collapsed
// search:locationfound {latlng, title, layer} fired after moved and show markerLocation
// search:expanded {} fired after control was expanded
// search:collapsed {} fired after control was collapsed
//
//Public methods:
// setLayer() L.LayerGroup() set layer search at runtime
Expand Down Expand Up @@ -235,7 +235,7 @@ L.Control.Search = L.Control.extend({
this._input.focus();
this._map.on('dragstart click', this.collapse, this);
}
this.fire('search_expanded');
this.fire('search:expanded');
return this;
},

Expand All @@ -254,7 +254,7 @@ L.Control.Search = L.Control.extend({
}
this._map.off('dragstart click', this.collapse, this);
}
this.fire('search_collapsed');
this.fire('search:collapsed');
return this;
},

Expand Down Expand Up @@ -824,7 +824,7 @@ L.Control.Search = L.Control.extend({
else
{
this.showLocation(loc, this._input.value);
this.fire('search_locationfound', {
this.fire('search:locationfound', {
latlng: loc,
text: this._input.value,
layer: loc.layer ? loc.layer : null
Expand Down
2 changes: 1 addition & 1 deletion examples/fuzzy.html
Expand Up @@ -75,7 +75,7 @@ <h4>Custom Filter Example: <em>search markers with <b>Fuzzy Search</b>, using <a
return ret;
}
})
.on('search_locationfound', function(e) {
.on('search:locationfound', function(e) {
e.layer.openPopup();
})
.addTo(map);
Expand Down
4 changes: 2 additions & 2 deletions examples/geojson-layer.html
Expand Up @@ -53,13 +53,13 @@ <h4>GeoJSON Example: <em>search vector features in GeoJSON layer by property</em
}
});

searchControl.on('search_locationfound', function(e) {
searchControl.on('search:locationfound', function(e) {

e.layer.setStyle({fillColor: '#3f0', color: '#0f0'});
if(e.layer._popup)
e.layer.openPopup();

}).on('search_collapsed', function(e) {
}).on('search:collapsed', function(e) {

featuresLayer.eachLayer(function(layer) { //restore feature color
featuresLayer.resetStyle(layer);
Expand Down
4 changes: 2 additions & 2 deletions examples/tests.html
Expand Up @@ -101,11 +101,11 @@ <h4>search in GeoJSON</h4>

var searchControl = new L.Control.Search({layer: featuresLayer, propertyName: 'name', circleLocation:false});

searchControl.on('search_locationfound', function(e) {
searchControl.on('search:locationfound', function(e) {

e.layer.setStyle({fillColor: '#3f0', color: '#0f0'});

}).on('search_collapsed', function(e) {
}).on('search:collapsed', function(e) {

featuresLayer.eachLayer(function(layer) { //restore feature color
featuresLayer.resetStyle(layer);
Expand Down
2 changes: 1 addition & 1 deletion examples/twitter.html
Expand Up @@ -84,7 +84,7 @@ <h4>Twitter Example: <em>search twetts by jsonp service, filtering geolocated da

var searchControl = new L.Control.Search(searchOpts);

searchControl.on('search_locationfound',function(e) {
searchControl.on('search:locationfound',function(e) {

var popup = e.latlng.popupText,
marker = this._markerLoc;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "leaflet-search",
"version": "2.6.1",
"version": "2.7.0",
"description": "Leaflet Control for searching markers/features by attribute on map or remote searching in jsonp/ajax",
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions src/leaflet-search.js
Expand Up @@ -39,9 +39,9 @@ L.Control.Search = L.Control.extend({
// Name Data passed Description
//
//Managed Events:
// search_locationfound {latlng, title, layer} fired after moved and show markerLocation
// search_expanded {} fired after control was expanded
// search_collapsed {} fired after control was collapsed
// search:locationfound {latlng, title, layer} fired after moved and show markerLocation
// search:expanded {} fired after control was expanded
// search:collapsed {} fired after control was collapsed
//
//Public methods:
// setLayer() L.LayerGroup() set layer search at runtime
Expand Down Expand Up @@ -219,7 +219,7 @@ L.Control.Search = L.Control.extend({
this._input.focus();
this._map.on('dragstart click', this.collapse, this);
}
this.fire('search_expanded');
this.fire('search:expanded');
return this;
},

Expand All @@ -238,7 +238,7 @@ L.Control.Search = L.Control.extend({
}
this._map.off('dragstart click', this.collapse, this);
}
this.fire('search_collapsed');
this.fire('search:collapsed');
return this;
},

Expand Down Expand Up @@ -808,7 +808,7 @@ L.Control.Search = L.Control.extend({
else
{
this.showLocation(loc, this._input.value);
this.fire('search_locationfound', {
this.fire('search:locationfound', {
latlng: loc,
text: this._input.value,
layer: loc.layer ? loc.layer : null
Expand Down

0 comments on commit 689c3de

Please sign in to comment.