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

View file

@ -21,7 +21,7 @@ function onCreateLabelHandler(domElement, node) {
var showCard = document.createElement('div');
showCard.className = 'showcard topic_' + node.id;
showCard.innerHTML = html;
showCard.style.display = "none";
showCard.style.display = "none";
domElement.appendChild(showCard);
// Create a 'name' button and add it to the main node label
@ -210,12 +210,14 @@ function generateLittleHTML(node) {
littleHTML = littleHTML.replace(/\$_id_\$/g, node.id);
littleHTML = littleHTML.replace(/\$_mapid_\$/g, mapid);
littleHTML = littleHTML.replace(/\$_name_\$/g, node.name);
return littleHTML;
}
function hideCard(id) {
function hideCard(node) {
var card = '.showcard';
if (node != null) {
card += '.topic_' + id;
card += '.topic_' + node.id;
}
$(card).fadeOut('fast', function(){
@ -228,7 +230,7 @@ function hideCard(id) {
function bindCallbacks(showCard, nameContainer, node) {
// add some events to the label
$(showCard).find('img.icon').click(function(){
hideCard(node.id);
hideCard(node);
});
$(showCard).find('.scroll').mCustomScrollbar();

View file

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