summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrenda-br2023-02-16 18:01:26 +0530
committerbrenda-br2023-02-16 18:01:26 +0530
commitc21e2857f6c0de9ab94c4b768fbde0de817aede4 (patch)
treee3e6fbfc3b77731ba91312b9f86e5ade8d7f4769
parent2e4bef6ce1f52286467369e3b2ef642c5d9bd01d (diff)
downloadChemical-Simulator-GUI-c21e2857f6c0de9ab94c4b768fbde0de817aede4.tar.gz
Chemical-Simulator-GUI-c21e2857f6c0de9ab94c4b768fbde0de817aede4.tar.bz2
Chemical-Simulator-GUI-c21e2857f6c0de9ab94c4b768fbde0de817aede4.zip
Fix #57 Repositioning unit operations
-rw-r--r--Graphics.py10
-rw-r--r--Undo.datbin2508 -> 61657 bytes
2 files changed, 7 insertions, 3 deletions
diff --git a/Graphics.py b/Graphics.py
index 594db08..1d9e7ef 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -682,9 +682,13 @@ class NodeItem(QtWidgets.QGraphicsItem):
newPos = value
if change == self.ItemPositionChange and self.scene():
rect = self.container.graphicsView.sceneRect()
- if not rect.__contains__(newPos):
- newPos.setX(min(rect.right()-100, max(newPos.x(), rect.left())))
- newPos.setY(min(rect.bottom()-35, max(newPos.y(), rect.top())))
+ width = self.boundingRect().width()
+ height = self.boundingRect().height()
+ eWH1 = QPointF(newPos.x()+width,newPos.y()+height)
+ eWH2 = QPointF(newPos.x()-width,newPos.y()-height)
+ if not rect.__contains__(eWH1) or not rect.__contains__(eWH2) :
+ newPos.setX(min(rect.right()-width-40, max(newPos.x(), rect.left())))
+ newPos.setY(min(rect.bottom()-height-35, max(newPos.y(), rect.top())))
self.obj.set_pos(newPos)
return super(NodeItem,self).itemChange(change, newPos)
diff --git a/Undo.dat b/Undo.dat
index 6870dcc..7cf571d 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