summaryrefslogtreecommitdiff
path: root/src/client/model/core.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-07-30 18:04:57 +0300
committerAlon Levy <alon@pobox.com>2015-07-30 18:04:57 +0300
commit4a30ef3c352ebe70c3e6f1af4a728d3f82c3c2a8 (patch)
treead43ae5dc9b4588259019f236f094a659052ef93 /src/client/model/core.js
parentec899fb5dbbe39f45f5dcc47ea39df3a38f2229f (diff)
Revert "wip: find the nan for position update from db"
This reverts commit ec899fb5dbbe39f45f5dcc47ea39df3a38f2229f.
Diffstat (limited to 'src/client/model/core.js')
-rw-r--r--src/client/model/core.js23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/client/model/core.js b/src/client/model/core.js
index ff484daf..fb037832 100644
--- a/src/client/model/core.js
+++ b/src/client/model/core.js
@@ -47,27 +47,18 @@ define(['util'], function(util) {
}
function init(config){
- if (config.rand_id_generator === 'hash') {
+ if (config['rand_id_generator'] == 'hash') {
random_id = random_id__hash;
}
- if (config.rand_id_generator === 'seq') {
+ if (config['rand_id_generator'] == 'seq') {
random_id = random_id__seq();
}
}
function Node() {
- Object.defineProperty(this, "x", {
- set: function (new_x) {
- console.log('Node ' + this.id + '.x = ' + new_x);
- this._x = new_x;
- },
- get: function () {
- return this._x;
- }
- });
}
Node.prototype.equals = function(other_node){
- return this.id === other_node.id;
+ return this.id == other_node.id;
};
function Link() {
@@ -86,17 +77,17 @@ define(['util'], function(util) {
*/
function create_node_from_spec(node_spec) {
- util.assert(undefined !== node_spec.name, 'create_node_from_spec: name missing');
+ util.assert(undefined != node_spec.name, 'create_node_from_spec: name missing');
var ret = new Node();
- if (undefined !== node_spec.id) {
+ if (undefined != node_spec.id) {
// reuse id if present
__set_obj_id(ret, node_spec.id);
}
// type
- if (undefined === node_spec.type) {
+ if (undefined == node_spec.type) {
console.debug('create_node_from_spec: undefined type, falling back to \'perm\'');
node_spec.type = 'perm';
}
@@ -143,7 +134,7 @@ define(['util'], function(util) {
var ret = create_link_from_spec(src, dst, link_spec);
__set_obj_id(ret, random_id());
return ret;
- }
+ }
/**
* determine if nodes are equal by name