[TASK] Add zoom modifier for forcegraph

This commit is contained in:
Xaver Maierhofer 2017-12-30 20:01:00 +01:00 committed by Geno
parent 5702b5f21b
commit 201c74d29b
2 changed files with 5 additions and 4 deletions

View File

@ -155,7 +155,8 @@ module.exports = function () {
'highlightColor': 'rgba(255, 255, 255, 0.2)', 'highlightColor': 'rgba(255, 255, 255, 0.2)',
'labelColor': '#fff', 'labelColor': '#fff',
'tqFrom': '#770038', 'tqFrom': '#770038',
'tqTo': '#dc0067' 'tqTo': '#dc0067',
'zoomModifier': 1
}, },
'locate': { 'locate': {
'outerCircle': { 'outerCircle': {

View File

@ -236,7 +236,7 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
self.resetView = function resetView() { self.resetView = function resetView() {
moveTo(function calcToReset() { moveTo(function calcToReset() {
draw.setHighlight(null); draw.setHighlight(null);
return [0, 0, (ZOOM_MIN + 1) / 2]; return [0, 0, (ZOOM_MIN + config.forceGraph.zoomModifier) / 2];
}, true); }, true);
}; };
@ -247,7 +247,7 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
if (n) { if (n) {
return [n.x, n.y, (ZOOM_MAX + 1) / 2]; return [n.x, n.y, (ZOOM_MAX + 1) / 2];
} }
return [0, 0, (ZOOM_MIN + 1) / 2]; return resetView();
}); });
}; };
@ -260,7 +260,7 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
if (l) { if (l) {
return [(l.source.x + l.target.x) / 2, (l.source.y + l.target.y) / 2, (ZOOM_MAX / 2) + ZOOM_MIN]; return [(l.source.x + l.target.x) / 2, (l.source.y + l.target.y) / 2, (ZOOM_MAX / 2) + ZOOM_MIN];
} }
return [0, 0, (ZOOM_MIN + 1) / 2]; return resetView();
}); });
}; };