2017-04-05 44 views
2

如果啓用了觸摸屏,ExtJs 6.2.0在Firefox上不起作用。我注意到使用框架的經典版本的問題,我不能分辨現代版本是否也受到影響。ExtJs 6.2 classic無法與Firefox和觸摸屏一起使用

這是確切的問題:如果屏幕啓用了觸摸功能,則可以使用具有手勢的應用程序,但不能使用鼠標。鼠標點擊不會觸發點擊事件。

Sencha forum上提到了這個問題,但令人沮喪的是Sencha修復了訂戶的問題,但沒有發佈新的GPL版本。還有一個代碼片段,但它不是很清楚,我如何使用它:

// Undo sencha's logic 
// Needed for top nav buttons to not open links in new tabs/windows when clicked in IE11 EXTJS-13775 
// Firefox 52 is getting deteceted now as ALWAYS having pointer events 
// chromeOS causing issues too 
// unit tests failing 
if (Ext.isIE || Ext.isEdge || (Ext.firefoxVersion >= 52) || Ext.os.is.ChromeOS || window.inUnitTest) { 
    // sorry windows mobile phones... 
    var eventMap = Ext.dom.Element.prototype.eventMap; 
    eventMap.click = 'click'; 
    eventMap.dblclick = 'dblclick'; 
} 

回答

2

一些試驗和錯誤,並比較console.log S和代碼膛線後,我想出了一個覆蓋該修復了這個錯誤。

/** 
* workaround for bug in ExtJs 6.2.0. 
* Resolved in current yet unreleased version 
*/ 
Ext.define('Mb.override.dom.Element', { 
    override: 'Ext.dom.Element' 
}, 
function(){ 
    var additiveEvents = this.prototype.additiveEvents, 
     eventMap = this.prototype.eventMap; 
    if(Ext.supports.TouchEvents && Ext.firefoxVersion >= 52 && Ext.os.is.Desktop){ 
     eventMap['touchstart'] = 'mousedown'; 
     eventMap['touchmove'] = 'mousemove'; 
     eventMap['touchend'] = 'mouseup'; 
     eventMap['touchcancel'] = 'mouseup'; 
     eventMap['click'] = 'click'; 
     eventMap['dblclick'] = 'dblclick'; 
     additiveEvents['mousedown'] = 'mousedown'; 
     additiveEvents['mousemove'] = 'mousemove'; 
     additiveEvents['mouseup'] = 'mouseup'; 
     additiveEvents['touchstart'] = 'touchstart'; 
     additiveEvents['touchmove'] = 'touchmove'; 
     additiveEvents['touchend'] = 'touchend'; 
     additiveEvents['touchcancel'] = 'touchcancel'; 

     additiveEvents['pointerdown'] = 'mousedown'; 
     additiveEvents['pointermove'] = 'mousemove'; 
     additiveEvents['pointerup'] = 'mouseup'; 
     additiveEvents['pointercancel'] = 'mouseup'; 
    } 
}) 

我沒有測試每個事件翻譯組合是否有效。通過鼠標與觸摸屏解僱click事件特別需要的線是

eventMap['click'] = 'click'; 
eventMap['dblclick'] = 'dblclick';