You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/05/07 22:52:06 UTC
[2/8] js commit: tweaks to defaults for Coordinates and Position
objects
tweaks to defaults for Coordinates and Position objects
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/b4ec5f72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/b4ec5f72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/b4ec5f72
Branch: refs/heads/master
Commit: b4ec5f72114c205ea8928c70df38f6b51dbf8c3e
Parents: cdd4ba8
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Mar 30 02:35:19 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon May 7 13:51:05 2012 -0700
----------------------------------------------------------------------
lib/common/plugin/Coordinates.js | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/b4ec5f72/lib/common/plugin/Coordinates.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Coordinates.js b/lib/common/plugin/Coordinates.js
index 21a46d6..cdcf187 100644
--- a/lib/common/plugin/Coordinates.js
+++ b/lib/common/plugin/Coordinates.js
@@ -25,19 +25,24 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
/**
* The altitude of the position.
*/
- this.altitude = alt;
+ this.altitude = (alt !== undefined ? alt : null);
/**
* The direction the device is moving at the position.
*/
- this.heading = head;
+ this.heading = (head !== undefined ? head : null);
/**
* The velocity with which the device is moving at the position.
*/
- this.speed = vel;
+ this.speed = (vel !== undefined ? vel : null);
+
+ if (this.speed === 0 || this.speed === null) {
+ this.heading = NaN;
+ }
+
/**
* The altitude accuracy of the position.
*/
this.altitudeAccuracy = (altacc !== undefined) ? altacc : null;
};
-module.exports = Coordinates;
\ No newline at end of file
+module.exports = Coordinates;