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