Commit b61ce0d4 authored by dmMaze's avatar dmMaze
Browse files

fix textitem rotation

parent ab2533b1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ class ControlBlockItem(QGraphicsRectItem):
        elif self.drag_mode == self.DRAG_ROTATE:   # rotating
            rotate_vec = event.scenePos() - self.ctrl.sceneBoundingRect().center()
            rotation = np.rad2deg(math.atan2(rotate_vec.y(), rotate_vec.x()))
            self.ctrl.setAngle((rotation+self.rotate_start) % 360)
            self.ctrl.setAngle((rotation+self.rotate_start))
            # angle = self.ctrl.rotation()
            angle = self.ctrl.rotation() + 45 * self.idx
            idx = self.get_angle_idx(angle)
@@ -273,7 +273,7 @@ class TextBlkShapeControl(QGraphicsRectItem):
            self.blk_item.endEdit()

    def paint(self, painter: QPainter, option: 'QStyleOptionGraphicsItem', widget = ...) -> None:
        painter.setCompositionMode(QPainter.RasterOp_NotDestination)
        painter.setCompositionMode(QPainter.CompositionMode.RasterOp_NotDestination)
        super().paint(painter, option, widget)

    def hideControls(self):
+2 −1
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ class TextBlkItem(QGraphicsTextItem):
        if isinstance(rect, List):
            rect = QRectF(*rect)
        self.setPos(rect.topLeft())
        self.prepareGeometryChange()
        self._display_rect = rect
        self.layout.setMaxSize(rect.width(), rect.height())
        self.document().setPageSize(QSizeF(rect.width(), rect.height()))
@@ -327,7 +328,7 @@ class TextBlkItem(QGraphicsTextItem):
        # self.setGraphicsEffect(se)

        if self.background_pixmap is not None:
            painter.setRenderHint(QPainter.SmoothPixmapTransform)
            painter.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform)
            painter.drawPixmap(br.toRect(), self.background_pixmap)

        draw_rect = self.draw_rect and not self.under_ctrl