Merge branch 'master' of github.com:Connoropolous/metamaps_gen002
This commit is contained in:
commit
87d1efd0de
3 changed files with 63 additions and 58 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -7,11 +7,11 @@
|
||||||
config/database.yml
|
config/database.yml
|
||||||
|
|
||||||
# Ignore bundler config
|
# Ignore bundler config
|
||||||
/.bundle
|
.bundle
|
||||||
|
|
||||||
# Ignore the default SQLite database.
|
# Ignore the default SQLite database.
|
||||||
/db/*.sqlite3
|
db/*.sqlite3
|
||||||
|
|
||||||
# Ignore all logfiles and tempfiles.
|
# Ignore all logfiles and tempfiles.
|
||||||
/log/*.log
|
log/*.log
|
||||||
/tmp
|
tmp
|
||||||
|
|
|
@ -80,40 +80,14 @@ function graphSettings(type) {
|
||||||
this.onDragMove(node, eventInfo, e);
|
this.onDragMove(node, eventInfo, e);
|
||||||
},
|
},
|
||||||
//Add also a click handler to nodes
|
//Add also a click handler to nodes
|
||||||
onClick: function (node) {
|
onClick: function (node, eventInfo, e) {
|
||||||
if (!node) return;
|
//clicking on a node, or clicking on blank part of canvas?
|
||||||
//set final styles
|
if (node) {
|
||||||
Mconsole.graph.eachNode(function (n) {
|
selectNodeOnClickHandler(node);
|
||||||
if (n.id != node.id) delete n.selected;
|
|
||||||
n.setData('dim', 25, 'end');
|
|
||||||
n.eachAdjacency(function (adj) {
|
|
||||||
adj.setDataset('end', {
|
|
||||||
lineWidth: 0.5,
|
|
||||||
color: '#222222'
|
|
||||||
});
|
|
||||||
adj.setData('showDesc', false, 'current');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!node.selected) {
|
|
||||||
node.selected = true;
|
|
||||||
node.setData('dim', 35, 'end');
|
|
||||||
node.eachAdjacency(function (adj) {
|
|
||||||
adj.setDataset('end', {
|
|
||||||
lineWidth: 3,
|
|
||||||
color: '#FFF'
|
|
||||||
});
|
|
||||||
adj.setData('showDesc', true, 'current');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
delete node.selected;
|
canvasDoubleClickHandler(e);
|
||||||
}
|
}//if
|
||||||
//trigger animation to final styles
|
}//onClick
|
||||||
Mconsole.fx.animate({
|
|
||||||
modes: ['node-property:dim',
|
|
||||||
'edge-property:lineWidth:color'],
|
|
||||||
duration: 500
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
//Number of iterations for the FD algorithm
|
//Number of iterations for the FD algorithm
|
||||||
iterations: 200,
|
iterations: 200,
|
||||||
|
@ -417,4 +391,56 @@ var nodeSettings = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectNodeOnClickHandler(node) {
|
||||||
|
//set final styles
|
||||||
|
Mconsole.graph.eachNode(function (n) {
|
||||||
|
if (n.id != node.id) delete n.selected;
|
||||||
|
n.setData('dim', 25, 'end');
|
||||||
|
n.eachAdjacency(function (adj) {
|
||||||
|
adj.setDataset('end', {
|
||||||
|
lineWidth: 0.5,
|
||||||
|
color: '#222222'
|
||||||
|
});
|
||||||
|
adj.setData('showDesc', false, 'current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (!node.selected) {
|
||||||
|
node.selected = true;
|
||||||
|
node.setData('dim', 35, 'end');
|
||||||
|
node.eachAdjacency(function (adj) {
|
||||||
|
adj.setDataset('end', {
|
||||||
|
lineWidth: 3,
|
||||||
|
color: '#FFF'
|
||||||
|
});
|
||||||
|
adj.setData('showDesc', true, 'current');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
delete node.selected;
|
||||||
|
}
|
||||||
|
//trigger animation to final styles
|
||||||
|
Mconsole.fx.animate({
|
||||||
|
modes: ['node-property:dim',
|
||||||
|
'edge-property:lineWidth:color'],
|
||||||
|
duration: 500
|
||||||
|
});
|
||||||
|
}//selectNodeOnClickHandler
|
||||||
|
|
||||||
|
//for the canvasDoubleClickHandler function
|
||||||
|
var canvasDoubleClickHandlerObject = new Object();
|
||||||
|
canvasDoubleClickHandlerObject.stored_timestamp = 0;
|
||||||
|
|
||||||
|
function canvasDoubleClickHandler(e) {
|
||||||
|
var TOLERANCE = 1000; //1 second
|
||||||
|
|
||||||
|
//grab the location and timestamp of the click
|
||||||
|
var stored_timestamp = canvasDoubleClickHandlerObject.stored_timestamp;
|
||||||
|
var now = Date.now(); //not compatible with IE8 FYI
|
||||||
|
|
||||||
|
if (now - stored_timestamp < TOLERANCE) {
|
||||||
|
//pop up node creation :)
|
||||||
|
$('#new_item').fadeIn('fast');
|
||||||
|
//NOTE: we have e.x, e.y so use them!!
|
||||||
|
} else {
|
||||||
|
canvasDoubleClickHandlerObject.stored_timestamp = now;
|
||||||
|
}
|
||||||
|
}//canvasDoubleClickHandler
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
development:
|
|
||||||
min_messages: WARNING
|
|
||||||
adapter: postgresql
|
|
||||||
host: 127.0.0.1
|
|
||||||
port: 5432
|
|
||||||
encoding: unicode
|
|
||||||
database: metamap002_development
|
|
||||||
pool: 5
|
|
||||||
username: postgres
|
|
||||||
password: "3112"
|
|
||||||
|
|
||||||
production:
|
|
||||||
min_messages: WARNING
|
|
||||||
adapter: postgresql
|
|
||||||
host: ec2-107-21-107-194.compute-1.amazonaws.com
|
|
||||||
port: 5432
|
|
||||||
encoding: unicode
|
|
||||||
database: ddcrn2lgphjk9k
|
|
||||||
pool: 5
|
|
||||||
username: qqpckkahytovwv
|
|
||||||
password: "njeP6cMA8EjM9ukHk9s3ReOdy7"
|
|
Loading…
Reference in a new issue