aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2013-01-12 01:59:22 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2013-01-23 20:27:46 (GMT)
commit57083f1803308a5e1bafa65fc5095e50d0d39630 (patch)
tree64a7a66973344bde6df8fd3594b229fe2287a59f
parent04e41989b31032f2b73e634dce0ea96840116148 (diff)
push zoomregion on contact
BUG: 312956
-rw-r--r--kwin/effects/zoom/zoom.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/kwin/effects/zoom/zoom.cpp b/kwin/effects/zoom/zoom.cpp
index c2b507d..cbfa5f4 100644
--- a/kwin/effects/zoom/zoom.cpp
+++ b/kwin/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