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:
parent
d86a4dc43b
commit
703187e996
@ -531,7 +531,7 @@ var _Draggable = new Lang.Class({
|
|||||||
// Snap the clone back to its source
|
// Snap the clone back to its source
|
||||||
[x, y] = this._dragActorSource.get_transformed_position();
|
[x, y] = this._dragActorSource.get_transformed_position();
|
||||||
let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size();
|
let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size();
|
||||||
scale = this._dragActor.width / sourceScaledWidth;
|
scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
|
||||||
} else if (this._dragOrigParent) {
|
} else if (this._dragOrigParent) {
|
||||||
// Snap the actor back to its original position within
|
// Snap the actor back to its original position within
|
||||||
// its parent, adjusting for the fact that the parent
|
// its parent, adjusting for the fact that the parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user