[gnome-shell/gbsneto/icon-grid-part3: 12/12] dnd: Fix drag cancel animation scale



commit b9a526a597f0432e39f293f96b0cfad4b3778cd9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Aug 8 17:21:12 2019 -0300

    dnd: Fix drag cancel animation scale
    
    When a drag is cancelled and the source actor
    is visible, the drag actor is animated back to
    the source position. The scale that the drag
    actor will become is calculated as:
    
        scale = this._dragActor.width /sourceScaledWidth
    
    However, this is wrong; what we wanted to do
    is the opposite:
    
        scale = sourceScaledWidth / this._dragActor.width
    
    Fix the scale calculation to match the math
    above.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671

 js/ui/dnd.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 6539443cd8..786d654199 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -611,7 +611,7 @@ var _Draggable = class _Draggable {
             // Snap the clone back to its source
             [x, y] = this._dragActorSource.get_transformed_position();
             let [sourceScaledWidth] = this._dragActorSource.get_transformed_size();
-            scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
+            scale = sourceScaledWidth ? sourceScaledWidth / this._dragActor.width : 0;
         } else if (this._dragOrigParent) {
             // Snap the actor back to its original position within
             // its parent, adjusting for the fact that the parent


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