From dfd4c6d1392ad9e25d21ec8940b409a5fe28bb51 Mon Sep 17 00:00:00 2001 From: Brad Martin Date: Thu, 27 Oct 2016 11:02:12 -0500 Subject: [PATCH 1/3] typo --- mapbox.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mapbox.d.ts b/mapbox.d.ts index 11bc8a3..81afa16 100644 --- a/mapbox.d.ts +++ b/mapbox.d.ts @@ -32,9 +32,9 @@ declare module "nativescript-mapbox" { */ width?: number; /** - * Color of the lone, default black (0xff000000). + * Color of the line, default black. */ - color?: any; + color?: string; points: LatLng[]; } @@ -247,4 +247,4 @@ declare module "nativescript-mapbox" { export function downloadOfflineRegion(arg: DownloadOfflineRegionOptions): Promise; export function listOfflineRegions(arg: ListOfflineRegionsOptions): Promise>; export function deleteOfflineRegion(arg: DeleteOfflineRegionOptions): Promise; -} \ No newline at end of file +} From 59d0b0744ea7b0468d9d16874388bf976114a901 Mon Sep 17 00:00:00 2001 From: Brad Martin Date: Thu, 27 Oct 2016 11:09:36 -0500 Subject: [PATCH 2/3] Improve color for consumer of plugin --- mapbox.android.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mapbox.android.js b/mapbox.android.js index 9a5ee7d..fc80065 100755 --- a/mapbox.android.js +++ b/mapbox.android.js @@ -2,6 +2,7 @@ var utils = require("utils/utils"); var application = require("application"); var frame = require("ui/frame"); var fs = require("file-system"); +var Color = require("color").Color; var mapbox = require("./mapbox-common"); mapbox._markers = []; mapbox._polylines = []; @@ -606,7 +607,16 @@ mapbox.addPolyline = function (arg, nativeMap) { var polylineOptions = new com.mapbox.mapboxsdk.annotations.PolylineOptions(); polylineOptions.width(arg.width || 5); // default 5 - polylineOptions.color(arg.color || 0xff000000); // default black + + // Create android color && default black + var androidColor; + if (arg.color && Color.isValid(arg.color)) { + androidColor = arg.color ? new Color(arg.color).android : new Color('#000').android; + } else { + androidColor = new Color('#000').android; + } + + polylineOptions.color(androidColor); for (var p in points) { var point = points[p]; polylineOptions.add(new com.mapbox.mapboxsdk.geometry.LatLng(point.lat, point.lng)); From b78a13138c46ac0c6da14b53500865a94b1c98fd Mon Sep 17 00:00:00 2001 From: Brad Martin Date: Thu, 27 Oct 2016 11:50:41 -0500 Subject: [PATCH 3/3] update for Color change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ac0ad4..9992961 100755 --- a/README.md +++ b/README.md @@ -383,7 +383,7 @@ Draw a polyline. Connect the points given as parameters. // Draw a two segment line near Amsterdam Central Station mapbox.addPolyline({ id: 1, // optional, can be used in 'removePolylines' - color: 0xff29a025, //Set the color of the line (default black) + color: '#336699', // Set the color of the line (default black) width: 7, //Set the width of the line (default 5) points: [ {