Skip to content

Commit e53680f

Browse files
authored
Merge pull request #6255 from yanjungao718/yanjun-zoom-jobgraph
fix a11y issue 1870841, add zoom function on job graph keyboard
2 parents d07a5f8 + 4b2b849 commit e53680f

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed
Binary file not shown.

Utils/hdinsight-node-common/resources/htmlResources/hdinsight/job/html/job_graph.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)