ui: chevron should always be on top of driving path (#1391)

This commit is contained in:
Jason Wen
2025-10-15 16:20:31 -04:00
committed by GitHub
parent d7e1c42c2b
commit f1ca81debf
+22 -12
View File
@@ -22,7 +22,6 @@ void ModelRendererSP::update_model(const cereal::ModelDataV2::Reader &model, con
}
void ModelRendererSP::draw(QPainter &painter, const QRect &surface_rect) {
ModelRenderer::draw(painter, surface_rect);
auto *s = uiState();
auto &sm = *(s->sm);
@@ -31,6 +30,11 @@ void ModelRendererSP::draw(QPainter &painter, const QRect &surface_rect) {
return;
}
clip_region = surface_rect.adjusted(-CLIP_MARGIN, -CLIP_MARGIN, CLIP_MARGIN, CLIP_MARGIN);
experimental_mode = sm["selfdriveState"].getSelfdriveState().getExperimentalMode();
longitudinal_control = sm["carParams"].getCarParams().getOpenpilotLongitudinalControl();
path_offset_z = sm["liveCalibration"].getLiveCalibration().getHeight()[0];
painter.save();
const auto &model = sm["modelV2"].getModelV2();
@@ -41,22 +45,28 @@ void ModelRendererSP::draw(QPainter &painter, const QRect &surface_rect) {
update_model(model, lead_one);
drawLaneLines(painter);
bool blindspot = s->scene.blindspot_ui;
bool rainbow = s->scene.rainbow_mode;
bool left_blindspot = car_state.getLeftBlindspot();
bool right_blindspot = car_state.getRightBlindspot();
if (blindspot) {
drawBlindspot(painter, surface_rect, left_blindspot, right_blindspot);
}
if (rainbow) {
if (s->scene.rainbow_mode) {
drawRainbowPath(painter, surface_rect);
} else {
ModelRenderer::drawPath(painter, model, surface_rect.height());
}
if (longitudinal_control && sm.alive("radarState")) {
update_leads(radar_state, model.getPosition());
const auto &lead_two = radar_state.getLeadTwo();
if (lead_one.getStatus()) {
drawLead(painter, lead_one, lead_vertices[0], surface_rect);
}
if (lead_two.getStatus() && (std::abs(lead_one.getDRel() - lead_two.getDRel()) > 3.0)) {
drawLead(painter, lead_two, lead_vertices[1], surface_rect);
}
}
if (s->scene.blindspot_ui) {
const bool left_blindspot = car_state.getLeftBlindspot();
const bool right_blindspot = car_state.getRightBlindspot();
drawBlindspot(painter, surface_rect, left_blindspot, right_blindspot);
}
drawLeadStatus(painter, surface_rect.height(), surface_rect.width());
painter.restore();