mapbox-gl-rails 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mapbox-gl-directions.js +195 -184
- data/app/assets/javascripts/mapbox-gl-geocoder.js +2 -2
- data/app/assets/javascripts/mapbox-gl.js +1568 -864
- data/app/assets/stylesheets/mapbox-gl-geocoder.scss +94 -74
- data/lib/mapbox-gl/rails/version.rb +2 -2
- data/plugins.yaml +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dba91ba809afa48916c094895f60e62abbf36836e199bf924041a80e2067eb3
|
4
|
+
data.tar.gz: ccc85865b742e7a49c5537980c364e3c8af0c995ce4cc2de33dd035b99d3ef2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aeee92620372fb169c1473f8defe3740eaa325e578dd9a36859d3da76204f1201d9cf15af487be470b1ce93113f8a398b875287b275bd3e4c61bc69e7dc8bf6
|
7
|
+
data.tar.gz: 9f682a0cf01fb89ebdc78b0f93e4d1ea95908d69322f03e64b83e6b073449a6916f7210b1542d39d05b67618e774e4c3b742825ca736d1861f2443bd537af88d
|
@@ -1,5 +1,167 @@
|
|
1
1
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.MapboxDirections = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2
2
|
'use strict';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
|
6
|
+
*
|
7
|
+
* Some parts from [this implementation](http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js)
|
8
|
+
* by [Mark McClure](http://facstaff.unca.edu/mcmcclur/)
|
9
|
+
*
|
10
|
+
* @module polyline
|
11
|
+
*/
|
12
|
+
|
13
|
+
var polyline = {};
|
14
|
+
|
15
|
+
function py2_round(value) {
|
16
|
+
// Google's polyline algorithm uses the same rounding strategy as Python 2, which is different from JS for negative values
|
17
|
+
return Math.floor(Math.abs(value) + 0.5) * (value >= 0 ? 1 : -1);
|
18
|
+
}
|
19
|
+
|
20
|
+
function encode(current, previous, factor) {
|
21
|
+
current = py2_round(current * factor);
|
22
|
+
previous = py2_round(previous * factor);
|
23
|
+
var coordinate = current - previous;
|
24
|
+
coordinate <<= 1;
|
25
|
+
if (current - previous < 0) {
|
26
|
+
coordinate = ~coordinate;
|
27
|
+
}
|
28
|
+
var output = '';
|
29
|
+
while (coordinate >= 0x20) {
|
30
|
+
output += String.fromCharCode((0x20 | (coordinate & 0x1f)) + 63);
|
31
|
+
coordinate >>= 5;
|
32
|
+
}
|
33
|
+
output += String.fromCharCode(coordinate + 63);
|
34
|
+
return output;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Decodes to a [latitude, longitude] coordinates array.
|
39
|
+
*
|
40
|
+
* This is adapted from the implementation in Project-OSRM.
|
41
|
+
*
|
42
|
+
* @param {String} str
|
43
|
+
* @param {Number} precision
|
44
|
+
* @returns {Array}
|
45
|
+
*
|
46
|
+
* @see https://github.com/Project-OSRM/osrm-frontend/blob/master/WebContent/routing/OSRM.RoutingGeometry.js
|
47
|
+
*/
|
48
|
+
polyline.decode = function(str, precision) {
|
49
|
+
var index = 0,
|
50
|
+
lat = 0,
|
51
|
+
lng = 0,
|
52
|
+
coordinates = [],
|
53
|
+
shift = 0,
|
54
|
+
result = 0,
|
55
|
+
byte = null,
|
56
|
+
latitude_change,
|
57
|
+
longitude_change,
|
58
|
+
factor = Math.pow(10, Number.isInteger(precision) ? precision : 5);
|
59
|
+
|
60
|
+
// Coordinates have variable length when encoded, so just keep
|
61
|
+
// track of whether we've hit the end of the string. In each
|
62
|
+
// loop iteration, a single coordinate is decoded.
|
63
|
+
while (index < str.length) {
|
64
|
+
|
65
|
+
// Reset shift, result, and byte
|
66
|
+
byte = null;
|
67
|
+
shift = 0;
|
68
|
+
result = 0;
|
69
|
+
|
70
|
+
do {
|
71
|
+
byte = str.charCodeAt(index++) - 63;
|
72
|
+
result |= (byte & 0x1f) << shift;
|
73
|
+
shift += 5;
|
74
|
+
} while (byte >= 0x20);
|
75
|
+
|
76
|
+
latitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
77
|
+
|
78
|
+
shift = result = 0;
|
79
|
+
|
80
|
+
do {
|
81
|
+
byte = str.charCodeAt(index++) - 63;
|
82
|
+
result |= (byte & 0x1f) << shift;
|
83
|
+
shift += 5;
|
84
|
+
} while (byte >= 0x20);
|
85
|
+
|
86
|
+
longitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
87
|
+
|
88
|
+
lat += latitude_change;
|
89
|
+
lng += longitude_change;
|
90
|
+
|
91
|
+
coordinates.push([lat / factor, lng / factor]);
|
92
|
+
}
|
93
|
+
|
94
|
+
return coordinates;
|
95
|
+
};
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Encodes the given [latitude, longitude] coordinates array.
|
99
|
+
*
|
100
|
+
* @param {Array.<Array.<Number>>} coordinates
|
101
|
+
* @param {Number} precision
|
102
|
+
* @returns {String}
|
103
|
+
*/
|
104
|
+
polyline.encode = function(coordinates, precision) {
|
105
|
+
if (!coordinates.length) { return ''; }
|
106
|
+
|
107
|
+
var factor = Math.pow(10, Number.isInteger(precision) ? precision : 5),
|
108
|
+
output = encode(coordinates[0][0], 0, factor) + encode(coordinates[0][1], 0, factor);
|
109
|
+
|
110
|
+
for (var i = 1; i < coordinates.length; i++) {
|
111
|
+
var a = coordinates[i], b = coordinates[i - 1];
|
112
|
+
output += encode(a[0], b[0], factor);
|
113
|
+
output += encode(a[1], b[1], factor);
|
114
|
+
}
|
115
|
+
|
116
|
+
return output;
|
117
|
+
};
|
118
|
+
|
119
|
+
function flipped(coords) {
|
120
|
+
var flipped = [];
|
121
|
+
for (var i = 0; i < coords.length; i++) {
|
122
|
+
flipped.push(coords[i].slice().reverse());
|
123
|
+
}
|
124
|
+
return flipped;
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Encodes a GeoJSON LineString feature/geometry.
|
129
|
+
*
|
130
|
+
* @param {Object} geojson
|
131
|
+
* @param {Number} precision
|
132
|
+
* @returns {String}
|
133
|
+
*/
|
134
|
+
polyline.fromGeoJSON = function(geojson, precision) {
|
135
|
+
if (geojson && geojson.type === 'Feature') {
|
136
|
+
geojson = geojson.geometry;
|
137
|
+
}
|
138
|
+
if (!geojson || geojson.type !== 'LineString') {
|
139
|
+
throw new Error('Input must be a GeoJSON LineString');
|
140
|
+
}
|
141
|
+
return polyline.encode(flipped(geojson.coordinates), precision);
|
142
|
+
};
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Decodes to a GeoJSON LineString geometry.
|
146
|
+
*
|
147
|
+
* @param {String} str
|
148
|
+
* @param {Number} precision
|
149
|
+
* @returns {Object}
|
150
|
+
*/
|
151
|
+
polyline.toGeoJSON = function(str, precision) {
|
152
|
+
var coords = polyline.decode(str, precision);
|
153
|
+
return {
|
154
|
+
type: 'LineString',
|
155
|
+
coordinates: flipped(coords)
|
156
|
+
};
|
157
|
+
};
|
158
|
+
|
159
|
+
if (typeof module === 'object' && module.exports) {
|
160
|
+
module.exports = polyline;
|
161
|
+
}
|
162
|
+
|
163
|
+
},{}],2:[function(require,module,exports){
|
164
|
+
'use strict';
|
3
165
|
var isObj = require('is-obj');
|
4
166
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
5
167
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
@@ -68,7 +230,7 @@ module.exports = function deepAssign(target) {
|
|
68
230
|
return target;
|
69
231
|
};
|
70
232
|
|
71
|
-
},{"is-obj":
|
233
|
+
},{"is-obj":5}],3:[function(require,module,exports){
|
72
234
|
// Copyright Joyent, Inc. and other Node contributors.
|
73
235
|
//
|
74
236
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
@@ -372,7 +534,7 @@ function isUndefined(arg) {
|
|
372
534
|
return arg === void 0;
|
373
535
|
}
|
374
536
|
|
375
|
-
},{}],
|
537
|
+
},{}],4:[function(require,module,exports){
|
376
538
|
/*
|
377
539
|
* Fuzzy
|
378
540
|
* https://github.com/myork/fuzzy
|
@@ -518,14 +680,14 @@ fuzzy.filter = function(pattern, arr, opts) {
|
|
518
680
|
}());
|
519
681
|
|
520
682
|
|
521
|
-
},{}],
|
683
|
+
},{}],5:[function(require,module,exports){
|
522
684
|
'use strict';
|
523
685
|
module.exports = function (x) {
|
524
686
|
var type = typeof x;
|
525
687
|
return x !== null && (type === 'object' || type === 'function');
|
526
688
|
};
|
527
689
|
|
528
|
-
},{}],
|
690
|
+
},{}],6:[function(require,module,exports){
|
529
691
|
/**
|
530
692
|
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
|
531
693
|
* Build: `lodash modern modularize exports="npm" -o ./`
|
@@ -540,7 +702,7 @@ var reInterpolate = /<%=([\s\S]+?)%>/g;
|
|
540
702
|
|
541
703
|
module.exports = reInterpolate;
|
542
704
|
|
543
|
-
},{}],
|
705
|
+
},{}],7:[function(require,module,exports){
|
544
706
|
(function (global){
|
545
707
|
/**
|
546
708
|
* lodash (Custom Build) <https://lodash.com/>
|
@@ -921,7 +1083,7 @@ function toNumber(value) {
|
|
921
1083
|
module.exports = debounce;
|
922
1084
|
|
923
1085
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
924
|
-
},{}],
|
1086
|
+
},{}],8:[function(require,module,exports){
|
925
1087
|
(function (global){
|
926
1088
|
/**
|
927
1089
|
* Lodash (Custom Build) <https://lodash.com/>
|
@@ -2773,7 +2935,7 @@ function stubFalse() {
|
|
2773
2935
|
module.exports = isEqual;
|
2774
2936
|
|
2775
2937
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
2776
|
-
},{}],
|
2938
|
+
},{}],9:[function(require,module,exports){
|
2777
2939
|
(function (global){
|
2778
2940
|
/**
|
2779
2941
|
* lodash (Custom Build) <https://lodash.com/>
|
@@ -3909,7 +4071,7 @@ var attempt = baseRest(function(func, args) {
|
|
3909
4071
|
module.exports = template;
|
3910
4072
|
|
3911
4073
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
3912
|
-
},{"lodash._reinterpolate":
|
4074
|
+
},{"lodash._reinterpolate":6,"lodash.templatesettings":10}],10:[function(require,module,exports){
|
3913
4075
|
(function (global){
|
3914
4076
|
/**
|
3915
4077
|
* lodash (Custom Build) <https://lodash.com/>
|
@@ -4193,7 +4355,7 @@ function escape(string) {
|
|
4193
4355
|
module.exports = templateSettings;
|
4194
4356
|
|
4195
4357
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
4196
|
-
},{"lodash._reinterpolate":
|
4358
|
+
},{"lodash._reinterpolate":6}],11:[function(require,module,exports){
|
4197
4359
|
var root = require('./_root');
|
4198
4360
|
|
4199
4361
|
/** Built-in value references. */
|
@@ -4201,7 +4363,7 @@ var Symbol = root.Symbol;
|
|
4201
4363
|
|
4202
4364
|
module.exports = Symbol;
|
4203
4365
|
|
4204
|
-
},{"./_root":
|
4366
|
+
},{"./_root":18}],12:[function(require,module,exports){
|
4205
4367
|
var Symbol = require('./_Symbol'),
|
4206
4368
|
getRawTag = require('./_getRawTag'),
|
4207
4369
|
objectToString = require('./_objectToString');
|
@@ -4231,7 +4393,7 @@ function baseGetTag(value) {
|
|
4231
4393
|
|
4232
4394
|
module.exports = baseGetTag;
|
4233
4395
|
|
4234
|
-
},{"./_Symbol":
|
4396
|
+
},{"./_Symbol":11,"./_getRawTag":15,"./_objectToString":16}],13:[function(require,module,exports){
|
4235
4397
|
(function (global){
|
4236
4398
|
/** Detect free variable `global` from Node.js. */
|
4237
4399
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
@@ -4239,7 +4401,7 @@ var freeGlobal = typeof global == 'object' && global && global.Object === Object
|
|
4239
4401
|
module.exports = freeGlobal;
|
4240
4402
|
|
4241
4403
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
4242
|
-
},{}],
|
4404
|
+
},{}],14:[function(require,module,exports){
|
4243
4405
|
var overArg = require('./_overArg');
|
4244
4406
|
|
4245
4407
|
/** Built-in value references. */
|
@@ -4247,7 +4409,7 @@ var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
4247
4409
|
|
4248
4410
|
module.exports = getPrototype;
|
4249
4411
|
|
4250
|
-
},{"./_overArg":
|
4412
|
+
},{"./_overArg":17}],15:[function(require,module,exports){
|
4251
4413
|
var Symbol = require('./_Symbol');
|
4252
4414
|
|
4253
4415
|
/** Used for built-in method references. */
|
@@ -4295,7 +4457,7 @@ function getRawTag(value) {
|
|
4295
4457
|
|
4296
4458
|
module.exports = getRawTag;
|
4297
4459
|
|
4298
|
-
},{"./_Symbol":
|
4460
|
+
},{"./_Symbol":11}],16:[function(require,module,exports){
|
4299
4461
|
/** Used for built-in method references. */
|
4300
4462
|
var objectProto = Object.prototype;
|
4301
4463
|
|
@@ -4319,7 +4481,7 @@ function objectToString(value) {
|
|
4319
4481
|
|
4320
4482
|
module.exports = objectToString;
|
4321
4483
|
|
4322
|
-
},{}],
|
4484
|
+
},{}],17:[function(require,module,exports){
|
4323
4485
|
/**
|
4324
4486
|
* Creates a unary function that invokes `func` with its argument transformed.
|
4325
4487
|
*
|
@@ -4336,7 +4498,7 @@ function overArg(func, transform) {
|
|
4336
4498
|
|
4337
4499
|
module.exports = overArg;
|
4338
4500
|
|
4339
|
-
},{}],
|
4501
|
+
},{}],18:[function(require,module,exports){
|
4340
4502
|
var freeGlobal = require('./_freeGlobal');
|
4341
4503
|
|
4342
4504
|
/** Detect free variable `self`. */
|
@@ -4347,7 +4509,7 @@ var root = freeGlobal || freeSelf || Function('return this')();
|
|
4347
4509
|
|
4348
4510
|
module.exports = root;
|
4349
4511
|
|
4350
|
-
},{"./_freeGlobal":
|
4512
|
+
},{"./_freeGlobal":13}],19:[function(require,module,exports){
|
4351
4513
|
/**
|
4352
4514
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
4353
4515
|
* and has a `typeof` result of "object".
|
@@ -4378,7 +4540,7 @@ function isObjectLike(value) {
|
|
4378
4540
|
|
4379
4541
|
module.exports = isObjectLike;
|
4380
4542
|
|
4381
|
-
},{}],
|
4543
|
+
},{}],20:[function(require,module,exports){
|
4382
4544
|
var baseGetTag = require('./_baseGetTag'),
|
4383
4545
|
getPrototype = require('./_getPrototype'),
|
4384
4546
|
isObjectLike = require('./isObjectLike');
|
@@ -4442,162 +4604,7 @@ function isPlainObject(value) {
|
|
4442
4604
|
|
4443
4605
|
module.exports = isPlainObject;
|
4444
4606
|
|
4445
|
-
},{"./_baseGetTag":
|
4446
|
-
'use strict';
|
4447
|
-
|
4448
|
-
/**
|
4449
|
-
* Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
|
4450
|
-
*
|
4451
|
-
* Some parts from [this implementation](http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js)
|
4452
|
-
* by [Mark McClure](http://facstaff.unca.edu/mcmcclur/)
|
4453
|
-
*
|
4454
|
-
* @module polyline
|
4455
|
-
*/
|
4456
|
-
|
4457
|
-
var polyline = {};
|
4458
|
-
|
4459
|
-
function encode(coordinate, factor) {
|
4460
|
-
coordinate = Math.round(coordinate * factor);
|
4461
|
-
coordinate <<= 1;
|
4462
|
-
if (coordinate < 0) {
|
4463
|
-
coordinate = ~coordinate;
|
4464
|
-
}
|
4465
|
-
var output = '';
|
4466
|
-
while (coordinate >= 0x20) {
|
4467
|
-
output += String.fromCharCode((0x20 | (coordinate & 0x1f)) + 63);
|
4468
|
-
coordinate >>= 5;
|
4469
|
-
}
|
4470
|
-
output += String.fromCharCode(coordinate + 63);
|
4471
|
-
return output;
|
4472
|
-
}
|
4473
|
-
|
4474
|
-
/**
|
4475
|
-
* Decodes to a [latitude, longitude] coordinates array.
|
4476
|
-
*
|
4477
|
-
* This is adapted from the implementation in Project-OSRM.
|
4478
|
-
*
|
4479
|
-
* @param {String} str
|
4480
|
-
* @param {Number} precision
|
4481
|
-
* @returns {Array}
|
4482
|
-
*
|
4483
|
-
* @see https://github.com/Project-OSRM/osrm-frontend/blob/master/WebContent/routing/OSRM.RoutingGeometry.js
|
4484
|
-
*/
|
4485
|
-
polyline.decode = function(str, precision) {
|
4486
|
-
var index = 0,
|
4487
|
-
lat = 0,
|
4488
|
-
lng = 0,
|
4489
|
-
coordinates = [],
|
4490
|
-
shift = 0,
|
4491
|
-
result = 0,
|
4492
|
-
byte = null,
|
4493
|
-
latitude_change,
|
4494
|
-
longitude_change,
|
4495
|
-
factor = Math.pow(10, precision || 5);
|
4496
|
-
|
4497
|
-
// Coordinates have variable length when encoded, so just keep
|
4498
|
-
// track of whether we've hit the end of the string. In each
|
4499
|
-
// loop iteration, a single coordinate is decoded.
|
4500
|
-
while (index < str.length) {
|
4501
|
-
|
4502
|
-
// Reset shift, result, and byte
|
4503
|
-
byte = null;
|
4504
|
-
shift = 0;
|
4505
|
-
result = 0;
|
4506
|
-
|
4507
|
-
do {
|
4508
|
-
byte = str.charCodeAt(index++) - 63;
|
4509
|
-
result |= (byte & 0x1f) << shift;
|
4510
|
-
shift += 5;
|
4511
|
-
} while (byte >= 0x20);
|
4512
|
-
|
4513
|
-
latitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
4514
|
-
|
4515
|
-
shift = result = 0;
|
4516
|
-
|
4517
|
-
do {
|
4518
|
-
byte = str.charCodeAt(index++) - 63;
|
4519
|
-
result |= (byte & 0x1f) << shift;
|
4520
|
-
shift += 5;
|
4521
|
-
} while (byte >= 0x20);
|
4522
|
-
|
4523
|
-
longitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
|
4524
|
-
|
4525
|
-
lat += latitude_change;
|
4526
|
-
lng += longitude_change;
|
4527
|
-
|
4528
|
-
coordinates.push([lat / factor, lng / factor]);
|
4529
|
-
}
|
4530
|
-
|
4531
|
-
return coordinates;
|
4532
|
-
};
|
4533
|
-
|
4534
|
-
/**
|
4535
|
-
* Encodes the given [latitude, longitude] coordinates array.
|
4536
|
-
*
|
4537
|
-
* @param {Array.<Array.<Number>>} coordinates
|
4538
|
-
* @param {Number} precision
|
4539
|
-
* @returns {String}
|
4540
|
-
*/
|
4541
|
-
polyline.encode = function(coordinates, precision) {
|
4542
|
-
if (!coordinates.length) { return ''; }
|
4543
|
-
|
4544
|
-
var factor = Math.pow(10, precision || 5),
|
4545
|
-
output = encode(coordinates[0][0], factor) + encode(coordinates[0][1], factor);
|
4546
|
-
|
4547
|
-
for (var i = 1; i < coordinates.length; i++) {
|
4548
|
-
var a = coordinates[i], b = coordinates[i - 1];
|
4549
|
-
output += encode(a[0] - b[0], factor);
|
4550
|
-
output += encode(a[1] - b[1], factor);
|
4551
|
-
}
|
4552
|
-
|
4553
|
-
return output;
|
4554
|
-
};
|
4555
|
-
|
4556
|
-
function flipped(coords) {
|
4557
|
-
var flipped = [];
|
4558
|
-
for (var i = 0; i < coords.length; i++) {
|
4559
|
-
flipped.push(coords[i].slice().reverse());
|
4560
|
-
}
|
4561
|
-
return flipped;
|
4562
|
-
}
|
4563
|
-
|
4564
|
-
/**
|
4565
|
-
* Encodes a GeoJSON LineString feature/geometry.
|
4566
|
-
*
|
4567
|
-
* @param {Object} geojson
|
4568
|
-
* @param {Number} precision
|
4569
|
-
* @returns {String}
|
4570
|
-
*/
|
4571
|
-
polyline.fromGeoJSON = function(geojson, precision) {
|
4572
|
-
if (geojson && geojson.type === 'Feature') {
|
4573
|
-
geojson = geojson.geometry;
|
4574
|
-
}
|
4575
|
-
if (!geojson || geojson.type !== 'LineString') {
|
4576
|
-
throw new Error('Input must be a GeoJSON LineString');
|
4577
|
-
}
|
4578
|
-
return polyline.encode(flipped(geojson.coordinates), precision);
|
4579
|
-
};
|
4580
|
-
|
4581
|
-
/**
|
4582
|
-
* Decodes to a GeoJSON LineString geometry.
|
4583
|
-
*
|
4584
|
-
* @param {String} str
|
4585
|
-
* @param {Number} precision
|
4586
|
-
* @returns {Object}
|
4587
|
-
*/
|
4588
|
-
polyline.toGeoJSON = function(str, precision) {
|
4589
|
-
var coords = polyline.decode(str, precision);
|
4590
|
-
return {
|
4591
|
-
type: 'LineString',
|
4592
|
-
coordinates: flipped(coords)
|
4593
|
-
};
|
4594
|
-
};
|
4595
|
-
|
4596
|
-
if (typeof module === 'object' && module.exports) {
|
4597
|
-
module.exports = polyline;
|
4598
|
-
}
|
4599
|
-
|
4600
|
-
},{}],21:[function(require,module,exports){
|
4607
|
+
},{"./_baseGetTag":12,"./_getPrototype":14,"./isObjectLike":19}],21:[function(require,module,exports){
|
4601
4608
|
// shim for using process in browser
|
4602
4609
|
var process = module.exports = {};
|
4603
4610
|
|
@@ -5064,7 +5071,7 @@ function combineReducers(reducers) {
|
|
5064
5071
|
};
|
5065
5072
|
}
|
5066
5073
|
}).call(this,require('_process'))
|
5067
|
-
},{"./createStore":27,"./utils/warning":29,"_process":21,"lodash/isPlainObject":
|
5074
|
+
},{"./createStore":27,"./utils/warning":29,"_process":21,"lodash/isPlainObject":20}],26:[function(require,module,exports){
|
5068
5075
|
"use strict";
|
5069
5076
|
|
5070
5077
|
exports.__esModule = true;
|
@@ -5363,7 +5370,7 @@ var ActionTypes = exports.ActionTypes = {
|
|
5363
5370
|
replaceReducer: replaceReducer
|
5364
5371
|
}, _ref2[_symbolObservable2['default']] = observable, _ref2;
|
5365
5372
|
}
|
5366
|
-
},{"lodash/isPlainObject":
|
5373
|
+
},{"lodash/isPlainObject":20,"symbol-observable":33}],28:[function(require,module,exports){
|
5367
5374
|
(function (process){
|
5368
5375
|
'use strict';
|
5369
5376
|
|
@@ -5813,7 +5820,7 @@ Suggestions.prototype.getItemValue = function(item) {
|
|
5813
5820
|
|
5814
5821
|
module.exports = Suggestions;
|
5815
5822
|
|
5816
|
-
},{"./list":31,"fuzzy":
|
5823
|
+
},{"./list":31,"fuzzy":4,"xtend":37}],33:[function(require,module,exports){
|
5817
5824
|
(function (global){
|
5818
5825
|
'use strict';
|
5819
5826
|
|
@@ -6198,7 +6205,8 @@ function fetchDirections() {
|
|
6198
6205
|
profile = _getState.profile,
|
6199
6206
|
alternatives = _getState.alternatives,
|
6200
6207
|
congestion = _getState.congestion,
|
6201
|
-
destination = _getState.destination
|
6208
|
+
destination = _getState.destination,
|
6209
|
+
language = _getState.language;
|
6202
6210
|
// if there is no destination set, do not make request because it will fail
|
6203
6211
|
|
6204
6212
|
|
@@ -6213,6 +6221,7 @@ function fetchDirections() {
|
|
6213
6221
|
if (congestion) options.push('annotations=congestion');
|
6214
6222
|
options.push('steps=true');
|
6215
6223
|
options.push('overview=full');
|
6224
|
+
if (language) options.push('language=' + language);
|
6216
6225
|
if (accessToken) options.push('access_token=' + accessToken);
|
6217
6226
|
request.abort();
|
6218
6227
|
request.open('GET', '' + api + profile + '/' + query + '.json?' + options.join('&'), true);
|
@@ -6836,7 +6845,7 @@ var Geocoder = function () {
|
|
6836
6845
|
exports.default = Geocoder;
|
6837
6846
|
;
|
6838
6847
|
|
6839
|
-
},{"../utils":47,"events":
|
6848
|
+
},{"../utils":47,"events":3,"lodash.debounce":7,"suggestions":30}],41:[function(require,module,exports){
|
6840
6849
|
'use strict';
|
6841
6850
|
|
6842
6851
|
Object.defineProperty(exports, "__esModule", {
|
@@ -7037,7 +7046,7 @@ var Inputs = function () {
|
|
7037
7046
|
|
7038
7047
|
exports.default = Inputs;
|
7039
7048
|
|
7040
|
-
},{"./geocoder":40,"lodash.isequal":
|
7049
|
+
},{"./geocoder":40,"lodash.isequal":8,"lodash.template":9,"turf-extent":35}],42:[function(require,module,exports){
|
7041
7050
|
'use strict';
|
7042
7051
|
|
7043
7052
|
Object.defineProperty(exports, "__esModule", {
|
@@ -7172,7 +7181,7 @@ var Instructions = function () {
|
|
7172
7181
|
|
7173
7182
|
exports.default = Instructions;
|
7174
7183
|
|
7175
|
-
},{"../utils":47,"lodash.isequal":
|
7184
|
+
},{"../utils":47,"lodash.isequal":8,"lodash.template":9}],43:[function(require,module,exports){
|
7176
7185
|
'use strict';
|
7177
7186
|
|
7178
7187
|
Object.defineProperty(exports, "__esModule", {
|
@@ -7187,7 +7196,7 @@ var _reduxThunk = require('redux-thunk');
|
|
7187
7196
|
|
7188
7197
|
var _reduxThunk2 = _interopRequireDefault(_reduxThunk);
|
7189
7198
|
|
7190
|
-
var _polyline = require('polyline');
|
7199
|
+
var _polyline = require('@mapbox/polyline');
|
7191
7200
|
|
7192
7201
|
var _utils = require('./utils');
|
7193
7202
|
|
@@ -7247,6 +7256,7 @@ var store = storeWithMiddleware(_reducers2.default);
|
|
7247
7256
|
* @param {Boolean} [options.controls.instructions=true] Hide or display the instructions control.
|
7248
7257
|
* @param {Boolean} [options.controls.profileSwitcher=true] Hide or display the default profile switch with options for traffic, driving, walking and cycling.
|
7249
7258
|
* @param {Number} [options.zoom=16] If no bbox exists from the geocoder result, the zoom you set here will be used in the flyTo.
|
7259
|
+
* @param {String} [options.language="en"] The language of returned turn-by-turn text instructions. See supported languages : https://docs.mapbox.com/api/navigation/#instructions-languages
|
7250
7260
|
* @param {String} [options.placeholderOrigin="Choose a starting place"] If set, this text will appear as the placeholder attribute for the origin input element.
|
7251
7261
|
* @param {String} [options.placeholderDestination="Choose destination"] If set, this text will appear as the placeholder attribute for the destination input element.
|
7252
7262
|
* @param {Boolean} [options.flyTo=true] If false, animating the map to a selected result is disabled.
|
@@ -7834,7 +7844,7 @@ var MapboxDirections = function () {
|
|
7834
7844
|
|
7835
7845
|
exports.default = MapboxDirections;
|
7836
7846
|
|
7837
|
-
},{"./actions":38,"./controls/inputs":41,"./controls/instructions":42,"./directions_style":44,"./reducers":46,"./utils":47,"polyline":
|
7847
|
+
},{"./actions":38,"./controls/inputs":41,"./controls/instructions":42,"./directions_style":44,"./reducers":46,"./utils":47,"@mapbox/polyline":1,"redux":28,"redux-thunk":22}],44:[function(require,module,exports){
|
7838
7848
|
'use strict';
|
7839
7849
|
|
7840
7850
|
Object.defineProperty(exports, "__esModule", {
|
@@ -8009,6 +8019,7 @@ var initialState = {
|
|
8009
8019
|
placeholderOrigin: 'Choose a starting place',
|
8010
8020
|
placeholderDestination: 'Choose destination',
|
8011
8021
|
zoom: 16,
|
8022
|
+
language: 'en',
|
8012
8023
|
compile: null,
|
8013
8024
|
proximity: false,
|
8014
8025
|
styles: [],
|
@@ -8138,7 +8149,7 @@ function data() {
|
|
8138
8149
|
|
8139
8150
|
exports.default = data;
|
8140
8151
|
|
8141
|
-
},{"../constants/action_types.js":39,"deep-assign":
|
8152
|
+
},{"../constants/action_types.js":39,"deep-assign":2}],47:[function(require,module,exports){
|
8142
8153
|
'use strict';
|
8143
8154
|
|
8144
8155
|
Object.defineProperty(exports, "__esModule", {
|