window.document.body.addEventListener("touchstart", Application.Main.touchStart, false);
window.document.body.addEventListener("touchmove", Application.Main.touchMove, false);window.document.body.addEventListener("touchend", Application.Main.touchEnd, false);
touchStart: function(event) {
Application.Main.dragDropMouseDown = isDefined(Application.Main.dragDropMouseDown)?Application.Main.dragDropMouseDown:false;
Application.Main.dragDropMouseDown = Application.Main.activeMouseDown(event);if(Application.Main.dragDropMouseDown){
if (event.touches.length==1){ var touch = event.touches[0]; if (!touch) { event.preventDefault(); return (false); } var mousedownE = document.createEvent("MouseEvents"); mousedownE.initMouseEvent('mousedown',true,true,window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false,false,false,false, 0, null ); touch.target.dispatchEvent(mousedownE); //event.preventDefault(); //Application.Main.counting(event); } } } catch (exc) { }},touchMove: function(event) {
try { if(Application.Main.dragDropMouseDown){ if (event.touches.length==1){ var touch = event.touches[0]; if (!touch) { event.preventDefault(); return (false); } var mousemoveE = document.createEvent("MouseEvents"); mousemoveE.initMouseEvent('mousemove',true,true,window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false,false,false,false, 0, null ); touch.target.dispatchEvent(mousemoveE); } //Application.Main.counting(event); event.preventDefault(); } window.clearInterval(Application.Main.d); } catch (exc) { }},touchEnd: function(event) { try { if(Application.Main.dragDropMouseDown && event.touches.length==0){ var touch = event.changedTouches[0]; if (!touch) { event.preventDefault(); return (false); } var mouseupE = document.createEvent("MouseEvents"); mouseupE.initMouseEvent('mouseup',true,true,window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false,false,false,false, 0, null ); touch.target.dispatchEvent(mouseupE); Application.Main.dragDropMouseDown = false; } window.clearInterval(Application.Main.d); } catch (exc) { }},activeMouseDown: function(event) {
if(Application.Main.dragDropMouseDown){ return true; }else{ var result = false; if(event.touches.length==1){ var targetTouches = event.targetTouches; var target = targetTouches[0].target; var className = target.className; var patten = new RegExp("(x-panel-header|x-window-header|drag)"); result = patten.test(className); } return result; }}