diff --git a/CHANGELOG.md b/CHANGELOG.md index 0007f93..f0b10c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ [iOS SDK](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) -## [4.1.0](https://github.com/EddyVerbruggen/nativescript-mapbox/tree/4.1.0) (2018-06-28) +## [4.1.1](https://github.com/EddyVerbruggen/nativescript-mapbox/tree/4.1.1) (2018-07-03) +[Full Changelog](https://github.com/EddyVerbruggen/nativescript-mapbox/compare/4.1.0...4.1.1) + +**Implemented enhancements:** + +- Add a method to remove polygons [\#237](https://github.com/EddyVerbruggen/nativescript-mapbox/issues/237) + +## [4.1.0](https://github.com/EddyVerbruggen/nativescript-mapbox/tree/4.1.0) (2018-07-02) [Full Changelog](https://github.com/EddyVerbruggen/nativescript-mapbox/compare/4.0.0...4.1.0) **Fixed bugs:** diff --git a/README.md b/README.md index c6d1561..e5ec9ae 100755 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ exports.onMapReady = onMapReady; ``` The methods you can invoke like this from an XML-declared map are: -`addMarkers`, `setViewport`, `removeMarkers`, `getCenter`, `setCenter`, `getZoomLevel`, `setZoomLevel`, `getViewport`, `getTilt`, `setTilt`, `setMapStyle`, `animateCamera`, `addPolygon`, `addPolyline`, `removePolylines`, `getUserLocation`, `trackUser`, `setOnMapClickListener` and `destroy`. +`addMarkers`, `setViewport`, `removeMarkers`, `getCenter`, `setCenter`, `getZoomLevel`, `setZoomLevel`, `getViewport`, `getTilt`, `setTilt`, `setMapStyle`, `animateCamera`, `addPolygon`, `removePolygons`, `addPolyline`, `removePolylines`, `getUserLocation`, `trackUser`, `setOnMapClickListener` and `destroy`. Check out the usage details on the functions below. @@ -458,7 +458,7 @@ The first person to tweet a snowman drawn with this function gets a T-shirt. // after adding this, scroll to Amsterdam to see a semi-transparent red square mapbox.addPolygon( { - id: 1, + id: 1, // optional, can be used in 'removePolygons' fillColor: new Color("red"), fillOpacity: 0.7, @@ -494,6 +494,18 @@ The first person to tweet a snowman drawn with this function gets a T-shirt. .catch((error: string) => console.log("mapbox addPolygon error: " + error)); ``` +### removePolygons +You can either remove all polygons by not passing in an argument, +or remove specific polygon id's (which you specified previously). + +```js + // remove all polygons + mapbox.removePolygons(); + + // remove specific polygons by id + mapbox.removePolygons([1, 2]); +``` + ### addPolyline Draw a polyline. Connect the points given as parameters. diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml index 9e64bbd..159e8dc 100644 --- a/demo/app/main-page.xml +++ b/demo/app/main-page.xml @@ -108,9 +108,10 @@