@langateam/leaflet-geojson-autocomplete
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@langateam/leaflet-geojson-autocomplete", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Leaflet Autocomplete For Remote Searching with GeoJSON Services.", | ||
@@ -5,0 +5,0 @@ "main": "src/geojsonautocomplete.js", |
@@ -6,2 +6,3 @@ /* | ||
module.exports = function ($) { | ||
var map; | ||
var options = { | ||
@@ -17,3 +18,4 @@ geojsonServiceAddress: "http://yourGeoJsonSearchAddress", | ||
pointGeometryZoomLevel: -1, //Set zoom level for point geometries -1 means use leaflet default. | ||
pagingActive: true | ||
pagingActive: true, | ||
map: null | ||
}; | ||
@@ -40,3 +42,8 @@ | ||
map = options.map | ||
if (!map) { | ||
throw 'map not defined. set options.map' | ||
} | ||
$(this).each(function () { | ||
@@ -66,6 +73,10 @@ var element = $(this); | ||
default: | ||
if ($("#searchBox")[0].value.length > 0) { | ||
if ($("#searchBox")[0].value.length > 8) { | ||
map.fire('search:change', { value: $('#searchBox')[0].value }) | ||
offset = 0; | ||
getValuesAsGeoJson(false); | ||
} | ||
else if ($("#searchBox")[0].value.length > 0) { | ||
break; | ||
} | ||
else { | ||
@@ -76,3 +87,3 @@ clearButtonClick(); | ||
} | ||
}, 300); | ||
}, 500); | ||
@@ -103,2 +114,3 @@ $("#searchBox").focus(function () { | ||
$("#searchButton").click(function () { | ||
map.fire('search:query', { value: $("#searchBox")[0].value }) | ||
searchButtonClick(); | ||
@@ -108,2 +120,3 @@ }); | ||
$("#clearButton").click(function () { | ||
map.fire('search:clear', { value: $("#searchBox")[0].value }) | ||
clearButtonClick(); | ||
@@ -178,2 +191,4 @@ }); | ||
searchLayerType = (withPaging ? 1 : 0); | ||
map.fire('search:results:geojson', json) | ||
}, | ||
@@ -258,3 +273,3 @@ error: function () { | ||
drawGeoJsonList(); | ||
//drawGeoJsonList(); | ||
} | ||
@@ -294,2 +309,6 @@ } | ||
map.fire('search:select:geojson', { geojson: features[index] }) | ||
/* | ||
* XXX | ||
if (searchLayerType === 0) { | ||
@@ -301,2 +320,3 @@ drawGeoJson(activeResult); | ||
} | ||
*/ | ||
} | ||
@@ -441,2 +461,5 @@ } | ||
if (activeResult !== -1) { | ||
map.fire('search:select:geojson', { geojson: features[activeResult] }) | ||
/* | ||
* XXX | ||
if (searchLayerType === 0) { | ||
@@ -448,2 +471,3 @@ drawGeoJson(activeResult); | ||
} | ||
*/ | ||
} | ||
@@ -475,2 +499,4 @@ | ||
if (activeResult !== -1) { | ||
map.fire('search:select:geojson', { geojson: features[activeResult] }) | ||
/* | ||
if (searchLayerType === 0) { | ||
@@ -482,2 +508,3 @@ drawGeoJson(activeResult); | ||
} | ||
*/ | ||
} | ||
@@ -484,0 +511,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
503170
8928