Add some logging

This commit is contained in:
Pavel fljot 2014-10-23 22:45:45 +03:00
parent 3024eccd6e
commit 7d929b23b6
2 changed files with 66 additions and 4 deletions

View file

@ -5,6 +5,9 @@ package org.gestouch.core
import flash.utils.Dictionary;
import flash.utils.getTimer;
CONFIG::GestouchDebug
import org.gestouch.utils.log;
/**
* @author Pavel fljot
@ -161,6 +164,11 @@ package org.gestouch.core
_touchesMap[touchID] = touch;
_activeTouchesCount++;
CONFIG::GestouchDebug
{
log("Touch begin:", touch);
}
_gesturesManager.onTouchBegin(touch);
@ -179,6 +187,11 @@ package org.gestouch.core
// NB! It appeared that native TOUCH_MOVE event is dispatched also when
// the location is the same, but size has changed. We are only interested
// in location at the moment, so we shall ignore irrelevant calls.
CONFIG::GestouchDebug
{
log("Touch move:", touch);
}
_gesturesManager.onTouchMove(touch);
}
@ -195,6 +208,11 @@ package org.gestouch.core
delete _touchesMap[touchID];
_activeTouchesCount--;
CONFIG::GestouchDebug
{
log("Touch end:", touch);
}
_gesturesManager.onTouchEnd(touch);
@ -212,6 +230,11 @@ package org.gestouch.core
delete _touchesMap[touchID];
_activeTouchesCount--;
CONFIG::GestouchDebug
{
log("Touch begin:", touch);
}
_gesturesManager.onTouchCancel(touch);

View file

@ -12,6 +12,9 @@ package org.gestouch.input
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
CONFIG::GestouchDebug
import org.gestouch.utils.log;
/**
* @author Pavel fljot
@ -67,6 +70,12 @@ package org.gestouch.input
public function init():void
{
CONFIG::GestouchDebug
{
log("Multitouch.supportsTouchEvents:", Multitouch.supportsTouchEvents);
log("_explicitlyHandleTouchEvents:", _explicitlyHandleTouchEvents);
}
if (Multitouch.supportsTouchEvents || _explicitlyHandleTouchEvents)
{
_stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBeginHandler, true);
@ -145,7 +154,12 @@ package org.gestouch.input
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
CONFIG::GestouchDebug
{
log("Touch begin via touch event:", event);
}
_touchesManager.onTouchBegin(event.touchPointID, event.stageX, event.stageY, event.target as InteractiveObject);
}
@ -156,7 +170,12 @@ package org.gestouch.input
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
CONFIG::GestouchDebug
{
log("Touch move via touch event:", event);
}
_touchesManager.onTouchMove(event.touchPointID, event.stageX, event.stageY);
}
@ -167,6 +186,11 @@ package org.gestouch.input
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
CONFIG::GestouchDebug
{
log("Touch end/cancel via touch event:", event);
}
if (event.hasOwnProperty("isTouchPointCanceled") && event["isTouchPointCanceled"])
{
@ -185,6 +209,11 @@ package org.gestouch.input
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
CONFIG::GestouchDebug
{
log("Touch begin via mouse event:", event);
}
const touchAccepted:Boolean = _touchesManager.onTouchBegin(MOUSE_TOUCH_POINT_ID, event.stageX, event.stageY, event.target as InteractiveObject);
@ -201,7 +230,12 @@ package org.gestouch.input
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
CONFIG::GestouchDebug
{
log("Touch move via mouse event:", event);
}
_touchesManager.onTouchMove(MOUSE_TOUCH_POINT_ID, event.stageX, event.stageY);
}
@ -211,7 +245,12 @@ package org.gestouch.input
// We listen in EventPhase.CAPTURE_PHASE or EventPhase.AT_TARGET
// (to catch on empty stage) phases only
if (event.eventPhase == EventPhase.BUBBLING_PHASE)
return;
return;
CONFIG::GestouchDebug
{
log("Touch end via mouse event:", event);
}
_touchesManager.onTouchEnd(MOUSE_TOUCH_POINT_ID, event.stageX, event.stageY);