Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
reorder_list.hpp File Reference

Drag-to-reorder container. More...

#include <pulp/canvas/canvas.hpp>
#include <pulp/view/animation.hpp>
#include <pulp/view/geometry.hpp>
#include <pulp/view/view.hpp>
#include <functional>
#include <memory>
#include <vector>

Go to the source code of this file.

Classes

class  pulp::view::ReorderList
 Single-axis drag-to-reorder container. More...

Namespaces

namespace  pulp
namespace  pulp::view
 Hover-cursor tracking for platform window hosts.

Functions

int pulp::view::reorder_target_index (int from, float offset, float pitch, int count)
 Target index for a drag that started on item from, moved offset along the main axis, over a list of count items spaced pitch apart.

Detailed Description

Drag-to-reorder container.

A faithful port re-rolls the same interaction every time it has a rack of effect slots, a modulation list, or a preset order: pick a row up, slide the neighbours aside to open a gap, drop it into a new slot, and commit the new order. ReorderList packages that once — a single-axis (vertical or horizontal) container of fixed-pitch items where the user drags an item to a new index; on drop it permutes the display order, settles the lifted item with a drop tween (reusing View::animate), flashes a landing glow, and fires on_reorder(from, to).

The index arithmetic (reorder_target_index) is a pure function of the drag offset, the item pitch, and the count, so the reorder decision is unit-testable headlessly without a window or a frame clock.