changed onCanvas to whiteCircle and inCommons to greenCircle in node data. Also a few other minor/helpful tweaks
This commit is contained in:
parent
e54c4e24ed
commit
610286cee7
5 changed files with 26 additions and 19 deletions
|
@ -85,7 +85,7 @@ var findMappers = ['name', 'topic (by name)', 'map (by name)', 'synapse (by topi
|
|||
function hideAll(duration) {
|
||||
if (duration == null) duration = 500;
|
||||
Mconsole.graph.eachNode( function (n) {
|
||||
if (!(n.getData('inCommons') || n.getData('onCanvas'))) {
|
||||
if (!(n.getData('greenCircle') || n.getData('whiteCircle'))) {
|
||||
n.setData('alpha', 0.4, 'end');
|
||||
n.eachAdjacency(function(adj) {
|
||||
adj.setData('alpha', 0.4, 'end');
|
||||
|
@ -120,26 +120,26 @@ function onCanvasSearch(searchQuery, mapID, mapperID) {
|
|||
nodeName = n.name.toLowerCase();
|
||||
if (name != null) {
|
||||
if (nodeName.indexOf(searchQuery) !== -1 && searchQuery != "") {
|
||||
n.setData('onCanvas', true);
|
||||
n.setData('whiteCircle', true);
|
||||
}
|
||||
else {
|
||||
n.setData('onCanvas', false);
|
||||
n.setData('whiteCircle', false);
|
||||
}
|
||||
}
|
||||
else if (mapID != null) {
|
||||
if (n.getData('inmaps').indexOf(parseInt(mapID)) !== -1) {
|
||||
n.setData('onCanvas', true);
|
||||
n.setData('whiteCircle', true);
|
||||
}
|
||||
else {
|
||||
n.setData('onCanvas', false);
|
||||
n.setData('whiteCircle', false);
|
||||
}
|
||||
}
|
||||
else if (mapperID != null) {
|
||||
if (n.getData('userid').toString() == mapperID) {
|
||||
n.setData('onCanvas', true);
|
||||
n.setData('whiteCircle', true);
|
||||
}
|
||||
else {
|
||||
n.setData('onCanvas', false);
|
||||
n.setData('whiteCircle', false);
|
||||
}
|
||||
}
|
||||
Mconsole.plot();
|
||||
|
@ -175,7 +175,7 @@ function clearCanvasExceptRoot() {
|
|||
|
||||
function clearFoundData() {
|
||||
Mconsole.graph.eachNode( function(n) {
|
||||
if (n.getData('inCommons') === true) {
|
||||
if (n.getData('greenCircle') === true) {
|
||||
Mconsole.graph.removeNode(n.id);
|
||||
Mconsole.labels.disposeLabel(n.id);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,13 @@ function nodeDoubleClickHandler(node, e) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (node.getData('inCommons') == false) {
|
||||
//greenCircle being true denotes it's actually "in the commons" still
|
||||
if (node.getData('greenCircle') == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
//this line adds it to the console if you close seek
|
||||
node.setData('inCommons', false);
|
||||
node.setData('greenCircle', false);
|
||||
|
||||
//this is just aesthetic
|
||||
deselectNode(node);
|
||||
|
|
|
@ -235,12 +235,12 @@ var nodeSettings = {
|
|||
var pos = node.pos.getc(true),
|
||||
dim = node.getData('dim'),
|
||||
cat = node.getData('metacode'),
|
||||
inCommons = node.getData('inCommons'),
|
||||
onCanvas = node.getData('onCanvas'),
|
||||
greenCircle = node.getData('greenCircle'),
|
||||
whiteCircle = node.getData('whiteCircle'),
|
||||
ctx = canvas.getCtx();
|
||||
|
||||
// if the topic is from the Commons draw a green circle around it
|
||||
if (inCommons) {
|
||||
if (greenCircle) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(pos.x, pos.y, dim+3, 0, 2 * Math.PI, false);
|
||||
ctx.strokeStyle = '#67be5f'; // green
|
||||
|
@ -248,7 +248,7 @@ var nodeSettings = {
|
|||
ctx.stroke();
|
||||
}
|
||||
// if the topic is on the Canvas draw a white circle around it
|
||||
if (onCanvas) {
|
||||
if (whiteCircle) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(pos.x, pos.y, dim+3, 0, 2 * Math.PI, false);
|
||||
if (! MetamapsModel.embed) ctx.strokeStyle = 'white';
|
||||
|
|
|
@ -323,6 +323,7 @@ function bindCallbacks(showCard, nameContainer, node) {
|
|||
$(showCard).find('.best_in_place_name').bind("ajax:success", function() {
|
||||
var name = $(this).html();
|
||||
$(nameContainer).find('.label').html(name);
|
||||
node.name = name;
|
||||
});
|
||||
|
||||
$(showCard).find('.best_in_place_desc').bind("ajax:success", function() {
|
||||
|
|
|
@ -291,7 +291,7 @@ function selectNode(node) {
|
|||
if (MetamapsModel.selectedNodes.indexOf(node) != -1) return;
|
||||
node.selected = true;
|
||||
node.setData('dim', 30, 'current');
|
||||
node.setData('onCanvas',true);
|
||||
node.setData('whiteCircle',true);
|
||||
node.eachAdjacency(function (adj) {
|
||||
selectEdge(adj);
|
||||
});
|
||||
|
@ -300,7 +300,7 @@ function selectNode(node) {
|
|||
|
||||
function deselectNode(node) {
|
||||
delete node.selected;
|
||||
node.setData('onCanvas', false);
|
||||
node.setData('whiteCircle', false);
|
||||
node.eachAdjacency(function(adj) {
|
||||
deselectEdge(adj);
|
||||
});
|
||||
|
@ -373,6 +373,8 @@ function hideNode(nodeid) {
|
|||
alert("You can't hide this topic, it is the root of your graph.");
|
||||
return;
|
||||
}
|
||||
|
||||
deselectNode(node);
|
||||
|
||||
node.setData('alpha', 0, 'end');
|
||||
node.eachAdjacency(function(adj) {
|
||||
|
@ -386,15 +388,18 @@ function hideNode(nodeid) {
|
|||
Mconsole.graph.removeNode(nodeid);
|
||||
Mconsole.labels.disposeLabel(nodeid);
|
||||
}
|
||||
|
||||
function hideSelectedNodes() {
|
||||
Mconsole.graph.eachNode( function (n) {
|
||||
if (n.data.$onCanvas == true) {
|
||||
if (n.getData('whiteCircle') == true) {
|
||||
hideNode(n.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeNode(nodeid) {
|
||||
var node = Mconsole.graph.getNode(nodeid);
|
||||
deselectNode(node);
|
||||
if (mapperm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
@ -405,7 +410,7 @@ function removeNode(nodeid) {
|
|||
function removeSelectedNodes() {
|
||||
if (mapperm) {
|
||||
Mconsole.graph.eachNode( function (n) {
|
||||
if (n.data.$onCanvas == true) {
|
||||
if (n.getData('whiteCircle') == true) {
|
||||
removeNode(n.id);
|
||||
}
|
||||
});
|
||||
|
@ -424,7 +429,7 @@ function deleteNode(nodeid) {
|
|||
}
|
||||
function deleteSelectedNodes() {
|
||||
Mconsole.graph.eachNode( function (n) {
|
||||
if (n.data.$onCanvas == true) {
|
||||
if (n.getData('whiteCircle') == true) {
|
||||
deleteNode(n.id);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue