개정판 68867375
issue #000: zoom comm mouse button response fix
DTI_PID/DTI_PID/Commands/AreaZoomCommand.py | ||
---|---|---|
26 | 26 | |
27 | 27 |
self._rubberBand = QRubberBand(QRubberBand.Rectangle, self.imageViewer) |
28 | 28 |
self._origin = QPoint() |
29 |
self.isLeftClicked = False |
|
29 | 30 |
|
30 | 31 |
''' |
31 | 32 |
@brief pan image by left click and drag |
... | ... | |
38 | 39 |
|
39 | 40 |
self.isTreated = False |
40 | 41 |
if 'mousePressEvent' == param[0]: |
41 |
if self.imageViewer.canZoom: |
|
42 |
if event.button() == Qt.LeftButton: |
|
42 |
if event.button() == Qt.LeftButton: |
|
43 |
self.isLeftClicked = True |
|
44 |
if self.imageViewer.canZoom: |
|
43 | 45 |
self._origin = event.pos() |
44 | 46 |
self._rubberBand.setGeometry(QRect(self._origin, QSize())) |
45 | 47 |
self._rubberBand.show() |
... | ... | |
50 | 52 |
self._rubberBand.setGeometry(QRect(self._origin, event.pos()).normalized()) |
51 | 53 |
elif 'mouseReleaseEvent' == param[0]: |
52 | 54 |
try: |
55 |
if event.button() == Qt.LeftButton: |
|
56 |
self.isLeftClicked = False |
|
53 | 57 |
if self.imageViewer.canZoom and event.button() == Qt.LeftButton: |
54 | 58 |
self._rubberBand.hide() |
55 | 59 |
topLeft = self.imageViewer.mapToScene(self._rubberBand.geometry().topLeft()) |
... | ... | |
57 | 61 |
self.imageViewer.zoomStack.append(QRectF(topLeft.x(), topLeft.y(), bottomRight.x() - topLeft.x(), bottomRight.y() - topLeft.y())) |
58 | 62 |
self.imageViewer.updateViewer() |
59 | 63 |
elif event.button() == Qt.RightButton: |
60 |
self.onRejected.emit(self) |
|
64 |
if self.isLeftClicked == False: |
|
65 |
self.onRejected.emit(self) |
|
61 | 66 |
finally: |
62 | 67 |
pass |
63 | 68 |
내보내기 Unified diff