From 72120bb87fe34895cd52e3e17eb7f020ab6950a7 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 4 Mar 2011 14:21:17 +0100 Subject: [PATCH] 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 --- js/ui/dnd.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index a755057f1..87515563f 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -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;