dnd: Fix bug in computation of snap-back position

We were properly accounting for the fact that an ancestor of the
parent could be scaled rather than the parent itself when computing
the snap-back scale, but directly using parent.scale_x for the
snap-back location.

https://bugzilla.gnome.org/show_bug.cgi?id=642117
This commit is contained in:
Owen W. Taylor 2011-02-11 12:19:12 -05:00
parent 914e5d30c7
commit 75f771d736

View File

@ -461,12 +461,12 @@ _Draggable.prototype = {
// its parent, adjusting for the fact that the parent
// may have been moved or scaled
let [parentX, parentY] = this._dragOrigParent.get_transformed_position();
x = parentX + this._dragOrigParent.scale_x * this._dragOrigX;
y = parentY + this._dragOrigParent.scale_y * this._dragOrigY;
let [parentWidth, parentHeight] = this._dragOrigParent.get_size();
let [parentScaledWidth, parentScaledHeight] = this._dragOrigParent.get_transformed_size();
let parentScale = parentScaledWidth / parentWidth;
x = parentX + parentScale * this._dragOrigX;
y = parentY + parentScale * this._dragOrigY;
scale = this._dragOrigScale * parentScale;
} else {
// Snap back actor to its original stage position