Revize 3cff5ae5
Přidáno uživatelem Pavel Fidranský před asi 6 roky(ů)
sources/src/main/webapp/js/components/viewport.js | ||
---|---|---|
117 | 117 |
var sumOfCenters = new Coordinates(0, 0); |
118 | 118 |
var bbox = rootElement.getBoundingClientRect(); |
119 | 119 |
|
120 |
var vertexList = app.viewportComponent.getVertexList();
|
|
121 |
vertexList.forEach(function(vertex) {
|
|
122 |
var center = vertex.getCenter();
|
|
120 |
var nodeList = app.viewportComponent.getNodeList();
|
|
121 |
nodeList.forEach(function(node) {
|
|
122 |
var center = node.getCenter();
|
|
123 | 123 |
|
124 | 124 |
sumOfCenters.x += center.x; |
125 | 125 |
sumOfCenters.y += center.y; |
126 | 126 |
}); |
127 | 127 |
|
128 |
innerSvgElement.setAttribute('x', -1 * sumOfCenters.x / vertexList.length + bbox.width / 2); |
|
129 |
innerSvgElement.setAttribute('y', -1 * sumOfCenters.y / vertexList.length + bbox.height / 2); |
|
128 |
var center = new Coordinates(-1 * sumOfCenters.x / nodeList.length + bbox.width / 2, -1 * sumOfCenters.y / nodeList.length + bbox.height / 2); |
|
129 |
|
|
130 |
innerSvgElement.setAttribute('x', center.x); |
|
131 |
innerSvgElement.setAttribute('y', center.y); |
|
132 |
|
|
133 |
app.sidebarComponent.minimapComponent.setViewportPosition(center); |
|
130 | 134 |
}; |
131 | 135 |
|
132 | 136 |
this.render = function() { |
Také k dispozici: Unified diff
fixed Viewport to move Minimap viewport when centered