[gnome-shell] dnd: Emit drag-end in after snapback complete
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] dnd: Emit drag-end in after snapback complete
- Date: Fri, 7 Aug 2009 17:29:43 +0000 (UTC)
commit c23b9ee1920567d8317dac82db1f8702bc017eca
Author: Colin Walters <walters verbum org>
Date: Thu Jul 23 17:34:01 2009 -0400
dnd: Emit drag-end in after snapback complete
Emit the signal at the correct time to take action
on snapback (i.e. after the end of the snapback animation).
Add a boolean to the drag-end signal saying whether it was accepted,
which ensures consumers know whether the drag was successful.
js/ui/dnd.js | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 300aeed..c7f753e 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -153,8 +153,6 @@ _Draggable.prototype = {
if (!dragging)
return false;
- this.emit('drag-end', event.get_time());
-
// Find a drop target
actor.hide();
let [dropX, dropY] = event.get_coords();
@@ -173,6 +171,7 @@ _Draggable.prototype = {
if (actor.get_parent() == actor.get_stage())
actor.destroy();
+ this.emit('drag-end', event.get_time(), true);
return true;
}
}
@@ -196,18 +195,20 @@ _Draggable.prototype = {
transition: "easeOutQuad",
onComplete: this._onSnapBackComplete,
onCompleteScope: this,
- onCompleteParams: [actor]
+ onCompleteParams: [actor, event.get_time()]
});
return true;
},
- _onSnapBackComplete : function (dragActor) {
+ _onSnapBackComplete : function (dragActor, eventTime) {
if (this._dragOrigParent) {
dragActor.reparent(this._dragOrigParent);
dragActor.set_scale(this._dragOrigScale, this._dragOrigScale);
dragActor.set_position(this._dragOrigX, this._dragOrigY);
- } else
+ } else {
dragActor.destroy();
+ }
+ this.emit('drag-end', eventTime, false);
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]