OK those bugs are fixed. The great Javascript refactor is done for tonight.

graphsettings.js has been split into the following files (shown with line counts):

:javascripts Devin$ wc -l Jit/graphsettings.js
     384 Jit/graphsettings.js
:javascripts Devin$ wc -l Jit/onCreateLabelHandler.js
     281 Jit/onCreateLabelHandler.js
:javascripts Devin$ wc -l Jit/select-edit-delete-nodes-and-edges.js
     185 Jit/select-edit-delete-nodes-and-edges.js
:javascripts Devin$ wc -l Jit/graphsettings-model.js
      12 Jit/graphsettings-model.js
:javascripts Devin$ wc -l Jit/graphsettings-event-handlers.js
     145 Jit/graphsettings-event-handlers.js
This commit is contained in:
Devin Howard 2013-01-10 22:19:44 -05:00
parent bb1bf2d05f
commit d3358d17d0
3 changed files with 20 additions and 22 deletions

View file

@ -81,6 +81,7 @@ function graphSettings(type) {
} else { } else {
canvasDoubleClickHandler(eventInfo.getPos(), e); canvasDoubleClickHandler(eventInfo.getPos(), e);
}//if }//if
}
}, },
//Number of iterations for the FD algorithm //Number of iterations for the FD algorithm
iterations: 200, iterations: 200,
@ -89,16 +90,12 @@ function graphSettings(type) {
// Add text to the labels. This method is only triggered // Add text to the labels. This method is only triggered
// on label creation and only for DOM labels (not native canvas ones). // on label creation and only for DOM labels (not native canvas ones).
onCreateLabel: function (domElement, node) { onCreateLabel: function (domElement, node) {
alert ("onCreateLabel");
console.log(onCreateLabelHandler);
onCreateLabelHandler(domElement, node); onCreateLabelHandler(domElement, node);
}, },
// Change node styles when DOM labels are placed or moved. // Change node styles when DOM labels are placed or moved.
onPlaceLabel: function (domElement, node) { onPlaceLabel: function (domElement, node) {
alert ("onPlaceLabel");
onPlaceLabelHandler(domElement, node); onPlaceLabelHandler(domElement, node);
} }
}//end Events
}; };
if (type == "centered") { if (type == "centered") {

View file

@ -210,12 +210,14 @@ function generateLittleHTML(node) {
littleHTML = littleHTML.replace(/\$_id_\$/g, node.id); littleHTML = littleHTML.replace(/\$_id_\$/g, node.id);
littleHTML = littleHTML.replace(/\$_mapid_\$/g, mapid); littleHTML = littleHTML.replace(/\$_mapid_\$/g, mapid);
littleHTML = littleHTML.replace(/\$_name_\$/g, node.name); littleHTML = littleHTML.replace(/\$_name_\$/g, node.name);
return littleHTML;
} }
function hideCard(id) { function hideCard(node) {
var card = '.showcard'; var card = '.showcard';
if (node != null) { if (node != null) {
card += '.topic_' + id; card += '.topic_' + node.id;
} }
$(card).fadeOut('fast', function(){ $(card).fadeOut('fast', function(){
@ -228,7 +230,7 @@ function hideCard(id) {
function bindCallbacks(showCard, nameContainer, node) { function bindCallbacks(showCard, nameContainer, node) {
// add some events to the label // add some events to the label
$(showCard).find('img.icon').click(function(){ $(showCard).find('img.icon').click(function(){
hideCard(node.id); hideCard(node);
}); });
$(showCard).find('.scroll').mCustomScrollbar(); $(showCard).find('.scroll').mCustomScrollbar();

View file

@ -130,7 +130,6 @@ function saveToMap() {
}); });
synapses_data = synapses_array.join(); synapses_data = synapses_array.join();
console.log(synapses_data);
nodes_data = nodes_data.slice(0, -1); nodes_data = nodes_data.slice(0, -1);
$('#map_topicsToMap').val(nodes_data); $('#map_topicsToMap').val(nodes_data);