/**
* @class Roo.dd.DragDrop
+ * @extends Roo.util.Observable
* Defines the interface and base operation of items that that can be
* dragged or can be drop targets. It was designed to be extended, overriding
* the event handlers for startDrag, onDrag, onDragOver and onDragOut.
if (id) {
this.init(id, sGroup, config);
}
- if (config.listeners || config.events) {
- Roo.BasicLayoutRegion.superclass.constructor.call(this, {
- listeners : config.listeners || {},
- events : config.events || {}
- });
- }
+
};
Roo.extend(Roo.dd.DragDrop, Roo.util.Observable , {
*/
init: function(id, sGroup, config) {
this.initTarget(id, sGroup, config);
- Event.on(this.id, "mousedown", this.handleMouseDown, this);
+ if (!Roo.isTouch) {
+ Event.on(this.id, "mousedown", this.handleMouseDown, this);
+ }
+ Event.on(this.id, "touchstart", this.handleMouseDown, this);
// Event.on(this.id, "selectstart", Event.preventDefault);
},
unreg: function() {
Event.un(this.id, "mousedown",
this.handleMouseDown);
+ Event.un(this.id, "touchstart",
+ this.handleMouseDown);
this._domRef = null;
this.DDM._remove(this);
},
* @private
*/
handleMouseDown: function(e, oDD){
- if (this.primaryButtonOnly && e.button != 0) {
+
+ if (!Roo.isTouch && this.primaryButtonOnly && e.button != 0) {
+ //Roo.log('not touch/ button !=0');
return;
}
+ if (e.browserEvent.touches && e.browserEvent.touches.length != 1) {
+ return; // double touch..
+ }
+
if (this.isLocked()) {
+ //Roo.log('locked');
return;
}
this.DDM.refreshCache(this.groups);
-
+// Roo.log([Roo.lib.Event.getPageX(e), Roo.lib.Event.getPageY(e)]);
var pt = new Roo.lib.Point(Roo.lib.Event.getPageX(e), Roo.lib.Event.getPageY(e));
if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
+ //Roo.log('no outer handes or not over target');
+ // do nothing.
} else {
+// Roo.log('check validator');
if (this.clickValidator(e)) {
-
+// Roo.log('validate success');
// set the initial element position
this.setStartPosition();