프로젝트

일반

사용자정보

개정판 3e699dbd

ID3e699dbdbb9a0c68a013d8a51be6cd9f1e81f8b0
상위 64366707
하위 ef71cb7f, 1eb20885

백흠경이(가) 5년 이상 전에 추가함

issue #538: fixed that can't stop symbol rotating by right mouse click

Change-Id: I7769fe109b3fa6cf3409571f5083af421cf73c99

차이점 보기:

DTI_PID/DTI_PID/ProjectDialog.py
122 122
    def changeProject(self):
123 123
        index = self.ui.comboBox.currentIndex()
124 124
        project = self.ui.comboBox.itemData(index)
125
        if project is not None:        
125
        if project:        
126 126
            self.ui.lineEditProjectDesc.setText(project.desc)
127 127
            self.ui.comboBoxProjectUnit.setCurrentText(project.prj_unit)
128 128

  
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
875 875
    '''
876 876

  
877 877
    def mouseReleaseEvent(self, event):
878
        if hasattr(self, '_rotating') and event.button() == Qt.RightButton and hasattr(self, '__angle'):
879
            self.angle = -self.__angle if self.__angle > -math.pi and self.__angle < 0 else 2 * math.pi - self.__angle
878
        if hasattr(self, '_rotating') and event.button() == Qt.RightButton:
879
            self.angle = -self._rotating if -math.pi < self._rotating < 0 else 2 * math.pi - self._rotating
880 880
            self.ungrabMouse()
881 881
            del self._rotating
882 882

  
883 883
        super().mouseReleaseEvent(event)
884 884

  
885 885
    def mouseMoveEvent(self, event):
886
        """ rotate symbol accroding to current mouse point """
886
        """ rotate symbol according to current mouse point """
887 887
        if hasattr(self, '_rotating'):
888 888
            # get origin point of symbol
889 889
            origin = self.origin  # self.sceneBoundingRect().center()
......
893 893
            dy = (event.scenePos().y() - origin[1])
894 894
            length = math.sqrt(dx * dx + dy * dy)
895 895

  
896
            self.__angle = 0
896
            self._rotating = 0
897 897
            if length > 0:
898
                self.__angle = math.acos(dx / length)
898
                self._rotating = math.acos(dx / length)
899 899
                cross = np.cross([1, 0], [dx, dy])
900
                self.__angle = -self.__angle if cross < 0 else self.__angle
900
                self._rotating = -self._rotating if cross < 0 else self._rotating
901 901

  
902
                self.rotate(self.getCurrentPoint(), -self.__angle)
902
                self.rotate(self.getCurrentPoint(), -self._rotating)
903 903

  
904 904
    def removeSelfAttr(self, attributeName):
905 905
        target = None
......
1072 1072

  
1073 1073
    def mouseDoubleClickEvent(self, event):
1074 1074
        if not hasattr(self, '_rotating'):
1075
            self._rotating = True
1075
            self._rotating = 0
1076 1076
            self.grabMouse()
1077 1077

  
1078 1078
    '''

내보내기 Unified diff

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