Skip to content
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

[Feature] Pane Grid: drag & drop panes to the edges #1865

Merged
merged 6 commits into from
Jul 6, 2023

Conversation

jhff
Copy link
Contributor

@jhff jhff commented May 22, 2023

Summary

Previously, in order to create a new column or row on a PaneGrid, a client would necessarily have to create and remove panes, as it was only able to split existing panes.

Following #1856, this change adds the ability to drag & drop panes of a PaneGrid to its edges in order to enhance even more an easy layout customisation of the grid.

Implementation

DragEvent::Dropped instead of Pane and Region parameters, now holds a Target that can either be Target::PaneGrid (new variant, that wraps an Edge) or Target::Pane (which holds the previous parameters).

Users of PaneGrid can call pane_grid::State::move_to_edge(pane, edge) in order to create a new row/column depending on the edge with that pane's state. This will split the major Node of the grid in order to create said row/column.

Hovered PaneGrid edges are detected and highlighted with the minimum thickness of either the total grid height or width ratio of 1/25. I feel it is a good balance after some experimentation, but I'm up to change this.

Demo

pane_grid_edges.mov

@hecrj hecrj added feature New feature or request widget labels May 23, 2023
@hecrj hecrj added this to the 0.10.0 milestone May 23, 2023
@hecrj hecrj force-pushed the pane_grid_edge_with_dragged_pane branch from dc82ab9 to c5a623f Compare July 6, 2023 05:58
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Awesome stuff! Thanks 🥳

Made some very minor changes here and there and added a new drop helper method to State.

Let's ship this! 🚢

@hecrj hecrj enabled auto-merge July 6, 2023 05:59
@hecrj hecrj merged commit fb512c3 into iced-rs:master Jul 6, 2023
9 checks passed
@tarkah tarkah mentioned this pull request Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants