Skip to content

Commit c8e432f

Browse files
author
Mark Robinson
committed
Link the panning and zooming of fullscreen to regular graph
1 parent 7a840ef commit c8e432f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main/resources/static/js/workflow.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,35 @@ require(['jquery', 'bootstrap.modal', 'svg-pan-zoom', 'hammerjs'],
117117

118118
// Enable svg-pan-zoom on fullscreen modal when opened
119119
$('#fullScreenGraphModal').on('shown.bs.modal', function (e) {
120+
// Timeout allows for modal to show
120121
setTimeout(function() {
121122
var fullGraph = svgPanZoom('#graphFullscreen', {
122123
zoomEnabled: true,
123124
controlIconsEnabled: true,
124125
customEventsHandler: eventHandler
125126
});
126127

128+
// Set to same zoom/pan as other graph
129+
fullGraph.zoom(graph.getZoom());
130+
fullGraph.pan(graph.getPan());
131+
132+
// Link the two graphs panning and zooming
133+
fullGraph.setOnZoom(function(level){
134+
graph.zoom(level);
135+
graph.pan(fullGraph.getPan());
136+
});
137+
138+
fullGraph.setOnPan(function(point){
139+
graph.pan(point);
140+
});
141+
127142
// Resizing window also resizes the graph
128143
$(window).resize(function(){
129144
fullGraph.resize();
130145
fullGraph.fit();
131146
fullGraph.center();
132147
});
133-
}, 400);
148+
}, 100);
134149
});
135150
});
136151

0 commit comments

Comments
 (0)