Start the workspace zoom out immediately on dnd cancel.

This means the snap-back animation happens at the same time as the zoom,
which looks much better.

https://bugzilla.gnome.org/show_bug.cgi?id=643786
This commit is contained in:
Alexander Larsson 2011-03-08 14:50:34 +01:00
parent 5743224817
commit df2f939f3a

View File

@ -553,6 +553,7 @@ WorkspacesDisplay.prototype = {
this.workspacesView = null; this.workspacesView = null;
this._inDrag = false; this._inDrag = false;
this._cancelledDrag = false;
this._zoomOut = false; this._zoomOut = false;
this._zoomFraction = 0; this._zoomFraction = 0;
@ -562,6 +563,7 @@ WorkspacesDisplay.prototype = {
this._itemDragBeginId = 0; this._itemDragBeginId = 0;
this._itemDragEndId = 0; this._itemDragEndId = 0;
this._windowDragBeginId = 0; this._windowDragBeginId = 0;
this._windowDragCancelledId = 0;
this._windowDragEndId = 0; this._windowDragEndId = 0;
}, },
@ -597,6 +599,9 @@ WorkspacesDisplay.prototype = {
if (this._windowDragBeginId == 0) if (this._windowDragBeginId == 0)
this._windowDragBeginId = Main.overview.connect('window-drag-begin', this._windowDragBeginId = Main.overview.connect('window-drag-begin',
Lang.bind(this, this._dragBegin)); Lang.bind(this, this._dragBegin));
if (this._windowDragCancelledId == 0)
this._windowDragCancelledId = Main.overview.connect('window-drag-cancelled',
Lang.bind(this, this._dragCancelled));
if (this._windowDragEndId == 0) if (this._windowDragEndId == 0)
this._windowDragEndId = Main.overview.connect('window-drag-end', this._windowDragEndId = Main.overview.connect('window-drag-end',
Lang.bind(this, this._dragEnd)); Lang.bind(this, this._dragEnd));
@ -631,6 +636,10 @@ WorkspacesDisplay.prototype = {
Main.overview.disconnect(this._windowDragBeginId); Main.overview.disconnect(this._windowDragBeginId);
this._windowDragBeginId = 0; this._windowDragBeginId = 0;
} }
if (this._windowDragCancelledId > 0) {
Main.overview.disconnect(this._windowDragCancelledId);
this._windowDragCancelledId = 0;
}
if (this._windowDragEndId > 0) { if (this._windowDragEndId > 0) {
Main.overview.disconnect(this._windowDragEndId); Main.overview.disconnect(this._windowDragEndId);
this._windowDragEndId = 0; this._windowDragEndId = 0;
@ -782,7 +791,7 @@ WorkspacesDisplay.prototype = {
if (Main.overview.animationInProgress) if (Main.overview.animationInProgress)
return; return;
let shouldZoom = this._controls.hover || this._inDrag; let shouldZoom = this._controls.hover || (this._inDrag && !this._cancelledDrag);
if (shouldZoom != this._zoomOut) { if (shouldZoom != this._zoomOut) {
this._zoomOut = shouldZoom; this._zoomOut = shouldZoom;
this._updateWorkspacesGeometry(); this._updateWorkspacesGeometry();
@ -805,6 +814,12 @@ WorkspacesDisplay.prototype = {
_dragBegin: function() { _dragBegin: function() {
this._inDrag = true; this._inDrag = true;
this._cancelledDrag = false;
this._updateZoom();
},
_dragCancelled: function() {
this._cancelledDrag = true;
this._updateZoom(); this._updateZoom();
}, },