, __scrollHeightOnFlickStarted(0)
, __scrollPositionOnFlickStarted(0)
, __isAnimationCallbackBlocked(false)
+ , __lockLoadItemWithScroll(false)
{
__sweptItemTag.itemIndex = -1;
__sweptItemTag.groupIndex = -1;
}
void
-_TableViewPresenter::ResetItemLayout(TableViewItemTag& topDrawnItemTag)
+_TableViewPresenter::ResetItemLayout(TableViewItemTag& topDrawnItemTag, float shiftingDistance)
{
if (__pListModel->IsValidItem(topDrawnItemTag.groupIndex, topDrawnItemTag.itemIndex) == false)
{
TableViewItemTag currentItem = topDrawnItemTag;
TableViewItemTag itemPos = topDrawnItemTag;
- float screenAreaHeight = __pTableView->GetBoundsF().height;
+ float screenAreaHeight = __pTableView->GetBoundsF().height + shiftingDistance;
float loadedItemTotalHeight = 0.0f;
FloatRectangle itemBounds = pItem->GetBoundsF();
__pListModel->RestoreItemStatus();
- CreateItemHeightList(TABLEVIEW_DEFAULT_ITEM_HEIGHT_VALUE);
+ CreateItemHeightList(TABLEVIEW_DEFAULT_ITEM_HEIGHT_VALUE, TABLEVIEW_DEFAULT_ITEM_HEIGHT_VALUE);
CreateSectionAlignmentList();
int cachingSize = 0;
__pListModel->RestoreItemStatus();
DeleteItemHeightList();
- CreateItemHeightList(__pProviderAdaptor->GetDefaultItemHeight());
+ CreateItemHeightList(__pProviderAdaptor->GetDefaultGroupItemHeight(), __pProviderAdaptor->GetDefaultItemHeight());
DeleteSectionAlignmentList();
CreateSectionAlignmentList();
shiftingDistance = 0;
}
+ __lockLoadItemWithScroll = true;
+
ScrollToItem(topDrawnGroupIndex, topDrawnItemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP, shiftingDistance);
+
+ __lockLoadItemWithScroll = false;
+
AdjustClientAreaBounds(true);
if (__pTableView->GetScrollStyle() == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL)
SetItemDrawingProperty();
AdjustLoadedItemWidth();
+
+ __pTableView->UpdateLayout();
}
SetClientAreaHeight(__itemTotalHeight);
float newScrollPosition = (newPosition < 0) ? 0 : (newPosition > currentscrollAreaHeight ? currentscrollAreaHeight : newPosition);
float newScrollAreaHeight = 0;
- LoadItemWithScrollPosition(currentScrollPosition, newScrollPosition);
-
- if (currentScrollPosition > newScrollPosition)
+ if (!__lockLoadItemWithScroll)
{
- newScrollAreaHeight = GetScrollAreaBounds().height;
- newScrollPosition += newScrollAreaHeight - currentscrollAreaHeight;
+ LoadItemWithScrollPosition(currentScrollPosition, newScrollPosition);
+
+ if (currentScrollPosition > newScrollPosition)
+ {
+ newScrollAreaHeight = GetScrollAreaBounds().height;
+ newScrollPosition += newScrollAreaHeight - currentscrollAreaHeight;
+ }
}
return _ScrollPanelPresenter::ScrollToInternal(newScrollPosition);
if (!__pListModel->IsLoadedItem(groupIndex, itemIndex))
{
- ResetItemLayout(itemPos);
+ ResetItemLayout(itemPos, shiftingDistance);
}
_TableViewItem* pItem = FindItem(itemPos);
}
bool
-_TableViewPresenter::CreateItemHeightList(float defaultHeight)
+_TableViewPresenter::CreateItemHeightList(float defaultGroupItemHeight, float defaultItemHeight)
{
int groupCount = GetGroupCount();
}
else
{
- __itemHeightList.Add(defaultHeight);
+ __itemHeightList.Add(defaultGroupItemHeight);
}
for (int j = 0; j < itemCount; j++)
{
- __itemHeightList.Add(defaultHeight);
+ __itemHeightList.Add(defaultItemHeight);
}
}
void SetItemLayout(_TableViewItem* pItem, TableViewItemTag& itemPos);
float CalculateItemPositionY(int groupIndex, int itemIndex);
void AdjustLayoutItems(float scrollPosition);
- void ResetItemLayout(TableViewItemTag& topDrawnItemTag);
+ void ResetItemLayout(TableViewItemTag& topDrawnItemTag, float shiftingDistance);
void RefreshItemLayout(TableViewItemTag& topDrawnItemTag, TableViewItemTag& refreshItemTag, TableViewRefreshType type, bool animation);
void RefreshItemBounds(_TableViewItem* pItem, TableViewItemTag& itemPos);
void ScrollToItem(int groupIndex, int itemIndex, TableViewScrollItemAlignment itemAlignment, float shiftingDistance = 0.0f);
// item height
float GetItemHeight(TableViewItemTag itemTag) const;
float SetItemHeight(TableViewItemTag itemTag, float height);
- bool CreateItemHeightList(float defaultHeight);
+ bool CreateItemHeightList(float defaultGroupItemHeight, float defaultItemHeight);
void DeleteItemHeightList(void);
void PresetItemHeightList(void);
bool RefreshItemHeightList(int groupIndex, int itemIndex, TableViewRefreshType refreshType);
float __scrollPositionOnFlickStarted;
bool __isAnimationCallbackBlocked;
+ bool __lockLoadItemWithScroll;
static const int TABLEVIEW_MAX_ITEM_COUNT = 30;
static const int REORDER_SCROLL_ANIMATION_TIMER_DURATION = 10;