Skip to content

gui: Add feature highlight for browser WebGUI#10631

Open
jorge-ferreira-pii wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feature-highlight-browser-WebGUI
Open

gui: Add feature highlight for browser WebGUI#10631
jorge-ferreira-pii wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feature-highlight-browser-WebGUI

Conversation

@jorge-ferreira-pii

@jorge-ferreira-pii jorge-ferreira-pii commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Addresses a portion of #10619

2.6 Selection, highlight & inspection

Feature GUI Web Status
Selection browser (table of all sel/highlighted) selectHighlightWindow

@jorge-ferreira-pii jorge-ferreira-pii self-assigned this Jun 10, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the Select & Highlight Browser widget to the web interface, mirroring the Qt GUI's SelectHighlightWindow. It adds the frontend SelectHighlightWidget and integrates it into the build system, main application, and menu bar. On the backend, it implements handlers for selection and highlight management, including deselecting, clearing, grouping, and inspecting items, as well as rendering colored overlay shapes. The review feedback suggests correcting a hex color mismatch for the 'purple' highlight group and refactoring the JSON item creation helper to return a boost::json::object directly, which simplifies and optimizes the list-building logic in handleSelectionList.

{ name: 'dark_magenta', hex: '#800080' },
{ name: 'blue', hex: '#0000ff' },
{ name: 'orange', hex: '#ffa500' },
{ name: 'purple', hex: '#800080' },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The hex color for 'purple' is set to '#800080', which is identical to 'dark_magenta'. In the backend (gui::Painter::kHighlightColors), the color for purple is (128, 0, 255), which corresponds to #8000ff. This mismatch causes the frontend color swatch/picker to display a different color than what is actually rendered on the layout map.

Suggested change
{ name: 'purple', hex: '#800080' },
{ name: 'purple', hex: '#8000ff' },

Comment thread src/web/src/request_handler.cpp Outdated
Comment on lines +647 to +661
// Append {id,name,type,bbox} for `sel` to `arr`.
void appendBrowserItem(boost::json::array& arr,
int id,
const gui::Selected& sel)
{
boost::json::object item;
item["id"] = id;
item["name"] = sel.getName();
item["type"] = sel.getTypeName();
odb::Rect bbox;
if (sel.getBBox(bbox)) {
item["bbox"] = bboxArray(bbox);
}
arr.emplace_back(std::move(item));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The helper function appendBrowserItem appends directly to a boost::json::array. In handleSelectionList, this forces a roundabout and inefficient pattern for the highlighted list where a temporary array tmp is created for every single item, the item is appended, then extracted back out via tmp.front().as_object().

Refactoring appendBrowserItem to a static helper makeBrowserItem that returns a boost::json::object directly avoids this overhead and simplifies the calling code.

// Create {id,name,type,bbox} for `sel` as a JSON object.
static boost::json::object makeBrowserItem(int id, const gui::Selected& sel)
{
  boost::json::object item;
  item["id"] = id;
  item["name"] = sel.getName();
  item["type"] = sel.getTypeName();
  odb::Rect bbox;
  if (sel.getBBox(bbox)) {
    item["bbox"] = bboxArray(bbox);
  }
  return item;
}

Comment on lines +677 to +705
boost::json::array sel_arr;
state.browser_selected.clear();
for (const auto& s : state.selection_set) {
if (!s) {
continue;
}
const int id = static_cast<int>(state.browser_selected.size());
state.browser_selected.push_back(s);
appendBrowserItem(sel_arr, id, s);
}
root["selected"] = std::move(sel_arr);

boost::json::array hl_arr;
state.browser_highlighted.clear();
for (int g = 0; g < gui::kNumHighlightSet; ++g) {
for (const auto& s : state.highlight_groups[g]) {
if (!s) {
continue;
}
const int id = static_cast<int>(state.browser_highlighted.size());
state.browser_highlighted.emplace_back(s, g);
boost::json::array tmp;
appendBrowserItem(tmp, id, s);
auto item = tmp.front().as_object();
item["group"] = g;
hl_arr.emplace_back(std::move(item));
}
}
root["highlighted"] = std::move(hl_arr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Simplify the list building logic by utilizing the refactored makeBrowserItem helper. This eliminates the creation and extraction overhead of the temporary boost::json::array tmp for each highlighted item.

    boost::json::array sel_arr;
    state.browser_selected.clear();
    for (const auto& s : state.selection_set) {
      if (!s) {
        continue;
      }
      const int id = static_cast<int>(state.browser_selected.size());
      state.browser_selected.push_back(s);
      sel_arr.emplace_back(makeBrowserItem(id, s));
    }
    root["selected"] = std::move(sel_arr);

    boost::json::array hl_arr;
    state.browser_highlighted.clear();
    for (int g = 0; g < gui::kNumHighlightSet; ++g) {
      for (const auto& s : state.highlight_groups[g]) {
        if (!s) {
          continue;
        }
        const int id = static_cast<int>(state.browser_highlighted.size());
        state.browser_highlighted.emplace_back(s, g);
        auto item = makeBrowserItem(id, s);
        item["group"] = g;
        hl_arr.emplace_back(std::move(item));
      }
    }
    root["highlighted"] = std::move(hl_arr);

Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
@openroad-ci openroad-ci force-pushed the feature-highlight-browser-WebGUI branch from 2cad6af to 49d52ea Compare June 10, 2026 20:21
@jorge-ferreira-pii

Copy link
Copy Markdown
Contributor Author
  • Implementation of a new visual component (widget) dedicated to managing and listing selected objects.
  • Addition of a color palette (swatches) for interactive control of highlight groups.
  • Inclusion of direct actions in the interface, allowing the user to zoom into a selection (fitBounds) or initiate a detailed inspection of an object through the browser.

@jorge-ferreira-pii jorge-ferreira-pii marked this pull request as ready for review June 10, 2026 20:32
@jorge-ferreira-pii jorge-ferreira-pii requested a review from a team as a code owner June 10, 2026 20:32
@maliberty

Copy link
Copy Markdown
Member

This doesn't seem to be a complete fix for all the issues in #10619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants