From 1ab5a093a38b07a63a5b81ac0394d2ca10eb48d9 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Thu, 5 Jun 2014 15:52:41 +0100 Subject: [PATCH] Fixed wrong scroll direction for mouse wheel event in ItemView and ScrollView [problem] ScrollView and ItemView are moving in the wrong direction for mouse wheel event. [solution] Fixed the scroll direction for mouse wheel event in ItemView and ScrollView. --- .../internal/controls/scrollable/item-view/item-view-impl.cpp | 2 +- .../internal/controls/scrollable/scroll-view/scroll-view-impl.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 779395e..ef9abeb 100644 --- a/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -1105,7 +1105,7 @@ bool ItemView::OnMouseWheelEvent(const MouseWheelEvent& event) { Actor self = Self(); const Vector3 layoutSize = Self().GetCurrentSize(); - float layoutPositionDelta = GetCurrentLayoutPosition(0) + (event.z * mMouseWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor()); + float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.z * mMouseWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor()); float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout); mScrollPositionObject.SetProperty( ScrollConnector::SCROLL_POSITION, firstItemScrollPosition ); diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 30b67c8..2c5b61b 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -1993,14 +1993,14 @@ bool ScrollView::OnMouseWheelEvent(const MouseWheelEvent& event) if(mRulerX->GetType() == Ruler::Free) { // Free panning mode - targetScrollPosition.x -= event.z * mMouseWheelScrollDistanceStep.x; + targetScrollPosition.x += event.z * mMouseWheelScrollDistanceStep.x; ClampPosition(targetScrollPosition); ScrollTo(-targetScrollPosition); } else if(!mScrolling) { // Snap mode, only respond to the event when the previous snap animation is finished. - ScrollTo(GetCurrentPage() + event.z); + ScrollTo(GetCurrentPage() - event.z); } } else @@ -2009,14 +2009,14 @@ bool ScrollView::OnMouseWheelEvent(const MouseWheelEvent& event) if(mRulerY->GetType() == Ruler::Free) { // Free panning mode - targetScrollPosition.y -= event.z * mMouseWheelScrollDistanceStep.y; + targetScrollPosition.y += event.z * mMouseWheelScrollDistanceStep.y; ClampPosition(targetScrollPosition); ScrollTo(-targetScrollPosition); } else if(!mScrolling) { // Snap mode, only respond to the event when the previous snap animation is finished. - ScrollTo(GetCurrentPage() + event.z * mRulerX->GetTotalPages()); + ScrollTo(GetCurrentPage() - event.z * mRulerX->GetTotalPages()); } } -- 2.7.4