Fix stale keyboard refresh and auto-resize flicker of speed profile window in Preview tab #381

Open
opened 2026-04-05 16:20:27 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @kisslorand on 3/9/2026

Summary

This improves the behavior of the “Actual speed profile” popup shown in the Preview tab.

Two user-visible issues could occur:
• Keyboard navigation could update the slider without immediately refreshing the popup.
• The popup could briefly appear at the wrong height before correcting itself (flickering).

Problem

When the speed profile popup was visible in Preview:

  • Moving through the toolpath using keyboard keys (left/right/home/end) could sometimes update the internal state but not immediately refresh the display. The popup would only update after another input event (for example mouse movement).

  • The popup could also visibly resize in two steps when it appeared or when its content changed. First it was drawn with a temporary height, then immediately redrawn with the correct height.

This created a small but noticeable visual flicker.

Solution

Two improvements were implemented.

Immediate refresh for keyboard navigation

Keyboard slider interaction now explicitly schedules a follow-up frame.
This ensures the display updates immediately when navigating with the keyboard, without requiring any mouse activity.

Stable popup sizing

The popup size is now calculated before it is drawn.

Instead of relying on automatic resizing after rendering, the height is computed from the popup contents (the speed graph and the table rows).
The popup is also kept at least as tall as the adjacent information panel so the two panels stay visually aligned.

The popup width is calculated from the table header text and layout spacing so translated UI text fits correctly.

To keep the speed graph visually balanced, the window also enforces a minimum width derived from a 16:9 aspect ratio for the graph area.
This ratio applies to the graph itself, not the entire popup layout.

The width is cached to avoid recalculating it every frame. It is recalculated only when the UI scale changes.

Result

Users should see the following improvements:

  • Keyboard navigation updates the speed profile immediately.
  • The popup no longer briefly appears with an incorrect height (no flicker).
  • Popup size is more stable and consistent across UI scale changes and different languages.

These changes only affect the speed profile popup in Preview.
The fix addresses the Point 1. Part II. of #12684

Note:
No screenshot is included because static images cannot capture these improvements.
The changes affect interaction timing and popup resizing behavior, which are only visible while navigating the toolpath in Preview.

I don't have the tools nor experience to record and edit a short demonstration video.
Fortunately the behavior is easy to reproduce locally by opening Preview, enabling the speed profile popup, and navigating the toolpath with the keyboard.

Addendum

ToolPosition window had the same width refresh issue on slider navigation by keyboard. If width needed to change it changed only on next frame (mouse move, next slider move) resulting in truncated text or larger width than necessary.
It is also addressed in this PR by the same size pre-calculation method thus not needing extra frame for being refreshed.

*Originally created by @kisslorand on 3/9/2026* ## Summary This improves the behavior of the “Actual speed profile” popup shown in the Preview tab. Two user-visible issues could occur: • Keyboard navigation could update the slider without immediately refreshing the popup. • The popup could briefly appear at the wrong height before correcting itself (flickering). ## Problem When the speed profile popup was visible in Preview: - Moving through the toolpath using keyboard keys (left/right/home/end) could sometimes update the internal state but not immediately refresh the display. The popup would only update after another input event (for example mouse movement). - The popup could also visibly resize in two steps when it appeared or when its content changed. First it was drawn with a temporary height, then immediately redrawn with the correct height. This created a small but noticeable visual flicker. ## Solution Two improvements were implemented. ### Immediate refresh for keyboard navigation Keyboard slider interaction now explicitly schedules a follow-up frame. This ensures the display updates immediately when navigating with the keyboard, without requiring any mouse activity. ### Stable popup sizing The popup size is now calculated before it is drawn. Instead of relying on automatic resizing after rendering, the height is computed from the popup contents (the speed graph and the table rows). The popup is also kept at least as tall as the adjacent information panel so the two panels stay visually aligned. The popup width is calculated from the table header text and layout spacing so translated UI text fits correctly. To keep the **speed graph** visually balanced, the window also enforces a minimum width derived from a **16:9 aspect ratio for the graph area**. This ratio applies to the graph itself, not the entire popup layout. The width is cached to avoid recalculating it every frame. It is recalculated only when the UI scale changes. ## Result Users should see the following improvements: - Keyboard navigation updates the speed profile immediately. - The popup no longer briefly appears with an incorrect height (no flicker). - Popup size is more stable and consistent across UI scale changes and different languages. These changes only affect the speed profile popup in Preview. The fix addresses the Point 1. Part II. of #12684 > Note: > No screenshot is included because static images cannot capture these improvements. > The changes affect interaction timing and popup resizing behavior, which are only visible while navigating the toolpath in Preview. > > I don't have the tools nor experience to record and edit a short demonstration video. > Fortunately the behavior is easy to reproduce locally by opening Preview, enabling the speed profile popup, and navigating the toolpath with the keyboard. ## Addendum ToolPosition window had the same width refresh issue on slider navigation by keyboard. If width needed to change it changed only on next frame (mouse move, next slider move) resulting in truncated text or larger width than necessary. It is also addressed in this PR by the same size pre-calculation method thus not needing extra frame for being refreshed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#381