Skip to content

Instantly share code, notes, and snippets.

@comet0
Created June 20, 2016 08:16
Show Gist options
  • Save comet0/d87cf12c28b0d14cc997b6a83ce5e90b to your computer and use it in GitHub Desktop.
Save comet0/d87cf12c28b0d14cc997b6a83ce5e90b to your computer and use it in GitHub Desktop.
diff --git a/gns3/items/node_item.py b/gns3/items/node_item.py
index c6c7be3..2fa0aef 100644
--- a/gns3/items/node_item.py
+++ b/gns3/items/node_item.py
@@ -377,6 +377,10 @@ class NodeItem():
:param value: value of the change
"""
+ if change == 9: # Unsure but seems to alternate between 0/9 while dragging
+ GRID_SIZE = 75
+ self.setPos(float(GRID_SIZE * round(self.x() / GRID_SIZE)), float(GRID_SIZE * round(self.y() / GRID_SIZE)))
+
# dynamically change the renderer when this node item is selected/unselected.
if change == QtWidgets.QGraphicsItem.ItemSelectedChange:
if value:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment