Skip to content
Snippets Groups Projects
Commit 48c47be3 authored by cramakri's avatar cramakri
Browse files

BIS-229 SP-419 : Added scrolling to clicked element after the graph is...

BIS-229 SP-419 : Added scrolling to clicked element after the graph is changed. Implementation could be improved still.

SVN: 27920
parent 945e6a7a
No related branches found
No related tags found
No related merge requests found
......@@ -276,6 +276,7 @@ SampleGraphModel.prototype.coalesceGraphData = function(data, callback) {
function SampleGraphPresenter(model) {
this.model = model;
this.renderer = new DagreGraphRenderer();
this.selectedNode = null;
this.didCreateVis = false;
this.useBottomUpMode();
this.initializePresenter();
......@@ -440,6 +441,7 @@ SampleGraphPresenter.prototype.draw = function()
SampleGraphPresenter.prototype.toggleExpand = function(svgNode, d) {
// toggle visiblity
d.userEdgesVisible = (null == d.userEdgesVisible) ? !d.edgesVisible :!d.userEdgesVisible;
this.selectedNode = svgNode.parentNode;
this.draw();
}
......@@ -736,6 +738,17 @@ DagreGraphRenderer.prototype.draw = function()
// Resize the visualization
viz.attr("width", vizWidth + 20); // add space for the ring at the end
viz.attr("height", vizHeight + LINE_HEIGHT); // add a space to make it look less cramped
// If the user clicked on a node, scroll to make it visible
if (presenter.selectedNode) {
var root = $("#root");
var left = $(presenter.selectedNode).position().left + root.scrollLeft() - 50;
root.scrollLeft(left);
// WebKit only
// presenter.selectedNode.scrollIntoViewIfNeeded(true);
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment