PDA

View Full Version : BUG: Ext.Panel does not capture multi-finger touchstart events



JacobGu
1 Mar 2011, 10:28 AM
This does not work:


TC.views.Viewport = Ext.extend(Ext.Panel, {
{{ .... OTHER CODE REMOVED ... }}
},
onTouchStart: function(e){
if(e.touches.length >= 2){
console.log('2+ fingers touching');
}
}
listeners: {
afterRender: function(){
TC.views.Viewport.superclass.afterRender.call(this);

this.fingersTouching = 0;
this.mon(this.el, {
touchstart: this.onTouchStart,
scope: this
});
}
}

But this code does work:


onTouchStart: function(e){
if(e.touches.length >= 2){
console.log('2+ fingers touching');
}
},
listeners: {
afterRender: function(){
TC.views.Viewport.superclass.afterRender.call(this);

// bind listeners directly to DOM outside Sencha API, because
// Sencha does not capture multi-finger touchstart events
// properly for some reason.
document.addEventListener("touchstart", this.onTouchStart, false);
}
}