Skip to content

Commit

Permalink
Minor change if-then-else placement
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed Apr 27, 2024
1 parent 622b9cf commit 19ed054
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Editor/DearImGui/Drawable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,20 @@ void drawPlace(ImDrawList* draw_list, Place const& place, TypeOfNet const type,
//const uint8_t alpha = 255; // TODO m_fading[place.key]
const ImVec2 p = origin + ImVec2(place.x, place.y);

if (type != TypeOfNet::GRAFCET)
if (type == TypeOfNet::GRAFCET)
{
// Draw the place as circle
draw_list->AddCircleFilled(p, PLACE_RADIUS, FILL_COLOR(alpha), 64);
draw_list->AddCircle(p, PLACE_RADIUS, OUTLINE_COLOR, 64, 2.5f);
}
else
{
// Draw the transition
// Draw the place as square
const ImVec2 pmin(p.x - TRANS_WIDTH / 2.0f, p.y - TRANS_WIDTH / 2.0f);
const ImVec2 pmax(p.x + TRANS_WIDTH / 2.0f, p.y + TRANS_WIDTH / 2.0f);
draw_list->AddRectFilled(pmin, pmax, FILL_COLOR(alpha));
draw_list->AddRect(pmin, pmax, OUTLINE_COLOR, 0.0f, ImDrawFlags_None, 2.5f);
}
else
{
// Draw the place as circle
draw_list->AddCircleFilled(p, PLACE_RADIUS, FILL_COLOR(alpha), 64);
draw_list->AddCircle(p, PLACE_RADIUS, OUTLINE_COLOR, 64, 2.5f);
}

// Draw the caption
const char* text = show_caption ? place.caption.c_str() : place.key.c_str();
Expand Down

0 comments on commit 19ed054

Please sign in to comment.