프로젝트

일반

사용자정보

개정판 ffd6e50e

IDffd6e50e781bb60d2aa67788b11b181e3b84742f
상위 9c878e3e
하위 08da2494

함의성이(가) 5년 이상 전에 추가함

issue #000: fix symbol move with flip and mouse event

Change-Id: I19460fe386feb6b5d41129c6c642bf6604445702

차이점 보기:

DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
451 451
            self.dbUid = symbolInfo.uid
452 452
            originalPoint = symbolInfo.getOriginalPoint().split(',')
453 453
            self.symbolOrigin = [float(originalPoint[0]), float(originalPoint[1])]
454
            if self.flip is 1:
455
                self.symbolOrigin[0] = self.size[0] - self.symbolOrigin[0]
454
            #if self.flip is 1:
455
            #    self.symbolOrigin[0] = self.size[0] - self.symbolOrigin[0]
456 456

  
457 457
            # setting connectors
458 458
            connectionPoints = symbolInfo.getConnectionPoint().split('/')
......
731 731
    '''
732 732
    def mouseReleaseEvent(self, event):
733 733
        if hasattr(self, '_rotating') and event.button() == Qt.RightButton:
734
            self.angle = -self.__angle
734
            self.angle = -self.__angle if self.__angle > -math.pi and self.__angle < 0 else 2 * math.pi - self.__angle
735 735
            self.ungrabMouse()
736 736
            del self._rotating
737 737

  
......
741 741
        """ rotate symbol accroding to current mouse point """
742 742
        if hasattr(self, '_rotating'):
743 743
            # get origin point of symbol
744
            origin = self.sceneBoundingRect().center()
744
            origin = self.origin#self.sceneBoundingRect().center()
745 745
            # up to here
746 746

  
747
            dx = (event.scenePos().x() - origin.x())
748
            dy = (event.scenePos().y() - origin.y())
747
            dx = (event.scenePos().x() - origin[0])
748
            dy = (event.scenePos().y() - origin[1])
749 749
            length = math.sqrt(dx*dx + dy*dy)
750 750

  
751 751
            self.__angle = 0
752 752
            if length > 0:
753 753
                self.__angle = math.acos(dx / length)
754 754
                cross = np.cross([1, 0], [dx, dy])
755
                self.__angle = -self.__angle if cross < 0 else self.__angle 
755
                self.__angle = -self.__angle if cross < 0 else self.__angle
756 756

  
757
                self.rotate(self.symbolOrigin, -self.__angle)
757
                self.rotate(self.getCurrentPoint(), -self.__angle)
758
                #print(self.__angle)
758 759

  
759 760
    def removeSelfAttr(self, attributeName):
760 761
        target = None
......
922 923
    def mouseDoubleClickEvent(self, event):
923 924
        if not hasattr(self, '_rotating'):
924 925
            self._rotating = True
925
            self._rotation = self.rotation()
926
            #self._rotation = self.rotation()
926 927
            self.grabMouse()
927 928

  
928 929
    '''

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)