Skip to content

Commit

Permalink
Renames L.LatLng property .altitude to .alt
Browse files Browse the repository at this point in the history
  • Loading branch information
Starefossen committed Jul 3, 2013
1 parent 46885de commit 8e98e52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions spec/suites/geo/LatLngSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

});
Expand Down
6 changes: 3 additions & 3 deletions src/geo/LatLng.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/layer/GeoJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
},

Expand Down

0 comments on commit 8e98e52

Please sign in to comment.