summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
authorBlaine2020-06-19 11:40:28 +0530
committerBlaine2020-06-19 11:40:28 +0530
commit6a306ce01a9501f5580e81e9263cd34987ba7bc4 (patch)
tree0745304c9cd7a9d237fb21f32d306f1f156d99f5 /src/main/python/shapes
parent025cd829d956f5081e034f60b69413ec4432e0e8 (diff)
downloadChemical-PFD-6a306ce01a9501f5580e81e9263cd34987ba7bc4.tar.gz
Chemical-PFD-6a306ce01a9501f5580e81e9263cd34987ba7bc4.tar.bz2
Chemical-PFD-6a306ce01a9501f5580e81e9263cd34987ba7bc4.zip
unified transform
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/shapes.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index aae8f47..3efabbc 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -244,6 +244,8 @@ class LineGripItem(QGraphicsPathItem):
@property
def m_location(self):
+ if self.parentItem().__class__ == Line:
+ return directionsEnum[self._m_location]
index = (self._m_location + self.parentItem().rotation)
if index%2:
index = (index + 2*self.parentItem().flipH)%4
@@ -466,26 +468,27 @@ class NodeItem(QGraphicsSvgItem):
def flipV(self):
return self.flipState[1]
- def flip(self):
+ def updateTransformation(self):
transform = QTransform()
h = -1 if self.flipH else 1
w = -1 if self.flipV else 1
+ transform.rotate(90*self.rotation)
transform.scale(h, w)
self.setTransform(transform)
+ self.setTransform(transform)
for i in self.lineGripItems:
+ i.setTransform(transform)
i.updatePosition()
- for j in i.lines:
- j.createPath()
@flipH.setter
def flipH(self, state):
self.flipState[0] = state
- self.flip()
+ self.updateTransformation()
@flipV.setter
def flipV(self, state):
self.flipState[1] = state
- self.flip()
+ self.updateTransformation()
@property
def rotation(self):
@@ -494,14 +497,7 @@ class NodeItem(QGraphicsSvgItem):
@rotation.setter
def rotation(self, rotation):
self._rotation = rotation % 4
- transform = QTransform()
- transform.rotate(90*rotation)
- self.setTransform(transform)
- for i in self.lineGripItems:
- i.setTransform(transform)
- i.updatePosition()
- for j in i.lines:
- j.createPath()
+ self.updateTransformation()
def boundingRect(self):
"""Overrides QGraphicsSvgItem's boundingRect() virtual public function and