개정판 f48bbe03
issue #505: roll back temp
Change-Id: I4fe9fdb5b3632884953cbf97571da088ba6c7ff4
DTI_PID/DTI_PID/QtImageViewer.py | ||
---|---|---|
291 | 291 |
scenePos1 = self.mapToScene(clickPos.x() - HALF_SIZE // adjust, clickPos.y() - HALF_SIZE // adjust) |
292 | 292 |
scenePos2 = self.mapToScene(clickPos.x() + HALF_SIZE // adjust, clickPos.y() + HALF_SIZE // adjust) |
293 | 293 |
if isZoomIn: |
294 |
zoomArea = QRectF(scenePos1, scenePos2) |
|
294 |
zoomArea = QRectF( |
|
295 |
QPointF(scenePos1.x() if scenePos1.x() > 0 else 0, scenePos1.y() if scenePos1.y() > 0 else 0), |
|
296 |
QPointF(scenePos2.x(), scenePos2.y())) |
|
297 |
# self.fitInView(zoomArea, Qt.KeepAspectRatioByExpanding) |
|
295 | 298 |
viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect() |
296 | 299 |
selectionBBox = zoomArea.intersected(viewBBox) |
297 | 300 |
self.scene.setSelectionArea(QPainterPath()) # Clear current selection area. |
298 |
if selectionBBox.isValid() and (selectionBBox != viewBBox): |
|
299 |
self.zoomStack.append(selectionBBox) |
|
300 |
self.updateViewer() |
|
301 |
if selectionBBox.width() > HALF_SIZE * 2 and selectionBBox.height() > HALF_SIZE * 2: |
|
302 |
if selectionBBox.isValid() and (selectionBBox != viewBBox): |
|
303 |
self.zoomStack.append(selectionBBox) |
|
304 |
self.updateViewer() |
|
301 | 305 |
else: |
302 | 306 |
zoomNewRect = None |
303 | 307 |
self.scene.setSelectionArea(QPainterPath()) # Clear current selection area. |
304 |
if self.zoomStack: |
|
305 |
zoomNewRect = self.zoomStack.pop() |
|
308 |
if len(self.zoomStack): |
|
309 |
self.zoomStack.pop() |
|
310 |
if len(self.zoomStack): |
|
311 |
newScenePos = self.mapToScene(clickPos.x(), clickPos.y()) |
|
312 |
newPosX1 = newScenePos.x() - self.zoomStack[-1].width() / 2 |
|
313 |
newPosY1 = newScenePos.y() - self.zoomStack[-1].height() / 2 |
|
314 |
zoomNewPos1 = QPointF(newPosX1 if newPosX1 > 0 else 0, newPosY1 if newPosY1 > 0 else 0) |
|
315 |
newPosX2 = newScenePos.x() + self.zoomStack[-1].width() / 2 |
|
316 |
newPosY2 = newScenePos.y() + self.zoomStack[-1].width() / 2 |
|
317 |
zoomNewPos2 = QPointF(newPosX2, newPosY2) |
|
318 |
zoomNewRect = QRectF(zoomNewPos1, zoomNewPos2) |
|
306 | 319 |
self.updateViewer(zoomNewRect) |
307 | 320 |
|
308 | 321 |
def resizeEvent(self, event): |
내보내기 Unified diff