Skip to content

Commit

Permalink
do not create move op for zero move
Browse files Browse the repository at this point in the history
  • Loading branch information
pedohorse committed Oct 26, 2024
1 parent 8671286 commit d4a79f3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lifeblood_viewer/graphics_scene_with_data_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,14 @@ def move_nodes(self, nodes_datas: Sequence[Tuple[Node, QPointF]]):
on top of actual moving -
scene needs to create an undo entry for that
"""
op = MoveNodesOp(self,
((node, new_pos, node.pos()) for node, new_pos in nodes_datas)
)
eps = 1e-4
op_data = [(node, new_pos, node.pos()) for node, new_pos in nodes_datas if (new_pos - node.pos()).manhattanLength() >= eps]
if len(op_data) == 0:
return
op = MoveNodesOp(
self,
op_data
)
op.do()

def node_position(self, node_id: int):
Expand Down

0 comments on commit d4a79f3

Please sign in to comment.