dnd: Prevent dividing by zero when calculating the scale factor

This ensures that we snap back to the correct size when the
source actor has been scaled to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=787901
This commit is contained in:
Mario Sanchez Prada 2017-06-30 01:22:42 +00:00
parent d86a4dc43b
commit 703187e996

View File

@ -531,7 +531,7 @@ var _Draggable = new Lang.Class({
// Snap the clone back to its source
[x, y] = this._dragActorSource.get_transformed_position();
let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size();
scale = this._dragActor.width / sourceScaledWidth;
scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
} else if (this._dragOrigParent) {
// Snap the actor back to its original position within
// its parent, adjusting for the fact that the parent