Skip to content

Commit

Permalink
straight -135
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Nov 4, 2024
1 parent 654a55b commit 36c1b18
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/main/python/plotlyst/view/widget/scene/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self, beat: SceneBeat, globalAngle: int, parent=None):

if self._globalAngle >= -45:
self.setRotation(-self._globalAngle)
elif self._globalAngle == -135:
self.setRotation(-45)

def item(self) -> SceneBeat:
return self._beat
Expand Down Expand Up @@ -118,6 +120,11 @@ def adjustTo(self, previous: 'OutlineItemBase'):
elif self._globalAngle == -45:
transform = QTransform().rotate(-self._globalAngle)
diff = transform.map(diff)
elif self._globalAngle == -135:
diff.setX(self._width - diff.x())
diff.setY(self._timelineHeight)
transform = QTransform().rotate(-45)
diff = transform.map(diff)
elif self._globalAngle < 0:
diff.setX(self._width - diff.x())

Expand All @@ -132,6 +139,8 @@ def _calculateShape(self):
self._localCpPoint = QPointF(self._width, 0)
elif self._globalAngle == -45:
self._localCpPoint = QPointF(self._width, 0)
elif self._globalAngle == -135:
self._localCpPoint = QPointF(0, self._height)
else:
self._localCpPoint = QPointF(0, 0)

Expand All @@ -144,7 +153,7 @@ def _calculateShape(self):
QPointF(self._width - self.OFFSET, 0) # Top right point
]

if self._globalAngle == -180:
if self._globalAngle == -180 or self._globalAngle == -135:
shape = [QPointF(self._width - point.x(), point.y()) for point in base_shape]
else:
shape = base_shape
Expand Down Expand Up @@ -185,8 +194,10 @@ def _calculateShape(self):
arcWidth = 200
self._width = self._beat.width + arcWidth + self._timelineHeight

if self._globalAngle >= 0:
if self._globalAngle == 0:
self._localCpPoint = QPointF(0, self._height - self._timelineHeight)
elif self._globalAngle == 45:
self._localCpPoint = QPointF(0, self._height)
else:
self._localCpPoint = QPointF(self._width, self._height - self._timelineHeight)

Expand Down Expand Up @@ -533,9 +544,10 @@ def _drawBottom(self):
item = self.addNewItem(SceneBeat(text='2', width=135, color='blue'), item)
item = self.addNewItem(SceneBeat(text='Rising', angle=45, color='green'), item)
item = self.addNewItem(SceneBeat('3'), item)
item = self.addNewItem(SceneBeat(text='Falling', angle=-45, color='green'), item)
item = self.addNewItem(SceneBeat('4'), item)
item = self.addNewItem(SceneBeat('5'), item)
# item = self.addNewItem(SceneBeat(text='Falling', angle=-45, color='green'), item)
# item = self.addNewItem(SceneBeat(text='Falling', angle=-45, color='green'), item)
# item = self.addNewItem(SceneBeat('4'), item)
# item = self.addNewItem(SceneBeat('5'), item)
item = self.addNewItem(SceneBeat(text='Curved', width=100, angle=-180, color='green'), item)
item = self.addNewItem(SceneBeat('6', width=30), item)
item = self.addNewItem(SceneBeat(text='Curved 2', width=100, angle=-180, color='green'), item)
Expand Down

0 comments on commit 36c1b18

Please sign in to comment.