Skip to content

feat: Implement interactive popup dragging and resizing #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sabry-awad97
Copy link

This commit introduces interactive dragging and resizing functionality to the tui-popup crate.

Changes include:

  • Added an interactive example demonstrating the new features.
  • Updated PopupState to manage interaction state (dragging and resizing).
  • Modified Popup widget to render a resize handle.
  • Implemented mouse event handling for dragging and resizing.
  • Added constraints to keep the popup within terminal bounds and enforce minimum size.

These changes allow users to interactively reposition and resize popups within the terminal, improving the user experience.

Sabry Awad added 2 commits March 1, 2025 03:42
This commit introduces interactive dragging and resizing functionality to the `tui-popup` crate.

Changes include:

- Added an `interactive` example demonstrating the new features.
- Updated `PopupState` to manage interaction state (dragging and resizing).
- Modified `Popup` widget to render a resize handle.
- Implemented mouse event handling for dragging and resizing.
- Added constraints to keep the popup within terminal bounds and enforce minimum size.

These changes allow users to interactively reposition and resize popups within the terminal, improving the user experience.
This commit introduces several enhancements to the `tui-popup` crate, focusing on improved user interaction and visual feedback:

- Add a resize handle to the popup, allowing users to resize it by dragging.
- Implement mouse event handling for dragging and resizing the popup.
- Introduce `move_to_*` methods in `PopupState` to allow moving the popup to specific screen edges.
- Enhance the resize handle with hover effects for improved visual feedback.
- Fix: Correctly clamp resize values to terminal size and minimum dimensions.
- Fix: Address issue where resize handle wasn't being correctly styled.
- Add Ctrl+Arrow keybindings to move popup to screen edges in state example.
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 76.28458% with 60 lines in your changes missing coverage. Please review.

Project coverage is 72.28%. Comparing base (cad0d3e) to head (e322341).

Files with missing lines Patch % Lines
tui-popup/src/popup_state.rs 78.01% 42 Missing ⚠️
tui-popup/src/popup.rs 70.96% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   71.51%   72.28%   +0.76%     
==========================================
  Files          15       15              
  Lines        2503     2742     +239     
==========================================
+ Hits         1790     1982     +192     
- Misses        713      760      +47     

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

Sabry Awad and others added 2 commits March 1, 2025 08:57
This commit introduces several enhancements to the interactive popup example and the `tui-popup` crate:

- Adds keyboard controls for moving the popup using arrow keys or hjkl, with Ctrl+Arrow for jumping to edges.
- Implements a help popup that displays keyboard shortcuts, toggled with the '?' key.
- Implements a reset position function to move the popup to the default position.
- Adds a status bar to display the popup's position and mode (Normal/Help).
- Implements a close button on the popup title bar.
- Refactors the example code for better readability and structure.
- Fixes and improves the rendering tests.

These changes improve the user experience by providing alternative input methods and making the popup more informative and easier to use.
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.

2 participants