From 31f20cb4b137c31e35db98d968630c638ab5c4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 12 Jan 2013 02:59:22 +0100 Subject: [PATCH] push zoomregion on contact BUG: 312956 --- effects/zoom/zoom.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index c2b507da87..cbfa5f4c47 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -283,30 +283,28 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) data.setXTranslation(qMin(0, qMax(int(displayWidth() - displayWidth() * zoom), int(displayWidth() / 2 - prevPoint.x() * zoom)))); data.setYTranslation(qMin(0, qMax(int(displayHeight() - displayHeight() * zoom), int(displayHeight() / 2 - prevPoint.y() * zoom)))); break; - case MouseTrackingPush: - if (timeline.state() != QTimeLine::Running) { + case MouseTrackingPush: { // touching an edge of the screen moves the zoom-area in that direction. int x = cursorPoint.x() * zoom - prevPoint.x() * (zoom - 1.0); int y = cursorPoint.y() * zoom - prevPoint.y() * (zoom - 1.0); - int threshold = 1; //qMax(1, int(10.0 / zoom)); + int threshold = 4; xMove = yMove = 0; if (x < threshold) - xMove = - qMax(1.0, displayWidth() / zoom / moveFactor); + xMove = (x - threshold) / zoom; else if (x + threshold > displayWidth()) - xMove = qMax(1.0, displayWidth() / zoom / moveFactor); + xMove = (x + threshold - displayWidth()) / zoom; if (y < threshold) - yMove = - qMax(1.0, displayHeight() / zoom / moveFactor); + yMove = (y - threshold) / zoom; else if (y + threshold > displayHeight()) - yMove = qMax(1.0, displayHeight() / zoom / moveFactor); - if (xMove != 0 || yMove != 0) { + yMove = (y + threshold - displayHeight()) / zoom; + if (xMove) prevPoint.setX(qMax(0, qMin(displayWidth(), prevPoint.x() + xMove))); + if (yMove) prevPoint.setY(qMax(0, qMin(displayHeight(), prevPoint.y() + yMove))); - timeline.start(); - } + data.setXTranslation(- int(prevPoint.x() * (zoom - 1.0))); + data.setYTranslation(- int(prevPoint.y() * (zoom - 1.0))); + break; } - data.setXTranslation(- int(prevPoint.x() * (zoom - 1.0))); - data.setYTranslation(- int(prevPoint.y() * (zoom - 1.0))); - break; } // use the focusPoint if focus tracking is enabled