Просмотр исходного кода

fixed permanent container bounds updating when scrollable area is lesser than container's area

Andrew Karpushin 10 лет назад
Родитель
Сommit
f98dbf579a
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      gameplay/src/Container.cpp

+ 5 - 4
gameplay/src/Container.cpp

@@ -1138,34 +1138,35 @@ void Container::updateScroll()
     }
 
     // Stop scrolling when the far edge is reached.
+    Vector2 lastScrollPosition(_scrollPosition);
+
     if (-_scrollPosition.x > _totalWidth - clipWidth)
     {
         _scrollPosition.x = -(_totalWidth - clipWidth);
         _scrollingVelocity.x = 0;
-        dirty = true;
     }
     
     if (-_scrollPosition.y > _totalHeight - clipHeight)
     {
         _scrollPosition.y = -(_totalHeight - clipHeight);
         _scrollingVelocity.y = 0;
-        dirty = true;
     }
 
     if (_scrollPosition.x > 0)
     {
         _scrollPosition.x = 0;
         _scrollingVelocity.x = 0;
-        dirty = true;
     }
 
     if (_scrollPosition.y > 0)
     {
         _scrollPosition.y = 0;
         _scrollingVelocity.y = 0;
-        dirty = true;
     }
 
+    if (_scrollPosition != lastScrollPosition)
+        dirty = true;
+
     float scrollWidth = 0;
     if (clipWidth < _totalWidth)
         scrollWidth = (clipWidth / _totalWidth) * clipWidth;