[gnome-shell/wip/grab-helper-top-panel: 5/20] workspace: Add smooth scrolling support to zoom windows



commit c6bc1526fa080534cf587578e5a2866daed281c8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Nov 4 10:55:37 2012 -0500

    workspace: Add smooth scrolling support to zoom windows
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687573

 js/ui/workspace.js |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index ef7c9d6..540c19e 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -265,23 +265,37 @@ const WindowClone = new Lang.Class({
 
     _onScroll : function (actor, event) {
         let direction = event.get_scroll_direction();
-        if (direction == Clutter.ScrollDirection.UP) {
+        let delta;
+
+        if (event.is_pointer_emulated())
+            return;
+
+        if (direction == Clutter.ScrollDirection.DOWN) {
+            delta = -SCROLL_SCALE_AMOUNT;
+        } else if (direction == Clutter.ScrollDirection.UP) {
+            delta = +SCROLL_SCALE_AMOUNT;
+        } else if (direction == Clutter.ScrollDirection.SMOOTH) {
+            let [dx, dy] = event.get_scroll_delta();
+            delta = -dy * 10;
+        }
+
+        if (delta > 0) {
             if (this._zoomStep == undefined)
                 this._zoomStart();
             if (this._zoomStep < 100) {
-                this._zoomStep += SCROLL_SCALE_AMOUNT;
+                this._zoomStep += delta;
+                this._zoomStep = Math.min(100, this._zoomStep);
                 this._zoomUpdate();
             }
-        } else if (direction == Clutter.ScrollDirection.DOWN) {
+        } else if (delta < 0) {
             if (this._zoomStep > 0) {
-                this._zoomStep -= SCROLL_SCALE_AMOUNT;
+                this._zoomStep += delta;
                 this._zoomStep = Math.max(0, this._zoomStep);
                 this._zoomUpdate();
             }
             if (this._zoomStep <= 0.0)
                 this._zoomEnd();
         }
-
     },
 
     _zoomUpdate : function () {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]