add update_height parameter to Nodegrid.place_node

This commit is contained in:
Jack Andersen 2020-04-09 13:40:19 -10:00
parent 81c5750c44
commit 2c98306dff
1 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,7 @@ class Nodegrid:
frame_node.color = FRAME_COLORS[i]
self.frames.append(frame_node)
def place_node(self, node, col):
def place_node(self, node, col, update_height = True):
if col < 0 or col >= self.ncol:
return False
@ -37,6 +37,7 @@ class Nodegrid:
x_pos += FRAME_WIDTHS[i] + NODE_PADDING*2
node.location[0] = x_pos - TOTAL_WIDTH/2
node.location[1] = self.heights[col]
if update_height:
self.heights[col] -= node.height + NODE_PADDING
self.frames[col].height += node.height + NODE_PADDING
node.parent = self.frames[col]