fix(color): main view layout, lua widget display issues (#5382)
This commit is contained in:
@@ -79,23 +79,23 @@ class Layout: public LayoutBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool hasTopbar() const {
|
virtual bool hasTopbar() const {
|
||||||
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TOPBAR)->boolValue))[0];
|
return getOptionValue(LAYOUT_OPTION_TOPBAR)->boolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool hasFlightMode() const {
|
virtual bool hasFlightMode() const {
|
||||||
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_FM)->boolValue))[0];
|
return getOptionValue(LAYOUT_OPTION_FM)->boolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool hasSliders() const {
|
virtual bool hasSliders() const {
|
||||||
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_SLIDERS)->boolValue))[0];
|
return getOptionValue(LAYOUT_OPTION_SLIDERS)->boolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool hasTrims() const {
|
virtual bool hasTrims() const {
|
||||||
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TRIMS)->boolValue))[0];
|
return getOptionValue(LAYOUT_OPTION_TRIMS)->boolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isMirrored() const {
|
virtual bool isMirrored() const {
|
||||||
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_MIRRORED)->boolValue))[0];
|
return getOptionValue(LAYOUT_OPTION_MIRRORED)->boolValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isAppMode() const { return false; }
|
virtual bool isAppMode() const { return false; }
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void ViewMain::deleteLater(bool detach, bool trash)
|
|||||||
Window::deleteLater(detach, trash);
|
Window::deleteLater(detach, trash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewMain::addMainView(Window* view, uint32_t viewId)
|
void ViewMain::addMainView(WidgetsContainer* view, uint32_t viewId)
|
||||||
{
|
{
|
||||||
TRACE("addMainView(0x%p, %d)", view, viewId);
|
TRACE("addMainView(0x%p, %d)", view, viewId);
|
||||||
|
|
||||||
@@ -110,6 +110,9 @@ void ViewMain::addMainView(Window* view, uint32_t viewId)
|
|||||||
auto user_data = (void*)(intptr_t)viewId;
|
auto user_data = (void*)(intptr_t)viewId;
|
||||||
lv_obj_add_event_cb(tile, tile_view_deleted_cb, LV_EVENT_CHILD_DELETED,
|
lv_obj_add_event_cb(tile, tile_view_deleted_cb, LV_EVENT_CHILD_DELETED,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
|
view->adjustLayout();
|
||||||
|
view->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewMain::setTopbarVisible(float visible) { topbar->setVisible(visible); }
|
void ViewMain::setTopbarVisible(float visible) { topbar->setVisible(visible); }
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class ViewMain : public NavWindow
|
|||||||
std::string getName() const override { return "ViewMain"; }
|
std::string getName() const override { return "ViewMain"; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void addMainView(Window* view, uint32_t viewId);
|
void addMainView(WidgetsContainer* view, uint32_t viewId);
|
||||||
|
|
||||||
void enableTopbar();
|
void enableTopbar();
|
||||||
void disableTopbar();
|
void disableTopbar();
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ SetupWidgetsPage::SetupWidgetsPage(uint8_t customScreenIdx) :
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
addBackButton();
|
addBackButton();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
screen->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupWidgetsPage::onClicked()
|
void SetupWidgetsPage::onClicked()
|
||||||
|
|||||||
@@ -200,8 +200,13 @@ void LuaWidget::redraw_cb(lv_event_t* e)
|
|||||||
} else {
|
} else {
|
||||||
lv_draw_ctx_t* draw_ctx = lv_event_get_draw_ctx(e);
|
lv_draw_ctx_t* draw_ctx = lv_event_get_draw_ctx(e);
|
||||||
|
|
||||||
auto w = draw_ctx->buf_area->x2 - draw_ctx->buf_area->x1 + 1;
|
lv_area_t a, clipping, obj_coords;
|
||||||
auto h = draw_ctx->buf_area->y2 - draw_ctx->buf_area->y1 + 1;
|
lv_area_copy(&a, draw_ctx->buf_area);
|
||||||
|
lv_area_copy(&clipping, draw_ctx->clip_area);
|
||||||
|
lv_obj_get_coords(target, &obj_coords);
|
||||||
|
|
||||||
|
auto w = a.x2 - a.x1 + 1;
|
||||||
|
auto h = a.y2 - a.y1 + 1;
|
||||||
|
|
||||||
TRACE_WINDOWS("Draw %s", widget->getWindowDebugString().c_str());
|
TRACE_WINDOWS("Draw %s", widget->getWindowDebugString().c_str());
|
||||||
|
|
||||||
@@ -210,9 +215,9 @@ void LuaWidget::redraw_cb(lv_event_t* e)
|
|||||||
|
|
||||||
buf.setDrawCtx(draw_ctx);
|
buf.setDrawCtx(draw_ctx);
|
||||||
|
|
||||||
buf.setOffset(draw_ctx->clip_area->x1 - draw_ctx->buf_area->x1, draw_ctx->clip_area->y1 - draw_ctx->buf_area->y1);
|
buf.setOffset(obj_coords.x1 - a.x1, obj_coords.y1 - a.y1);
|
||||||
buf.setClippingRect(draw_ctx->clip_area->x1 - draw_ctx->buf_area->x1, draw_ctx->clip_area->x2 - draw_ctx->buf_area->x1 + 1,
|
buf.setClippingRect(clipping.x1 - a.x1, clipping.x2 + 1 - a.x1,
|
||||||
draw_ctx->clip_area->y1 - draw_ctx->buf_area->y1, draw_ctx->clip_area->y2 - draw_ctx->buf_area->y1 + 1);
|
clipping.y1 - a.y1, clipping.y2 + 1 - a.y1);
|
||||||
|
|
||||||
widget->refresh(&buf);
|
widget->refresh(&buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user