Fix scrolling
This commit is contained in:
committed by
Raphael Coeffic
parent
2b7a120a86
commit
a877915138
@@ -68,13 +68,13 @@ void ListBase::setSelected(int selected)
|
||||
this->selected = selected;
|
||||
if(selectedIndexes.find(selected) != selectedIndexes.end()) { // Already selected -> Deselect it
|
||||
selectedIndexes.erase(selected);
|
||||
setScrollPositionY(lineHeight * this->selected - lineHeight);
|
||||
lv_obj_scroll_to_y(lvobj, lineHeight * this->selected - lineHeight, LV_ANIM_OFF);
|
||||
if(_multiSelectHandler != nullptr)
|
||||
_multiSelectHandler(selectedIndexes);
|
||||
invalidate();
|
||||
} else { // Not Selected -> Select it
|
||||
selectedIndexes.insert(selected);
|
||||
setScrollPositionY(lineHeight * this->selected - lineHeight);
|
||||
lv_obj_scroll_to_y(lvobj, lineHeight * this->selected - lineHeight, LV_ANIM_OFF);
|
||||
if (_setValue != nullptr) {
|
||||
_setValue(this->selected);
|
||||
}
|
||||
|
||||
@@ -296,10 +296,10 @@ void ModelCurvesPage::pushEditCurve(int index)
|
||||
|
||||
void ModelCurvesPage::rebuild(FormWindow * window, int8_t focusIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelCurvesPage::editCurve(FormWindow * window, uint8_t curve)
|
||||
|
||||
@@ -344,10 +344,10 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
||||
|
||||
void ModelGVarsPage::rebuild(FormWindow * window)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelGVarsPage::build(FormWindow * window)
|
||||
|
||||
@@ -491,10 +491,10 @@ ModelInputsPage::ModelInputsPage():
|
||||
|
||||
void ModelInputsPage::rebuild(FormWindow * window, int8_t focusIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelInputsPage::editInput(FormWindow * window, uint8_t input, uint8_t index)
|
||||
|
||||
@@ -345,10 +345,10 @@ ModelLogicalSwitchesPage::ModelLogicalSwitchesPage():
|
||||
|
||||
void ModelLogicalSwitchesPage::rebuild(FormWindow * window, int8_t focusIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelLogicalSwitchesPage::editLogicalSwitch(FormWindow * window, uint8_t lsIndex)
|
||||
|
||||
@@ -156,10 +156,10 @@ class ScriptEditWindow : public Page {
|
||||
|
||||
void rebuildBody(FormWindow * window)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
window->clear();
|
||||
buildBody(window);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
buildBody(window);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -228,10 +228,10 @@ ModelMixerScriptsPage::ModelMixerScriptsPage() :
|
||||
|
||||
void ModelMixerScriptsPage::rebuild(FormWindow * window, int8_t focusIdx)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusIdx);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
|
||||
|
||||
@@ -381,10 +381,10 @@ ModelMixesPage::ModelMixesPage() :
|
||||
|
||||
void ModelMixesPage::rebuild(FormWindow * window, int8_t focusMixIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusMixIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelMixesPage::editMix(FormWindow * window, uint8_t channel, uint8_t mixIndex)
|
||||
|
||||
@@ -300,10 +300,10 @@ ModelOutputsPage::ModelOutputsPage() :
|
||||
|
||||
void ModelOutputsPage::rebuild(FormWindow *window, int8_t focusChannel)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusChannel);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void ModelOutputsPage::build(FormWindow *window, int8_t focusChannel)
|
||||
|
||||
@@ -785,8 +785,9 @@ class CategoryEditPage : public PageTab
|
||||
|
||||
window->setInnerHeight(grid.getWindowHeight());
|
||||
|
||||
if(scrolltobot)
|
||||
window->setScrollPositionY(y+40);
|
||||
if(scrolltobot) {
|
||||
lv_obj_scroll_to_y(window->getLvObj(), y + 40, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
private:
|
||||
ModelSelectMenu *modelselectmenu;
|
||||
|
||||
@@ -432,10 +432,10 @@ void ModelTelemetryPage::checkEvents()
|
||||
|
||||
void ModelTelemetryPage::rebuild(FormWindow * window, int8_t focusSensorIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusSensorIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
lastKnownIndex = availableTelemetryIndex();
|
||||
}
|
||||
|
||||
|
||||
@@ -106,10 +106,10 @@ RadioSdManagerPage::RadioSdManagerPage() :
|
||||
|
||||
void RadioSdManagerPage::rebuild(FormWindow * window)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
// TODO elsewhere
|
||||
@@ -454,16 +454,13 @@ void RadioSdManagerPage::build(FormWindow * window)
|
||||
menu->addLine(STR_RENAME_FILE, [=]() {
|
||||
auto few = new FileNameEditWindow(name);
|
||||
few->setCloseHandler([=]() {
|
||||
//window->clear();
|
||||
rebuild(window);
|
||||
});
|
||||
});
|
||||
menu->addLine(STR_DELETE_FILE, [=]() {
|
||||
f_unlink((const TCHAR*)getFullPath(name));
|
||||
// coord_t scrollPosition = window->getScrollPositionY();
|
||||
window->clear();
|
||||
build(window);
|
||||
// window->setScrollPositionY(scrollPosition);
|
||||
});
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -613,10 +613,10 @@ SpecialFunctionsPage::SpecialFunctionsPage(CustomFunctionData *functions) :
|
||||
void SpecialFunctionsPage::rebuild(FormWindow *window,
|
||||
int8_t focusSpecialFunctionIndex)
|
||||
{
|
||||
coord_t scrollPosition = window->getScrollPositionY();
|
||||
auto scroll_y = lv_obj_get_scroll_y(window->getLvObj());
|
||||
window->clear();
|
||||
build(window, focusSpecialFunctionIndex);
|
||||
window->setScrollPositionY(scrollPosition);
|
||||
lv_obj_scroll_to_y(window->getLvObj(), scroll_y, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void SpecialFunctionsPage::editSpecialFunction(FormWindow *window,
|
||||
|
||||
@@ -344,4 +344,4 @@ void readModelNotes()
|
||||
#endif
|
||||
|
||||
LED_ERROR_END();
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: e6dc11ee06...2435236d71
Reference in New Issue
Block a user