Skip to content

Commit

Permalink
Fix rendering rectangles where fill attributes indicated the line att…
Browse files Browse the repository at this point in the history
…ribute colour should be used

Fixed output rectangles never locating the correct line attribute object when line colour was selected as the fill type.
  • Loading branch information
ad3154 committed Nov 1, 2024
1 parent bfb9230 commit 3aa1fa0
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/OutputRectangleComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,15 @@ void OutputRectangleComponent::paint(Graphics &g)

case isobus::FillAttributes::FillType::FillWithLineColor:
{
for (std::uint16_t j = 0; j < get_number_children(); j++)
{
auto childLineAttributes = get_object_by_id(get_child_id(j), parentWorkingSet->get_object_tree());
auto childLineAttributes = get_object_by_id(get_line_attributes(), parentWorkingSet->get_object_tree());

if ((nullptr != childLineAttributes) && (isobus::VirtualTerminalObjectType::LineAttributes == childLineAttributes->get_object_type()))
{
auto line = std::static_pointer_cast<isobus::LineAttributes>(childLineAttributes);
vtColour = parentWorkingSet->get_colour(line->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0));
g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
break;
}
if ((nullptr != childLineAttributes) && (isobus::VirtualTerminalObjectType::LineAttributes == childLineAttributes->get_object_type()))
{
auto line = std::static_pointer_cast<isobus::LineAttributes>(childLineAttributes);
vtColour = parentWorkingSet->get_colour(line->get_background_color());
g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0));
g.fillAll(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
break;
}
isOpaque = true;
}
Expand Down

0 comments on commit 3aa1fa0

Please sign in to comment.