|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function ( graph ){ |
|
|
|
|
|
var resetMenu = {}, |
|
|
options = graph.graphOptions(), |
|
|
resettableModules, |
|
|
untouchedOptions = webvowl.options(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetMenu.setup = function ( _resettableModules ){ |
|
|
resettableModules = _resettableModules; |
|
|
d3.select("#reset-button").on("click", resetGraph); |
|
|
var menuEntry = d3.select("#resetOption"); |
|
|
menuEntry.on("mouseover", function (){ |
|
|
var searchMenu = graph.options().searchMenu(); |
|
|
searchMenu.hideSearchEntries(); |
|
|
}); |
|
|
}; |
|
|
|
|
|
function resetGraph(){ |
|
|
graph.resetSearchHighlight(); |
|
|
graph.options().searchMenu().clearText(); |
|
|
options.classDistance(untouchedOptions.classDistance()); |
|
|
options.datatypeDistance(untouchedOptions.datatypeDistance()); |
|
|
options.charge(untouchedOptions.charge()); |
|
|
options.gravity(untouchedOptions.gravity()); |
|
|
options.linkStrength(untouchedOptions.linkStrength()); |
|
|
graph.reset(); |
|
|
|
|
|
resettableModules.forEach(function ( module ){ |
|
|
module.reset(); |
|
|
}); |
|
|
|
|
|
graph.updateStyle(); |
|
|
} |
|
|
|
|
|
|
|
|
return resetMenu; |
|
|
}; |
|
|
|