diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 12b2098..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/DESCRIPTION b/DESCRIPTION index 4d3cec1..80d1798 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mapboxapi Type: Package Title: R Interface to 'Mapbox' Web Services -Date: 2024-05-14 -Version: 0.6.1 +Date: 2024-08-21 +Version: 0.6.2 Authors@R: c(person(given = "Kyle", family = "Walker", email = "kyle@walker-data.com", role = c("aut", "cre")), diff --git a/inst/www/mapboxGeocoderBinding.js b/inst/www/mapboxGeocoderBinding.js index f8cd910..804739f 100644 --- a/inst/www/mapboxGeocoderBinding.js +++ b/inst/www/mapboxGeocoderBinding.js @@ -1,5 +1,4 @@ var mapboxGeocoderBinding = new Shiny.InputBinding(); - $.extend(mapboxGeocoderBinding, { find: function(scope) { return $(scope).find(".mapbox-geocoder"); @@ -8,21 +7,22 @@ $.extend(mapboxGeocoderBinding, { var accessToken = $(el).data("access-token"); var options = $(el).data("options"); mapboxgl.accessToken = accessToken; - var geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken, mapboxgl: mapboxgl, ...options }); - geocoder.addTo(el); - // Capture the result event and send data to Shiny geocoder.on('result', function(e) { $(el).data("geocoder-result", e.result); // Store the result in jQuery data $(el).trigger('change'); }); - + // Add event listener for the 'clear' event + geocoder.on('clear', function() { + $(el).data("geocoder-result", null); // Reset the result to null + $(el).trigger('change'); + }); $(el).data("geocoder", geocoder); }, getValue: function(el) { @@ -37,5 +37,4 @@ $.extend(mapboxGeocoderBinding, { $(el).off(".mapboxGeocoderBinding"); } }); - Shiny.inputBindings.register(mapboxGeocoderBinding); diff --git a/tools/.DS_Store b/tools/.DS_Store deleted file mode 100644 index afef706..0000000 Binary files a/tools/.DS_Store and /dev/null differ diff --git a/tools/readme/.DS_Store b/tools/readme/.DS_Store deleted file mode 100644 index 9316761..0000000 Binary files a/tools/readme/.DS_Store and /dev/null differ