int distanceX = 0;
int distanceY = 0;
gesture.GetDistance(distanceX, distanceY);
+ if (gesture.GetDirection() == _FLICK_DIRECTION_RIGHT
+ || gesture.GetDirection() == _FLICK_DIRECTION_LEFT)
+ {
+ distanceY = 0;
+ }
+ else
+ {
+ distanceX = 0;
+ }
Point flickPoint(distanceX, distanceY);
viewEventInfo.SetFlickPosition(flickPoint);
_GalleryViewEventInfo viewEventInfo(const_cast <_TouchInfo&>(touchinfo));
_GalleryViewEvent viewEvent(GALLERY_VIEW_EVENT_TOUCH_MOVED, &viewEventInfo);
- bool r = GetPresenter().PostEvent(viewEvent);
- SysTryReturn(NID_UI_CTRL, r == true, true, GetLastResult(), "[%s] Propagating.", GetErrorMessage(r));
-
- SetLastResult(E_SUCCESS);
-
- return true;
+ return GetPresenter().PostEvent(viewEvent);
}
bool
#include <FBaseErrors.h>
#include <FGrpFloatDimension.h>
#include <FBaseSysLog.h>
+#include "FUi_Math.h"
#include "FUiCtrl_GalleryImageReader.h"
#include "FUiCtrl_GalleryPresenter.h"
#include "FUiCtrl_GalleryViewEventInfo.h"
, __pinchMode(false)
, __touchPointId(0)
, __currentItemIndex(NO_CHANGE_ITEM_INDEX)
+ , __moveDirection(MOVE_DIRECTION_NONE)
+ , __endOfRange(false)
{
// Do nothing.
}
bool
_GalleryViewEventHandler::OnTouchMoved(_GalleryViewEventInfo& eventInfo)
{
+ if (__moveDirection == MOVE_DIRECTION_VERTICAL)
+ {
+ return false;
+ }
+
if (__pinchMode == true || __touchPointId != eventInfo.GetPointId())
{
return true;
//SetLastResult(E_SUCCESS);
- return true;
+ return __moveDirection == MOVE_DIRECTION_VERTICAL ? false : !__endOfRange;
}
bool
r = RefreshView();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__flickingDirection = FLICK_DIRECTION_NONE;
+ __moveDirection = MOVE_DIRECTION_NONE;
//SetLastResult(E_SUCCESS);
return true;
}
+ if (__moveDirection == MOVE_DIRECTION_VERTICAL)
+ {
+ return false;
+ }
+
result r = E_SUCCESS;
if (__zoomMode == false)
{
+ if (eventInfo.GetFlickPosition(). x == 0)
+ {
+ return false;
+ }
+
__moving = true;
if (eventInfo.GetFlickPosition().x > 0)
{
//SetLastResult(E_SUCCESS);
- return true;
+ return !__endOfRange;
CATCH:
SetRollbackCanvas();
FloatRectangle rect = viewRect;
int currentItemIndex = __galleryPresenter.GetCurrentItemIndex();
int leftCanvasIndex = __galleryPresenter.SearchCanvasIndex(currentItemIndex - 1);
+ __endOfRange = false;
__flickingDirection = FLICK_DIRECTION_RIGHT;
if (leftCanvasIndex == NOT_EXIST_CANVAS)
if (currentItemIndex - 1 < 0)
{
__flickingDirection = FLICK_DIRECTION_NONE;
+ __endOfRange = true;
return E_SUCCESS;
}
else
FloatRectangle rect = viewRect;
int currentItemIndex = __galleryPresenter.GetCurrentItemIndex();
int rightCanvasIndex = __galleryPresenter.SearchCanvasIndex(currentItemIndex + 1);
+ __endOfRange = false;
__flickingDirection = FLICK_DIRECTION_LEFT;
if (rightCanvasIndex == NOT_EXIST_CANVAS)
if (currentItemIndex + 1 >= __galleryPresenter.GetItemCount())
{
__flickingDirection = FLICK_DIRECTION_NONE;
+ __endOfRange = true;
return E_SUCCESS;
}
else
int currentCanvasIndex = __galleryPresenter.SearchCanvasIndex(currentItemIndex);
int rightCanvasIndex = NOT_EXIST_CANVAS;
int leftCanvasIndex = NOT_EXIST_CANVAS;
+ __endOfRange = false;
if (currentItemIndex != 0)
{
}
else
{
+ if (__moveDirection == MOVE_DIRECTION_NONE && _Abs(distance.width) < _Abs(distance.height))
+ {
+ __moveDirection = MOVE_DIRECTION_VERTICAL;
+ return E_SUCCESS;
+ }
+ else
+ {
+ __moveDirection = MOVE_DIRECTION_HORIZONTAL;
+ }
rect.x -= distance.width;
}
if (rect.x > 0 && leftCanvasIndex == NOT_EXIST_CANVAS && __zoomMode == false)
{
+ __endOfRange = true;
return E_SUCCESS;
}
else if (rect.x < 0 && rightCanvasIndex == NOT_EXIST_CANVAS && __zoomMode == false)
{
+ __endOfRange = true;
return E_SUCCESS;
}