Skip to content

Web viewer: ruler enhancements#10444

Open
maliberty wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:web-ruler-enhancements
Open

Web viewer: ruler enhancements#10444
maliberty wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:web-ruler-enhancements

Conversation

@maliberty
Copy link
Copy Markdown
Member

Summary

Add three ruler enhancements to match the Qt GUI:

  • Display control: Misc > Rulers toggle to show/hide all rulers and snap indicators
  • Manhattan L-shaped rulers: When euclidian=false, rulers draw an L-shaped path through a join point with correct endcap ticks and label positioning
  • Inspector editing: Ruler properties (Name, Label, Point coordinates, Euclidian) are editable inline. Generic inspector support via editable flag and onPropertyChange callback
  • Auto-select: Newly created rulers are immediately selected and shown in the inspector

Type of Change

  • New feature

Impact

Rulers now have a visibility toggle under Misc, can display Manhattan (L-shaped) paths, and support inline editing of properties in the inspector panel. New rulers are auto-selected for immediate inspection.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

None

…or editing

Display control:
- Add Misc > Rulers visibility toggle (default on) to show/hide all
  rulers and snap indicators, matching the Qt GUI.

Manhattan L-shaped rulers:
- When euclidian=false, draw an L-shaped path through a join point
  instead of a straight line. Join point matches the Qt GUI's
  getManhattanJoinPt(): horizontal-first when |dx|>=|dy|, vertical-
  first otherwise. Endcap ticks perpendicular to each segment.
  Distance label at the corner.

Inspector editing:
- Ruler properties (Name, Label, Point coordinates, Euclidian) are
  now editable in the inspector. Click to edit, Enter to confirm,
  Escape to cancel. Generic inspector support via editable flag and
  onPropertyChange callback.

Auto-select:
- Newly created rulers are immediately selected in the inspector.

Signed-off-by: Matt Liberty <matt.liberty@gmail.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
@maliberty maliberty requested a review from a team as a code owner May 16, 2026 05:16
@maliberty maliberty self-assigned this May 16, 2026
@maliberty maliberty requested a review from gadfort May 16, 2026 05:16
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Contributor

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

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 Manhattan (L-shaped) paths for rulers, adds a toggle for ruler visibility in the display controls, and implements editable properties within the inspector panel. The feedback highlights several redundant function calls in ruler.js where _rerenderAll is triggered multiple times unnecessarily. Additionally, there is a concern regarding the inspector's re-rendering logic on blur events, which currently disrupts keyboard navigation and focus flow.

Comment thread src/web/src/ruler.js
Comment on lines 393 to +395
this._rulers.push(ruler);
this._renderRuler(ruler);
this._selectRuler(id);
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 call to _renderRuler(ruler) is redundant here. The subsequent call to _selectRuler(id) (line 395) invokes _rerenderAll(), which clears the layer group and renders all rulers in the list, including the one just added.

Suggested change
this._rulers.push(ruler);
this._renderRuler(ruler);
this._selectRuler(id);
this._rulers.push(ruler);
this._selectRuler(id);

Comment thread src/web/src/ruler.js
Comment on lines +565 to +566
this._rerenderAll();
this._selectRuler(ruler.id);
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 call to this._rerenderAll() is redundant. this._selectRuler(ruler.id) already calls _rerenderAll() as its first step (line 492).

Suggested change
this._rerenderAll();
this._selectRuler(ruler.id);
this._selectRuler(ruler.id);

Comment thread src/web/src/inspector.js
Comment on lines +361 to +366
valEl.addEventListener('blur', () => {
const newVal = valEl.textContent;
if (newVal !== prop.value) {
data.onPropertyChange(prop.name, newVal);
}
});
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

Re-rendering the entire inspector panel on every blur event causes the DOM elements to be destroyed and recreated. This results in a loss of focus, which breaks keyboard navigation (e.g., using the Tab key to move between editable fields). Consider using a more targeted update approach or deferring the re-render to avoid interrupting the user's focus flow.

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.

1 participant