Renames L.LatLng property .altitude to .alt
This commit is contained in:
parent
46885de00d
commit
8e98e52b88
@ -18,15 +18,15 @@ describe('LatLng', function() {
|
||||
|
||||
it ('does not set altitude if undefined', function () {
|
||||
var a = new L.LatLng(25, 74);
|
||||
expect(typeof a.altitude).to.eql('undefined');
|
||||
expect(typeof a.alt).to.eql('undefined');
|
||||
});
|
||||
|
||||
it ('sets altitude', function () {
|
||||
var a = new L.LatLng(25, 74, 50);
|
||||
expect(a.altitude).to.eql(50);
|
||||
expect(a.alt).to.eql(50);
|
||||
|
||||
var b = new L.LatLng(-25, -74, -50);
|
||||
expect(b.altitude).to.eql(-50);
|
||||
expect(b.alt).to.eql(-50);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
* L.LatLng represents a geographical point with latitude and longitude coordinates.
|
||||
*/
|
||||
|
||||
L.LatLng = function (rawLat, rawLng, rawAltitude) { // (Number, Number, Number)
|
||||
L.LatLng = function (rawLat, rawLng, rawAlt) { // (Number, Number, Number)
|
||||
var lat = parseFloat(rawLat),
|
||||
lng = parseFloat(rawLng);
|
||||
|
||||
@ -13,8 +13,8 @@ L.LatLng = function (rawLat, rawLng, rawAltitude) { // (Number, Number, Number)
|
||||
this.lat = lat;
|
||||
this.lng = lng;
|
||||
|
||||
if (typeof rawAltitude !== 'undefined') {
|
||||
this.altitude = parseFloat(rawAltitude);
|
||||
if (typeof rawAlt !== 'undefined') {
|
||||
this.alt = parseFloat(rawAlt);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -147,10 +147,10 @@ L.extend(L.GeoJSON, {
|
||||
},
|
||||
|
||||
latLngToCoords: function (latLng) {
|
||||
if (typeof latLng.altitude === 'undefined') {
|
||||
if (typeof latLng.alt === 'undefined') {
|
||||
return [latLng.lng, latLng.lat];
|
||||
} else {
|
||||
return [latLng.lng, latLng.lat, latLng.altitude];
|
||||
return [latLng.lng, latLng.lat, latLng.alt];
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user