diff options
author | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
commit | 81bea17aefb26859f825b9293c7c99192874806e (patch) | |
tree | fb244408ca271affa2899adb634788802c9a89d8 /lib/dojo/dnd/Moveable.js | |
parent | 870a70e109ac9e80a88047044530de53d0404ec7 (diff) |
upgrade Dojo to 1.6.1
Diffstat (limited to 'lib/dojo/dnd/Moveable.js')
-rw-r--r-- | lib/dojo/dnd/Moveable.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/dojo/dnd/Moveable.js b/lib/dojo/dnd/Moveable.js index 324196582..705b8cf62 100644 --- a/lib/dojo/dnd/Moveable.js +++ b/lib/dojo/dnd/Moveable.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -8,9 +8,9 @@ if(!dojo._hasResource["dojo.dnd.Moveable"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojo.dnd.Moveable"] = true; dojo.provide("dojo.dnd.Moveable"); - dojo.require("dojo.dnd.Mover"); + /*===== dojo.declare("dojo.dnd.__MoveableArgs", [], { // handle: Node||String @@ -54,6 +54,7 @@ dojo.declare("dojo.dnd.Moveable", null, { this.mover = params.mover ? params.mover : dojo.dnd.Mover; this.events = [ dojo.connect(this.handle, "onmousedown", this, "onMouseDown"), + dojo.connect(this.handle, "ontouchstart", this, "onMouseDown"), // cancel text selection and text dragging dojo.connect(this.handle, "ondragstart", this, "onSelectStart"), dojo.connect(this.handle, "onselectstart", this, "onSelectStart") @@ -76,17 +77,20 @@ dojo.declare("dojo.dnd.Moveable", null, { // mouse event processors onMouseDown: function(e){ // summary: - // event processor for onmousedown, creates a Mover for the node + // event processor for onmousedown/ontouchstart, creates a Mover for the node // e: Event - // mouse event + // mouse/touch event if(this.skip && dojo.dnd.isFormElement(e)){ return; } if(this.delay){ this.events.push( dojo.connect(this.handle, "onmousemove", this, "onMouseMove"), - dojo.connect(this.handle, "onmouseup", this, "onMouseUp") + dojo.connect(this.handle, "ontouchmove", this, "onMouseMove"), + dojo.connect(this.handle, "onmouseup", this, "onMouseUp"), + dojo.connect(this.handle, "ontouchend", this, "onMouseUp") ); - this._lastX = e.pageX; - this._lastY = e.pageY; + var pos = e.touches ? e.touches[0] : e; + this._lastX = pos.pageX; + this._lastY = pos.pageY; }else{ this.onDragDetected(e); } @@ -94,10 +98,11 @@ dojo.declare("dojo.dnd.Moveable", null, { }, onMouseMove: function(e){ // summary: - // event processor for onmousemove, used only for delayed drags + // event processor for onmousemove/ontouchmove, used only for delayed drags // e: Event - // mouse event - if(Math.abs(e.pageX - this._lastX) > this.delay || Math.abs(e.pageY - this._lastY) > this.delay){ + // mouse/touch event + var pos = e.touches ? e.touches[0] : e; + if(Math.abs(pos.pageX - this._lastX) > this.delay || Math.abs(pos.pageY - this._lastY) > this.delay){ this.onMouseUp(e); this.onDragDetected(e); } @@ -134,8 +139,8 @@ dojo.declare("dojo.dnd.Moveable", null, { // summary: // called before every move operation dojo.publish("/dnd/move/start", [mover]); - dojo.addClass(dojo.body(), "dojoMove"); - dojo.addClass(this.node, "dojoMoveItem"); + dojo.addClass(dojo.body(), "dojoMove"); + dojo.addClass(this.node, "dojoMoveItem"); }, onMoveStop: function(/* dojo.dnd.Mover */ mover){ // summary: |