diff options
| author | Alon Levy <alon@pobox.com> | 2015-07-30 12:26:52 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-07-30 18:05:06 +0300 |
| commit | 100b384a4aa88a469e27ff4d404b7266f9e3b9af (patch) | |
| tree | d33698628d12287f0e740ad0f7718d0592cf7031 /src/client | |
| parent | f8da6dc6c5fe2aa6520fa34844ef202d5aeaaaff (diff) | |
client/model/core: add a special Node for use for debugging NaN problems
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/model/core.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/model/core.js b/src/client/model/core.js index 4a7e9a7d..6bcc708e 100644 --- a/src/client/model/core.js +++ b/src/client/model/core.js @@ -18,6 +18,8 @@ "use strict"; +var DEBUG_NODE_POSITION = false; + /** * core model module - currently unused */ @@ -55,7 +57,25 @@ define(['util'], function(util) { } } - function Node() { + function NodePlain() { + } + function NodeWithNaNXTest() { + Object.defineProperty(this, "x", { + set: function (new_x) { + if (isNaN(new_x) && !isNaN(this._x)) { + console.log('Node ' + this.id + '.x changed to Nan from ' + this._x); + } + this._x = new_x; + }, + get: function () { + return this._x; + } + }); + } + if (DEBUG_NODE_POSITION) { + Node = NodeWithNaNXTest; + } else { + Node = NodePlain; } Node.prototype.equals = function(other_node){ return this.id === other_node.id; |
