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
This commit is contained in:
Georges Basile Stavracas Neto 2019-08-08 17:21:12 -03:00
parent 488d98289c
commit f76f30fd6a
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -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