Added a simple static scroll indicator and set this as the default.

Also made some minor adjustments to the scroll indicator placement.
This commit is contained in:
Leon Styhre 2021-10-10 20:07:44 +02:00
parent ca64fc8308
commit 76ef1629c0
4 changed files with 109 additions and 96 deletions

View file

@ -500,8 +500,8 @@ void GuiMetaDataEd::onSizeChanged()
mGrid.setRowHeightPerc(3, (titleSubtitleSpacing * 1.2f) / mSize.y);
mGrid.setRowHeightPerc(4, ((mList->getRowHeight(0) * 10.0f) + 2.0f) / mSize.y);
mGrid.setColWidthPerc(0, 0.08f);
mGrid.setColWidthPerc(2, 0.08f);
mGrid.setColWidthPerc(0, 0.07f);
mGrid.setColWidthPerc(2, 0.07f);
mGrid.setSize(mSize);
mBackground.fitTo(mSize, glm::vec3{}, glm::vec2{-32.0f, -32.0f});

View file

@ -181,7 +181,7 @@ void Settings::setDefaults()
mBoolMap["SpecialCharsASCII"] = {false, false};
mBoolMap["ListScrollOverlay"] = {false, false};
mBoolMap["VirtualKeyboard"] = {true, true};
mBoolMap["ScrollIndicators"] = {true, true};
mBoolMap["ScrollIndicators"] = {false, false};
mBoolMap["FavoritesAddButton"] = {true, true};
mBoolMap["RandomAddButton"] = {false, false};
mBoolMap["GamelistFilters"] = {true, true};

View file

@ -127,8 +127,8 @@ void MenuComponent::onSizeChanged()
mGrid.setRowHeightPerc(1, TITLE_HEIGHT / mSize.y / 2.0f);
mGrid.setRowHeightPerc(3, getButtonGridHeight() / mSize.y);
mGrid.setColWidthPerc(0, 0.08f);
mGrid.setColWidthPerc(2, 0.08f);
mGrid.setColWidthPerc(0, 0.07f);
mGrid.setColWidthPerc(2, 0.07f);
mGrid.setSize(mSize);
}

View file

@ -30,9 +30,21 @@ public:
scrollUp->setOpacity(0);
scrollDown->setOpacity(0);
if (!Settings::getInstance()->getBool("ScrollIndicators"))
return;
if (!Settings::getInstance()->getBool("ScrollIndicators")) {
// If the scroll indicators setting is disabled, then show a permanent down arrow
// symbol when the component list contains more entries than can fit on screen.
componentList.get()->setScrollIndicatorChangedCallback(
[scrollUp, scrollDown](ComponentList::ScrollIndicator state) {
if (state == ComponentList::SCROLL_UP ||
state == ComponentList::SCROLL_UP_DOWN ||
state == ComponentList::SCROLL_DOWN) {
scrollDown->setOpacity(255);
}
});
}
else {
// If the scroll indicator setting is enabled, then also show the up and up/down
// combination and switch between these as the list is scrolled.
componentList.get()->setScrollIndicatorChangedCallback(
[this, scrollUp, scrollDown](ComponentList::ScrollIndicator state) {
float fadeInTime{FADE_IN_TIME};
@ -93,8 +105,8 @@ public:
static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
};
scrollUp->setAnimation(
new LambdaAnimation(upFadeInFunc, static_cast<int>(fadeInTime)), 0, nullptr,
false);
new LambdaAnimation(upFadeInFunc, static_cast<int>(fadeInTime)), 0,
nullptr, false);
}
if (upFadeOut) {
@ -130,6 +142,7 @@ public:
mPreviousScrollState = state;
});
}
}
private:
ComponentList::ScrollIndicator mPreviousScrollState;