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

Pairwise dragging #67

Merged
merged 3 commits into from
Oct 12, 2024
Merged

Pairwise dragging #67

merged 3 commits into from
Oct 12, 2024

Conversation

julienvincent
Copy link
Owner

This adds two new APIs - drag_pair_forwards and its companion drag_pair_backwards which allow dragging 'pairs' of elements within a form.

An easy example is the key-value pairs within a map which typically are meant to stay together when reordering.

This can, however, be used for any form. This means if you have some vector containing logical pairs (because of the actual semantics of your code) you can use a dedicated keybinding to drag them around together.

This change also introduces a new config option at:

dragging.auto_drag_pairs = true|false

which will alter the behaviour of the existing drag_element_forwards and drag_element_backwards APIs in order to try infer whether they are contained within a node that is made up of pairs.

For example if this setting is true and a drag_element_forwards is used on the keys of a map then they will be dragged pairwise.

This new config option defaults to true under the assumption that this is generally the desired behaviour.

@julienvincent julienvincent force-pushed the jv/pairwise-dragging branch 4 times, most recently from 6bf71ba to 090f202 Compare October 12, 2024 13:21
This adds two new APIs - `drag_pair_forwards` and its companion
`drag_pair_backwards` which allow dragging 'pairs' of elements within a
form.

An easy example is the key-value pairs within a map which typically are
meant to stay together when reordering.

This can, however, be used for any form. This means if you have some
vector containing logical pairs (because of the actual semantics of your
code) you can use a dedicated keybinding to drag them around together.

This change also introduces a new config option at:

`dragging.auto_drag_pairs = true|false`

which will alter the behaviour of the existing `drag_element_forwards`
and `drag_element_backwards` APIs in order to try infer whether they are
contained within a node that is made up of pairs.

For example if this setting is `true` and a `drag_element_forwards` is
used on the keys of a map then they will be dragged pairwise.

This new config option defaults to `true` under the assumption that this
is generally the desired behaviour.
@julienvincent julienvincent merged commit 89d504c into master Oct 12, 2024
3 checks passed
@julienvincent julienvincent deleted the jv/pairwise-dragging branch October 12, 2024 13:25
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.

1 participant