dnd: Avoid division by zero, etc for zero-size actors

When rescaling due to a possible parent actor resize avoid problems
if the parent width is zero.

https://bugzilla.gnome.org/show_bug.cgi?id=643786
This commit is contained in:
Alexander Larsson 2011-03-04 14:21:17 +01:00
parent 7eaca86bf1
commit 72120bb87f

View File

@ -480,7 +480,9 @@ _Draggable.prototype = {
let [parentX, parentY] = this._dragOrigParent.get_transformed_position();
let [parentWidth, parentHeight] = this._dragOrigParent.get_size();
let [parentScaledWidth, parentScaledHeight] = this._dragOrigParent.get_transformed_size();
let parentScale = parentScaledWidth / parentWidth;
let parentScale = 1.0;
if (parentWidth != 0)
parentScale = parentScaledWidth / parentWidth;
x = parentX + parentScale * this._dragOrigX;
y = parentY + parentScale * this._dragOrigY;