Skip to content

48 make sidebar more intuitive #52

Merged
merged 15 commits into from
Nov 3, 2025
Merged

Conversation

mariewah
Copy link
Member

@mariewah mariewah commented Oct 29, 2025

Issue number

Closes #48

Description

Make the sidebar more intuitive, so that it is easy to understand what each tool is and where to find them:

  • Write out name of each measurement tool
  • Move Measurements and Saved Positions above Appearance/reorder panels
  • Collapse unused panels
  • Make Accepted filtering more intuitive (look less like checkboxes)
  • Fix the Annotation button
  • Show/Hide Annotation labels
  • Fix spacing in elevation control

Testing steps

  • Add annotation and then try to hide them
  • Use the measurment tools and see that they all respond after new format
  • Generally give feedback on visual pleasantness in the sidebar

Screenshots (optional)

Summary by CodeRabbit

  • New Features

    • Show/hide toggle for annotation labels added to the annotation panel.
    • Descriptive labels added to measurement tools; measurement controls relocated within the menu.
    • Toggle auto-shows labels when adding a new annotation.
  • Style

    • Updated annotation panel color scheme, spacing, and revamped Add button styling.
    • Redesigned filter color legend for clearer pill-shaped indicators and improved contrast.
    • Measurement tool labels gain hover and interaction effects.
  • UI Changes

    • Filters menu removed from the initial UI.

@mariewah mariewah requested review from adriahso and franmagn October 29, 2025 13:06
@mariewah mariewah linked an issue Oct 29, 2025 that may be closed by this pull request
7 tasks
@coderabbit
Copy link

coderabbit bot commented Oct 29, 2025

Walkthrough

Adds a Show/Hide labels toggle to the annotation panel, updates annotation and measurement panel DOM/CSS (new layout, button and tool-label wrappers), moves the measurements panel anchor, updates filter legend markup and styling, and removes the filters menu element during GUI init.

Changes

Cohort / File(s) Change Summary
Annotation panel UI & behavior
src/AnnotationControl/annotationPanel.css, src/AnnotationControl/annotationPanel.js
Renamed panel class, added flex layout and toggle container, restyled textarea and Add button (colors, transitions, sizing), introduced Show/Hide labels toggle with active-state handling, and wired logic to show/hide potree_annotation_container; ensures labels are shown when adding annotations.
Measurement tools labeling & relocation
src/MeasurementControl/measurementsPanel.css, src/MeasurementControl/measurementsPanel.js
Moved panel injection anchor from #menu_tools to #menu_appearance; wraps measurement icons in .tool-with-label with .tool-label text, makes wrappers clickable, and added hover/glow styling.
Filter legend markup & styling
src/Filter/filter.css, src/Filter/filter.js
Converted legend color boxes to pill-shaped visuals with subtle shadows, adjusted alignment and spacing, moved legend label text to precede color boxes, and toggled visibility between Elevation/Accepted buttons when clicked.
GUI initialization / menu DOM change
src/potreeViewer.js
During GUI init, removed the filters menu element from the DOM instead of toggling visibility on top-level menus.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Panel as Annotation Panel
    participant DOM as potree_annotation_container

    User->>Panel: Click "Show" button
    Panel->>Panel: set Show active, Hide inactive
    Panel->>DOM: DOM.style.display = ''  /* reveal labels */
    User->>Panel: Click "Hide" button
    Panel->>Panel: set Hide active, Show inactive
    Panel->>DOM: DOM.style.display = 'none'  /* hide labels */
