From 12fc75790b08522bcfd72824d76ce3393439aaae Mon Sep 17 00:00:00 2001 From: kepler-5 Date: Tue, 25 Jul 2017 05:11:02 -0700 Subject: [PATCH] Fix pageview iterator invalidation (#18091) * allow setting and getting of pageview indicator opacity. fix some documentation comments * don't draw the indicator the selected indicator is currently overlapping * add a tweaked opacity to one of the test cases * remove unused variable * convert tabs to whitespace * change constexpr to static const * fix iterator invalidation when adding or removing pages from the pageview --- cocos/ui/UIPageViewIndicator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cocos/ui/UIPageViewIndicator.cpp b/cocos/ui/UIPageViewIndicator.cpp index be873d6ce9..c46e4c04a7 100644 --- a/cocos/ui/UIPageViewIndicator.cpp +++ b/cocos/ui/UIPageViewIndicator.cpp @@ -215,6 +215,10 @@ void PageViewIndicator::setIndexNodesTexture(const std::string& texName, Widget: void PageViewIndicator::increaseNumberOfPages() { + if ( _currentOverlappingIndexNode ) { + _currentOverlappingIndexNode->setVisible(true); + _currentOverlappingIndexNode = nullptr; + } Sprite* indexNode; if(_useDefaultTexture) @@ -245,6 +249,10 @@ void PageViewIndicator::increaseNumberOfPages() void PageViewIndicator::decreaseNumberOfPages() { + if ( _currentOverlappingIndexNode ) { + _currentOverlappingIndexNode->setVisible(true); + _currentOverlappingIndexNode = nullptr; + } if(_indexNodes.empty()) { return; @@ -255,6 +263,10 @@ void PageViewIndicator::decreaseNumberOfPages() void PageViewIndicator::clear() { + if ( _currentOverlappingIndexNode ) { + _currentOverlappingIndexNode->setVisible(true); + _currentOverlappingIndexNode = nullptr; + } for(auto& indexNode : _indexNodes) { removeProtectedChild(indexNode);