Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HTML5-style events

Added dragenter, added dragleave and dragend as aliases for dragout and
dragfinish, respectively. Retained the old names for backward
compatibility.
  • Loading branch information...
commit d33ae359345992e56c81b2e247b062973891b926 1 parent 61230bc
Mark Bessey authored
Showing with 20 additions and 3 deletions.
  1. +20 −3 source/dom/drag.js
View
23 source/dom/drag.js
@@ -6,11 +6,12 @@
The following events are provided:
* "dragstart"
- * "dragfinish"
* "drag"
- * "drop"
+ * "dragenter"
* "dragover"
- * "dragout"
+ * "dragout/dragleave"
+ * "drop"
+ * "dragfinish/dragend"
* "hold"
* "release"
* "holdpulse"
@@ -76,6 +77,13 @@ enyo.gesture.drag = {
this.stopDragging(e);
this.cancelHold();
},
+ enter: function(e) {
+ if (this.dragEvent) {
+ // send dragenter to new target
+ var synth = this.makeDragEvent("dragenter", e.target, e, this.dragEvent.dragInfo);
+ enyo.dispatch(synth);
+ }
+ },
leave: function(e) {
if (this.dragEvent) {
this.sendDragOut(e);
@@ -148,10 +156,19 @@ enyo.gesture.drag = {
e.preventTap && e.preventTap();
};
enyo.dispatch(synth);
+ // HTML5-stlye event names
+ var synth = this.makeDragEvent("dragend", this.dragEvent.target, e, this.dragEvent.dragInfo);
+ synth.preventTap = function() {
+ e.preventTap && e.preventTap();
+ };
+ enyo.dispatch(synth);
},
sendDragOut: function(e) {
var synth = this.makeDragEvent("dragout", e.target, e, this.dragEvent.dragInfo);
enyo.dispatch(synth);
+ // HTML5 names for events
+ var synth = this.makeDragEvent("dragleave", e.target, e, this.dragEvent.dragInfo);
+ enyo.dispatch(synth);
},
sendDrop: function(e) {
var synth = this.makeDragEvent("drop", e.target, e, this.dragEvent.dragInfo);
Please sign in to comment.
Something went wrong with that request. Please try again.