Loading
sequenceDiagram
    participant Init as Measurements init
    participant Sidebar as Sidebar DOM (#menu_appearance)
    participant Script as Wrapper creation

    Init->>Sidebar: locate `#menu_appearance` (new anchor)
    Script->>Sidebar: for each known tool icon -> create `.tool-with-label`
    Script->>Sidebar: move icon into wrapper, append `.tool-label`
    Script->>Script: bind click on wrapper to trigger original icon action
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Pay attention to annotation toggle state vs. actual DOM visibility (potree_annotation_container).
  • Verify measurement wrapper click handlers do not duplicate or block original events.
  • Check CSS changes for accessibility/contrast and responsive layout impacts.
  • Confirm removing filters menu doesn't affect other menu initialization logic.

Possibly related PRs

  • 8 point filtering #39 — Modifies Potree UI filtering/elevation and viewer initialization; likely overlaps with src/potreeViewer.js and filter UI changes.

Suggested reviewers

  • gautegf

Poem

🐇 I nudged a button, labels peek and play,

Tools now wear names and brightly say,
Show, Hide, a toggle dance so small,
Sidebars hop tidy, standing tall.
A little rabbit cheers the UI's call.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title "48 make sidebar more intuitive" clearly and directly relates to the main objective of this pull request. It references the issue number and concisely captures the primary goal of improving the sidebar's usability and intuitiveness. The title is specific enough that a reviewer scanning commit history would understand the fundamental purpose of these changes.
Linked Issues Check ✅ Passed The code changes address most of the seven checklist objectives from issue #48. Measurement tool labels are implemented in measurementsPanel.js through wrapper divs with tool labels, the accepted filtering visual improvements are evident in filter.css and filter.js with pill-shaped indicators replacing checkbox-like styling, annotation label show/hide toggle functionality is added in annotationPanel.js, and the filters menu removal in potreeViewer.js relates to panel collapsing. However, the summaries do not clearly demonstrate all objectives, particularly the explicit reordering of measurement panels above appearance panels and the specific annotation button fix, making full verification challenging from the provided information.
Out of Scope Changes Check ✅ Passed All file modifications in this pull request directly support the stated objective of making the sidebar more intuitive. Changes span annotation controls (adding show/hide toggles), measurement tools (adding labels), UI styling (improving accepted filtering appearance, adjusting spacing), and menu structure (consolidating panel layout). No changes appear to introduce unrelated functionality or address objectives beyond those specified in issue #48.
Description Check ✅ Passed The pull request description follows the required template with all necessary sections completed. The Issue number section properly closes #48, the Description section provides a detailed bullet-point list of the seven specific changes made to improve sidebar intuitiveness, and the Testing steps section includes concrete test cases for reviewers. While screenshots are marked as optional and not included, this is acceptable per the template guidelines.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 48-make-sidebar-more-intuitive

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73059de and 1d5c5de.

📒 Files selected for processing (1)
  • src/Filter/filter.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Filter/filter.js

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbit coderabbit bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/MeasurementControl/measurementsPanel.js (1)

32-40: Fix critical null reference bug at line 668 and harden jQuery/accessibility.

Three issues confirmed:

  1. Critical null reference: Line 668 calls existingTools.querySelectorAll() outside the null-check block (line 640), causing TypeError if getElementById('tools') returns null.

  2. Unguarded jQuery: Lines 41, 43, 47 use $(menu) without checking if $ is defined; line 48 shows guard is used elsewhere, indicating inconsistent pattern. Risk: ReferenceError if jQuery not loaded globally.

  3. Missing accessibility: Wrapper divs (line 679) lack role="button", tabindex, aria-label, and keyboard handler—causing screenreader/keyboard navigation failures.

Icon filename map verified complete: all 11 assets exist in public/build/potree/resources/icons/.

Apply the suggested diff to:

  • Guard jQuery with window.jQuery || window.$ at lines 41–55
  • Null-guard existingTools.querySelectorAll() at lines 668–690
  • Add role, tabindex, aria-label, and keydown listener to wrapper divs
🧹 Nitpick comments (3)
src/potreeViewer.js (1)

260-303: Prototype monkey‑patching: limit blast radius.

Temporarily overriding Element.prototype.scrollIntoView and HTMLElement.prototype.focus can cause surprising behavior elsewhere. Consider a scoped workaround (e.g., CSS overscroll-behavior, guarding scroll in a single container, or temporarily setting scrollTop on the specific accordion container) instead of patching prototypes globally. If you keep this, add a unique flag to avoid nested patches and ensure restore on all paths.

src/MeasurementControl/measurementsPanel.css (1)

275-301: Add focus state for keyboard accessibility on clickable wrappers.

Wrappers are clickable; give them a visible focus style for keyboard users.

Apply:

 .tool-with-label:hover {
   box-shadow: 0 0 5px #fff8;
 }
 
+.tool-with-label:focus-visible {
+  outline: 2px solid #7ba8ff;
+  outline-offset: 2px;
+  box-shadow: 0 0 0 2px #7ba8ff44;
+}
+
 .tool-with-label:hover img {
   filter: brightness(1.7);
 }
src/AnnotationControl/annotationPanel.css (1)

400-400: Hardcoded black border inconsistent with theme.

Line 400 uses border: 1px solid black; which appears inconsistent with the rest of the color scheme (e.g., borders elsewhere use #555, #404a50, etc.). Consider using a theme-consistent color variable or hex value to maintain visual consistency.

  .toggle-group {
    display: flex;
    width: 265px;
-   border: 1px solid black;
+   border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4a0e8c and 1ead61b.

📒 Files selected for processing (7)
  • src/AcceptedFiltering/threePanels.css (2 hunks)
  • src/AcceptedFiltering/threePanels.js (1 hunks)
  • src/AnnotationControl/annotationPanel.css (2 hunks)
  • src/AnnotationControl/annotationPanel.js (2 hunks)
  • src/MeasurementControl/measurementsPanel.css (1 hunks)
  • src/MeasurementControl/measurementsPanel.js (2 hunks)
  • src/potreeViewer.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/potreeViewer.js (1)
src/AcceptedFiltering/threePanels.js (1)
  • $ (199-199)
🔇 Additional comments (2)
src/AcceptedFiltering/threePanels.js (1)

302-309: LGTM: clearer legend copy.

Explicit “Accepted points displayed as:” and “Not accepted points displayed as:” improves clarity and aligns with pills.

src/AnnotationControl/annotationPanel.css (1)

349-354: Class naming change is consistent and complete—no breaking selector updates needed.

Verification confirms the class name change from .pv-menu-list.annotations-panel to .pv-menu-list_annotations-panel is fully applied across the codebase with no orphaned references:

  • CSS definition (line 349) matches JavaScript references (lines 34, 74)
  • No old selector patterns exist anywhere in the repository
  • All three references use the new underscore-based naming consistently

Copy link

@coderabbit coderabbit bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/AnnotationControl/annotationPanel.css (1)

378-413: Adjust toggle UI border color and consider width flexibility.

Two minor issues with the new label toggle styling:

  1. Line 391 — Inconsistent border color: The .toggle-group uses border: 1px solid black; which is inconsistent with other borders in the file (e.g., #404a50, #555, #1px solid #555). Use a theme-appropriate gray instead.

  2. Line 390 — Hardcoded width: The width: 265px; is rigid and may cause layout issues on smaller viewports or if button labels change. Consider using a max-width with flexible sizing or ensuring the parent container allows responsive width adjustments.

Additionally, verify that the button color scheme (#a7a9aa, #3d3c3c, #c7c9ca) aligns with the overall design intent for this control.

Apply this diff to fix the border color consistency:

  .toggle-group {
    display: flex;
    width: 265px;
-   border: 1px solid black;
+   border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ead61b and be4bf5f.

📒 Files selected for processing (1)
  • src/AnnotationControl/annotationPanel.css (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-29T13:42:17.971Z
Learnt from: kleinc
PR: TDT4290-group-4/MolloyExplorer#52
File: src/AnnotationControl/annotationPanel.css:30-31
Timestamp: 2025-10-29T13:42:17.971Z
Learning: In src/AnnotationControl/annotationPanel.css, the .annotation-edit-textarea element intentionally has both background and color set to #636262, making the text invisible. This is the intended design per kleinc's preference.

Applied to files:

  • src/AnnotationControl/annotationPanel.css
📚 Learning: 2025-10-29T13:45:51.930Z
Learnt from: kleinc
PR: TDT4290-group-4/MolloyExplorer#52
File: src/AnnotationControl/annotationPanel.js:33-35
Timestamp: 2025-10-29T13:45:51.930Z
Learning: In src/AnnotationControl/annotationPanel.js, the panel className should be set to 'pv-menu-list_annotations-panel' only, without including the base 'pv-menu-list' class. This is intentional and correct.

Applied to files:

  • src/AnnotationControl/annotationPanel.css
🔇 Additional comments (2)
src/AnnotationControl/annotationPanel.css (2)

349-354: Verify annotation row width behavior with flex centering.

The parent container uses align-items: center; which horizontally centers all flex children. While this is appropriate for the fixed-width toggle button group and the 80%-width add button, ensure that annotation rows (.annotation-row) display at their intended width and don't collapse due to center alignment.


357-376: Button styling looks good.

The updated add button styling integrates well with the new flex-based panel layout. The color, sizing, and transition effects are consistent with the overall design. The display: block; behavior works correctly within the parent's flex centering context.

Copy link
Member

@adriahso adriahso left a comment

Choose a reason for hiding this comment

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

Looks much cleaner! Made some suggestions.

mariewah and others added 2 commits October 30, 2025 14:25
Add more padding

Co-authored-by: Adrian Haabpiht Solberg <adriahso@stud.ntnu.no>
Copy link

@coderabbit coderabbit bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/potreeViewer.js (1)

58-61: Consider removing these lines if panels are closed by default.

As suggested in previous feedback, if the panels are already closed by default, these lines may be unnecessary. Removing them would simplify the code and avoid the unguarded jQuery usage.

-    $('#menu_appearance').next().hide()
-    $('#menu_tools').next().hide()
-    $('#menu_scene').next().hide()
-    $('#menu_filters').remove()
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 385185c and 891daef.

📒 Files selected for processing (3)
  • src/Filter/filter.css (2 hunks)
  • src/Filter/filter.js (1 hunks)
  • src/potreeViewer.js (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-29T13:42:17.971Z
Learnt from: kleinc
Repo: TDT4290-group-4/MolloyExplorer PR: 52
File: src/AnnotationControl/annotationPanel.css:30-31
Timestamp: 2025-10-29T13:42:17.971Z
Learning: In src/AnnotationControl/annotationPanel.css, the .annotation-edit-textarea element intentionally has both background and color set to #636262, making the text invisible. This is the intended design per kleinc's preference.

Applied to files:

  • src/Filter/filter.css
  • src/potreeViewer.js
📚 Learning: 2025-10-29T13:45:51.930Z
Learnt from: kleinc
Repo: TDT4290-group-4/MolloyExplorer PR: 52
File: src/AnnotationControl/annotationPanel.js:33-35
Timestamp: 2025-10-29T13:45:51.930Z
Learning: In src/AnnotationControl/annotationPanel.js, the panel className should be set to 'pv-menu-list_annotations-panel' only, without including the base 'pv-menu-list' class. This is intentional and correct.

Applied to files:

  • src/potreeViewer.js
🧬 Code graph analysis (1)
src/potreeViewer.js (1)
src/Filter/filter.js (1)
  • $ (202-202)
🔇 Additional comments (2)
src/Filter/filter.js (1)

304-313: LGTM! Clear legend labels improve usability.

The descriptive text before each color indicator makes the legend more intuitive and accessible, aligning well with the PR objective to improve filter clarity.

src/Filter/filter.css (1)

1-134: LGTM! CSS updates enhance visual consistency.

The styling changes improve the filter UI with centered button alignment, pill-shaped legend indicators, consistent text colors, and proper spacing. These updates support the PR's goal of making the sidebar more intuitive and visually polished.

Copy link
Member

@adriahso adriahso left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@franmagn franmagn left a comment

Choose a reason for hiding this comment

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

LGTM!

@kleinc kleinc merged commit 0016d6d into dev Nov 3, 2025
2 checks passed
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sidebar more intuitive
4 participants