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
This commit is contained in:
kepler-5 2017-07-25 05:11:02 -07:00 committed by minggo
parent b77c29f750
commit 12fc75790b
1 changed files with 12 additions and 0 deletions

View File

@ -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);