@@ -115,6 +115,8 @@ function renderJobGraphOnApplicationLevel(jobs) {
115115 default :
116116 moveFocusByArrows ( d3 . event . code , g , d , upDownFocusStack ) ;
117117 }
118+
119+ zoomGraph ( inner ) ;
118120 } )
119121 . on ( 'click' , function ( d ) {
120122 if ( d == '0' ) {
@@ -334,8 +336,8 @@ function renderJobGraph(job) {
334336 } )
335337 . on ( 'keydown' , function ( d ) {
336338 var upDownFocusStack = jobGraphUpDownFocusStacks . jobView ;
337-
338339 moveFocusByArrows ( d3 . event . code , g , d , upDownFocusStack ) ;
340+ zoomGraph ( inner ) ;
339341 } )
340342 . each ( function ( v ) {
341343 $ ( this ) . tipsy ( {
@@ -383,4 +385,23 @@ function calculateVirtualBox(graph) {
383385 Math . abs ( ( graph . width + document . jobGraphView . tipsWidth - document . jobGraphView . width ) / 2 ) )
384386
385387 return minX + " -10 " + document . jobGraphView . width + " " + document . jobGraphView . height ;
388+ }
389+
390+ function zoomGraph ( node ) {
391+ var currentx = d3 . transform ( node . attr ( "transform" ) ) . translate [ 0 ] ;
392+ var currenty = d3 . transform ( node . attr ( "transform" ) ) . translate [ 1 ] ;
393+ var currentk = d3 . transform ( node . attr ( "transform" ) ) . scale [ 0 ] ;
394+ if ( d3 . event . ctrlKey && ( d3 . event . keyCode == 187 || d3 . event . keyCode == 107 ) ) {
395+ currentk = currentk + 0.05 ;
396+ currentx = currentx + 1 ;
397+ currenty = currenty + 1 ;
398+ node . attr ( "transform" , `translate(${ currentx } ,${ currenty } ),scale(${ currentk } )` ) ;
399+ }
400+ else if ( d3 . event . ctrlKey && ( d3 . event . keyCode == 189 || d3 . event . keyCode == 109 ) ) {
401+ if ( currentk > 0 )
402+ currentk = currentk - 0.05 ;
403+ currentx = currentx - 1 ;
404+ currenty = currenty - 1 ;
405+ node . attr ( "transform" , `translate(${ currentx } ,${ currenty } ),scale(${ currentk } )` ) ;
406+ }
386407}
0 commit comments