Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 17, 2025

The ColorSelector popup in the Graph Editor toolbar was getting clipped when positioned near the left edge of the window, making part of the color palette inaccessible to users.

Problem

The original positioning logic always placed the popup to the left of the button using hardcoded coordinates:

// Original positioning (problematic)
y: -height
x: -width + root.width + padding

This caused the popup to extend beyond the window boundary when the ColorSelector button was positioned near the left edge, as shown in the issue screenshot.

Solution

Implemented smart positioning logic that:

  1. Calculates available space on both left and right sides of the button using mapToItem()
  2. Prioritizes left positioning (maintains backward compatibility) when sufficient space is available (≥132px required)
  3. Falls back to right positioning when left space is insufficient but right space is adequate
  4. Minimizes clipping in extreme cases by choosing the side with more available space

Key Features

  • Backward Compatible: Preserves original left positioning when space allows
  • Responsive: Adapts automatically to different window sizes and button positions
  • Robust: Handles edge cases like very small windows gracefully
  • Performance: Lightweight calculations cached by QML's property binding system

Visual Impact

Before: Popup clipped on left side, hiding color options from users
After: Popup automatically repositions to stay within window bounds, ensuring full accessibility

The fix maintains the original user experience in normal cases while eliminating the clipping issue that affected users with smaller windows or specific toolbar positioning.

Fixes #2814.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [bug] Graph: Color selector not fully in Meshroom window Fix ColorSelector popup positioning to prevent window clipping Aug 17, 2025
@Copilot Copilot AI requested a review from fabiencastan August 17, 2025 22:48
Copilot finished work on behalf of fabiencastan August 17, 2025 22:48
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.46%. Comparing base (0362aab) to head (f9ad941).
⚠️ Report is 169 commits behind head on develop.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2832   +/-   ##
========================================
  Coverage    77.46%   77.46%           
========================================
  Files           48       48           
  Lines         6735     6735           
========================================
  Hits          5217     5217           
  Misses        1518     1518           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cbentejac
Copy link
Contributor

Issue fixed in #2871.

@cbentejac cbentejac closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Graph: Color selector not fully in Meshroom window
3 participants