Skip to content

Commit

Permalink
Merge pull request #18 from EddyVerbruggen/mapbox-4.0.0
Browse files Browse the repository at this point in the history
Mapbox 4.0.0
  • Loading branch information
EddyVerbruggen authored Jul 8, 2016
2 parents 5fdf045 + 65b2167 commit e61614e
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.vscode
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ tns plugin add nativescript-mapbox
If you get an error during iOS build related to Podspec versions, probably the easiest fix is:
`tns platform remove ios` and `tns platform add ios`.

On Android make sure you add this to the `<application>` node of `app/App_Resources/Android/AndroidManifest.xml`:
```xml
<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />
```

## Usage

If you want a quickstart, [clone our demo app](https://github.com/EddyVerbruggen/nativescript-mapbox-demo).
Expand Down Expand Up @@ -59,10 +64,13 @@ And here's the comprehensive list of supported functions:
disableZoom: false, // default false
markers: [ // optional without a default
{
'lat': 52.3732160, // mandatory
'lng': 4.8941680, // mandatory
'title': 'Nice location', // recommended to pass in
'subtitle': 'Really really nice location' // one line is available on iOS, multiple on Android
lat: 52.3732160, // mandatory
lng: 4.8941680, // mandatory
title: 'Nice location', // recommended to pass in
subtitle: 'Really really nice location', // one line is available on iOS, multiple on Android
iconPath: 'res/markers/green_pin_marker.png', // anywhere in your app folder
onTap: function(marker) { console.log("This marker was tapped"); },
onCalloutTap: function(marker) { console.log("The callout of this marker was tapped"); }
}
]
}).then(
Expand All @@ -84,12 +92,22 @@ Also, all functions support promises, but we're leaving out the `.then()` stuff

### addMarkers
```js
var onTap = function(marker) {
console.log("Marker tapped with title: '" + marker.title + "'");
};
var onCalloutTap = function(marker) {
alert("Marker callout tapped with title: '" + marker.title + "'");
};

mapbox.addMarkers([
{
'lat': 52.3602160, // mandatory
'lng': 4.8891680, // mandatory
'title': 'One-line title here', // no popup unless set
'subtitle': 'Infamous subtitle!'
lat: 52.3602160, // mandatory
lng: 4.8891680, // mandatory
title: 'One-line title here', // no popup unless set
subtitle: 'Infamous subtitle!',
iconPath: 'res/markers/home_marker.png',
onTap: onTap,
onCalloutTap: onCalloutTap
},
{
..
Expand Down Expand Up @@ -157,15 +175,15 @@ Here the promise callback makes sense, so adding it to the example:
altitude: 2000, // iOS (meters from the ground)
bearing: 270, // Where the camera is pointing, 0-360 (degrees)
tilt: 50,
duration: 10 // in seconds
duration: 10000 // in milliseconds
})
```

### setTilt (Android)
```js
mapbox.setTilt(
{
pitch: 35, // default 30 (degrees angle)
tilt: 40, // default 30 (degrees angle)
duration: 4000 // default 5000 (milliseconds)
}
)
Expand Down
1 change: 1 addition & 0 deletions mapbox-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ mapbox.hasFineLocationPermission = function () {
};

mapbox.mapView = null;
mapbox.mapboxMap = null;

module.exports = mapbox;
Loading

0 comments on commit e61614e

Please sign in to comment.