summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlaine2020-06-19 03:03:41 +0530
committerBlaine2020-06-19 03:03:41 +0530
commit025cd829d956f5081e034f60b69413ec4432e0e8 (patch)
tree89f69effec4edffe0992e0270c957bc4bb0f9022 /src
parentc7f8e571cb9d7be21eb5b2a7c3c0e4704ffdce9c (diff)
downloadChemical-PFD-025cd829d956f5081e034f60b69413ec4432e0e8.tar.gz
Chemical-PFD-025cd829d956f5081e034f60b69413ec4432e0e8.tar.bz2
Chemical-PFD-025cd829d956f5081e034f60b69413ec4432e0e8.zip
rework flip feature
Diffstat (limited to 'src')
-rw-r--r--src/main/python/shapes/shapes.py40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 01ec196..aae8f47 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -466,44 +466,26 @@ class NodeItem(QGraphicsSvgItem):
def flipV(self):
return self.flipState[1]
- @flipH.setter
- def flipH(self, state):
+ def flip(self):
transform = QTransform()
- if self.flipV and state:
- self.flipState = [False, False]
- self.rotation = self.rotation % 4
- transform.scale(1, 1)
- else:
- self.flipState[0] = state
- if state:
- transform.scale(-1, 1)
- else:
- transform.scale(1, 1)
+ h = -1 if self.flipH else 1
+ w = -1 if self.flipV else 1
+ transform.scale(h, w)
self.setTransform(transform)
for i in self.lineGripItems:
i.updatePosition()
for j in i.lines:
j.createPath()
+
+ @flipH.setter
+ def flipH(self, state):
+ self.flipState[0] = state
+ self.flip()
@flipV.setter
def flipV(self, state):
- transform = QTransform()
- if self.flipH and state:
- self.flipState = [False, False]
- self.rotation = self.rotation % 4
- transform.scale(1, 1)
- else:
- self.flipState[1] = state
- transform = QTransform()
- if state:
- transform.scale(1, -1)
- else:
- transform.scale(1, 1)
- self.setTransform(transform)
- for i in self.lineGripItems:
- i.updatePosition()
- for j in i.lines:
- j.createPath()
+ self.flipState[1] = state
+ self.flip()
@property
def rotation(self):