Merge pull request #167 from alicevision/fix_boundingBox

GraphLayout: fix bouding box computation
This commit is contained in:
Yann Lanthony 2018-08-06 11:18:47 +02:00 committed by GitHub
commit 9864093568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -154,7 +154,7 @@ class GraphLayout(QObject):
if nodes is None:
nodes = self.graph.nodes.values()
first = nodes[0]
bbox = [first.x, first.y, 1, 1]
bbox = [first.x, first.y, first.x + self._nodeWidth, first.y + self._nodeHeight]
for n in nodes:
bbox[0] = min(bbox[0], n.x)
bbox[1] = min(bbox[1], n.y)

View file

@ -415,7 +415,7 @@ Item {
function boundingBox()
{
var first = nodeRepeater.itemAt(0)
var bbox = Qt.rect(first.x, first.y, 1, 1)
var bbox = Qt.rect(first.x, first.y, first.x + first.width, first.y + first.height)
for(var i=0; i<root.graph.nodes.count; ++i) {
var item = nodeRepeater.itemAt(i)
bbox.x = Math.min(bbox.x, item.x)