views: drag from empty space to select with a box
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b31ef87235
commit
39ed73cf5d
11 changed files with 301 additions and 2 deletions
|
|
@ -91,7 +91,7 @@ Never modify: `PROMPT.md` (the user's brief), the user's other projects under `~
|
|||
| `cargo run -p tunal -- --gallery --page menu\|dialog --screenshot <png> [--dark] --size 960x640` | open menu + submenu + two toasts, or dialog + indeterminate toast, over a stand-in folder | S005 |
|
||||
| `TUNAL_SETTINGS=<0-7> cargo run -p tunal -- <dir> --screenshot <png> --size 1000x700` (`XDG_CONFIG_HOME=<scratch>`) | settings dialog page over a folder (6 Mouse, 7 Shortcuts); add `TUNAL_KEYS=<command id>:<chord>` to record that chord on the Shortcuts page (a taken chord shows the conflict row) | S013 |
|
||||
| `TUNAL_DRAG=x1,y1,x2,y2[,hold] TUNAL_REDUCED_MOTION=1 cargo run -p tunal -- <dir> --screenshot <png> --size 1200x760` (`XDG_CONFIG_HOME=<scratch>`) | drags between window points and drops (drop menu) or holds (glow + drag image) before the frame | S014 |
|
||||
| `Xvfb :97 &` then `env -u WAYLAND_DISPLAY DISPLAY=:97 target/debug/tunal <dir> &` and `DISPLAY=:97 target/debug/examples/xdnd_probe x1 y1 x2 y2` (or `in x y <uri>`) | X11 native DnD: fake XTEST drag out of the window onto a probe target, or a probe source dropping into the app; Xvfb only. Also `xdnd_probe click x y [count] [gap_ms] [hover_ms] [button]` (2 = middle) and `xdnd_probe key ctrl+t f3 alt+2 …` (focuses the window under the pointer, then presses each chord); screenshot with `import -window root <png>` | S031 |
|
||||
| `Xvfb :97 &` then `env -u WAYLAND_DISPLAY DISPLAY=:97 target/debug/tunal <dir> &` and `DISPLAY=:97 target/debug/examples/xdnd_probe x1 y1 x2 y2` (or `in x y <uri>`) | X11 native DnD: fake XTEST drag out of the window onto a probe target, or a probe source dropping into the app; Xvfb only. Also `xdnd_probe click x y [count] [gap_ms] [hover_ms] [button]` (2 = middle) and `xdnd_probe key ctrl+t f3 alt+2 …` (focuses the window under the pointer, then presses each chord), `xdnd_probe press x1 y1 x2 y2 [hold_ms]` (plain left drag, e.g. a selection box; screenshot while it holds); screenshot with `import -window root <png>` | S031 |
|
||||
| same, with `SLINT_BACKEND=winit-software` (so `DISPLAY=:97 import -window root <png>` captures it), then `DISPLAY=:97 target/debug/examples/xdnd_probe click x y [count] [gap_ms] [hover_ms]` | real clicks (XTEST) on a window point after resting `hover_ms` there, e.g. the split toggle with a tooltip showing; Xvfb only | split/tooltip fix |
|
||||
| `TUNAL_APPEARANCE=1 XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- <dir> --screenshot <png> --size 1000x760` | folder appearance dialog for `<dir>` (theme icons looked up at once); `cargo run -p tunal-dirmeta --example roundtrip -- <dir>` sets `Icon` in `<dir>/.directory` and prints the old values | S015 |
|
||||
| `TUNAL_PLAY=<audio file> XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- <dir> --screenshot <png> [--dark] --size 1200x760` (`TUNAL_PLAY_STATE=playing` draws it playing: the wave) | player bar open on that file, a third in (tags, cover, length read at once; no audio output), paused unless asked | S023 |
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
//!
|
||||
//! `xdnd_probe key ctrl+shift+t f3 alt+2 …`: presses each chord in turn (XTEST), 300 ms
|
||||
//! apart; letters, digits, `f1`–`f12` and the modifiers `ctrl`, `shift`, `alt`.
|
||||
//!
|
||||
//! `xdnd_probe press x1 y1 x2 y2 [hold_ms]`: a plain left-button drag (no drop target) from
|
||||
//! (x1, y1) to (x2, y2), held `hold_ms` (default 0) before the release; a selection box.
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
|
@ -44,6 +47,9 @@ fn main() {
|
|||
if std::env::args().nth(1).as_deref() == Some("key") {
|
||||
return keys();
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("press") {
|
||||
return press();
|
||||
}
|
||||
let n: Vec<i16> = std::env::args()
|
||||
.skip(1)
|
||||
.filter_map(|a| a.parse().ok())
|
||||
|
|
@ -371,3 +377,36 @@ fn drag_in() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn press() {
|
||||
let n: Vec<i16> = std::env::args()
|
||||
.skip(2)
|
||||
.filter_map(|a| a.parse().ok())
|
||||
.collect();
|
||||
let (x1, y1, x2, y2, hold) = match n[..] {
|
||||
[a, b, c, d] => (a, b, c, d, 0),
|
||||
[a, b, c, d, h] => (a, b, c, d, h),
|
||||
_ => {
|
||||
eprintln!("usage: xdnd_probe press x1 y1 x2 y2 [hold_ms]");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let (c, screen) = x11rb::connect(None).unwrap();
|
||||
let root = c.setup().roots[screen].root;
|
||||
let motion = |x: i16, y: i16| {
|
||||
c.xtest_fake_input(6, 0, CURRENT_TIME, root, x, y, 0)
|
||||
.unwrap();
|
||||
c.get_input_focus().unwrap().reply().unwrap();
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
};
|
||||
motion(x1, y1);
|
||||
c.xtest_fake_input(4, 1, CURRENT_TIME, root, 0, 0, 0)
|
||||
.unwrap();
|
||||
for step in 1..=20 {
|
||||
motion(x1 + (x2 - x1) * step / 20, y1 + (y2 - y1) * step / 20);
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(hold.max(0) as u64));
|
||||
c.xtest_fake_input(5, 1, CURRENT_TIME, root, 0, 0, 0)
|
||||
.unwrap();
|
||||
c.get_input_focus().unwrap().reply().unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,8 @@ struct State {
|
|||
selected: HashSet<Vec<u8>>,
|
||||
cursor: Option<Vec<u8>>,
|
||||
anchor: Option<Vec<u8>>,
|
||||
/// The selection a selection box started from.
|
||||
band_base: HashSet<Vec<u8>>,
|
||||
watches: Vec<Watch>,
|
||||
/// List motion of the rows, parallel to `rows` (empty when still), and its clock.
|
||||
anim: Vec<Anim>,
|
||||
|
|
@ -236,6 +238,7 @@ impl FolderModel {
|
|||
playlists: Vec::new(),
|
||||
playlist_path: None,
|
||||
selected: HashSet::new(),
|
||||
band_base: HashSet::new(),
|
||||
cursor: None,
|
||||
anchor: None,
|
||||
watches: Vec::new(),
|
||||
|
|
@ -1212,6 +1215,53 @@ impl FolderModel {
|
|||
});
|
||||
}
|
||||
|
||||
/// The selection box covers columns `cols` (fractions, cell or row widths from the first)
|
||||
/// and content heights `ys`: its entries join the selection it started from (`add`: flip
|
||||
/// in it). `start` begins a new box.
|
||||
pub fn band(&self, cols: (f32, f32), ys: (f32, f32), add: bool, start: bool) {
|
||||
let rows: Vec<usize> = {
|
||||
let s = self.state.borrow();
|
||||
let view = s.previews.viewport;
|
||||
let hits = |c: usize| (c as f32) < cols.1 && (c + 1) as f32 > cols.0;
|
||||
let mut rows = Vec::new();
|
||||
let mut top = 0.0;
|
||||
if s.settings.mode == ViewMode::Grid {
|
||||
for line in motion::grid(&headers(&s), &[], s.columns).0 {
|
||||
let height = if line.header { view.row } else { view.cell };
|
||||
if !line.header && top < ys.1 && top + height > ys.0 {
|
||||
let start = line.start.max(0) as usize;
|
||||
rows.extend(
|
||||
(0..line.count.max(0) as usize)
|
||||
.filter(|c| hits(*c))
|
||||
.map(|c| start + c),
|
||||
);
|
||||
}
|
||||
top += height;
|
||||
}
|
||||
} else if hits(0) && view.row > 0.0 {
|
||||
let first = (ys.0 / view.row).floor().max(0.0) as usize;
|
||||
let last = (ys.1 / view.row).floor().max(0.0) as usize;
|
||||
rows.extend(first..=last.min(s.rows.len().saturating_sub(1)));
|
||||
}
|
||||
rows
|
||||
};
|
||||
let names: HashSet<Vec<u8>> = rows.into_iter().filter_map(|r| self.name_at(r)).collect();
|
||||
self.select(|s| {
|
||||
if start {
|
||||
s.band_base = if add {
|
||||
s.selected.clone()
|
||||
} else {
|
||||
HashSet::new()
|
||||
};
|
||||
}
|
||||
s.selected = if add {
|
||||
s.band_base.symmetric_difference(&names).cloned().collect()
|
||||
} else {
|
||||
&s.band_base | &names
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
pub fn select_all(&self) {
|
||||
self.select(|s| {
|
||||
let names: Vec<Vec<u8>> = s.row_of.keys().cloned().collect();
|
||||
|
|
|
|||
|
|
@ -1110,6 +1110,12 @@ impl Shell {
|
|||
}
|
||||
);
|
||||
on_pane!(on_select_all, |_s, p| p.model.select_all());
|
||||
on_pane!(on_band_selected, |s, p, c1, y1, c2, y2, add, start| {
|
||||
p.model.band((c1, c2), (y1, y2), add, start);
|
||||
if let Some(ui) = s.ui.upgrade() {
|
||||
ui.set_status(status(&p).into());
|
||||
}
|
||||
});
|
||||
on_pane!(on_grid_columns_changed, |_s, p, n| p
|
||||
.model
|
||||
.set_columns(n.max(1) as usize));
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ export component MainWindow inherits Window {
|
|||
callback toggle-previews(int);
|
||||
callback viewport-changed(int, length, length, length, length);
|
||||
callback row-clicked(int, int, bool, bool);
|
||||
callback band-selected(int, float, length, float, length, bool, bool);
|
||||
callback row-activated(int, int);
|
||||
callback select-all(int);
|
||||
callback clear-selection(int);
|
||||
|
|
@ -627,6 +628,9 @@ export component MainWindow inherits Window {
|
|||
row-clicked(row, ctrl, shift) => {
|
||||
root.row-clicked(i, row, ctrl, shift);
|
||||
}
|
||||
band(c1, y1, c2, y2, add, start) => {
|
||||
root.band-selected(i, c1, y1, c2, y2, add, start);
|
||||
}
|
||||
row-activated(row) => {
|
||||
root.row-activated(i, row);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ export component Pane inherits Rectangle {
|
|||
callback rename-cancelled();
|
||||
callback context-menu(int, length, length);
|
||||
callback viewport-changed(length, length, length, length);
|
||||
callback band(float, length, float, length, bool, bool);
|
||||
|
||||
// The view keeps the focus away from a name being edited.
|
||||
public function focus-view() {
|
||||
|
|
@ -68,7 +69,32 @@ export component Pane inherits Rectangle {
|
|||
radius: root.border-radius;
|
||||
|
||||
touch := TouchArea {
|
||||
// A drag from empty space draws the selection box (Ctrl or Shift adds to the
|
||||
// selection); its release is no click.
|
||||
property <bool> banding;
|
||||
property <bool> banded;
|
||||
property <bool> add;
|
||||
moved => {
|
||||
if !self.pressed {
|
||||
return;
|
||||
}
|
||||
let ax = self.absolute-position.x + self.mouse-x;
|
||||
let ay = self.absolute-position.y + self.mouse-y;
|
||||
if self.banding {
|
||||
details.band-to(ax, ay, self.add, false);
|
||||
} else if !self.banded && (abs(self.mouse-x - self.pressed-x) > Theme.drag-slop || abs(self.mouse-y - self.pressed-y) > Theme.drag-slop) {
|
||||
self.banded = true;
|
||||
root.activated();
|
||||
self.banding = details.band-to(self.absolute-position.x + self.pressed-x, self.absolute-position.y + self.pressed-y, self.add, true);
|
||||
if self.banding {
|
||||
details.band-to(ax, ay, self.add, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
clicked => {
|
||||
if self.banded {
|
||||
return;
|
||||
}
|
||||
root.activated();
|
||||
root.focus-view();
|
||||
}
|
||||
|
|
@ -76,6 +102,15 @@ export component Pane inherits Rectangle {
|
|||
FolderActions.empty-double-clicked(root.index);
|
||||
}
|
||||
pointer-event(event) => {
|
||||
if event.button == PointerEventButton.left && event.kind == PointerEventKind.down {
|
||||
self.banded = false;
|
||||
self.add = event.modifiers.control || event.modifiers.shift;
|
||||
}
|
||||
if event.button == PointerEventButton.left && event.kind == PointerEventKind.up && self.banding {
|
||||
self.banding = false;
|
||||
details.band-end();
|
||||
root.focus-view();
|
||||
}
|
||||
if event.button == PointerEventButton.right && event.kind == PointerEventKind.down {
|
||||
root.activated();
|
||||
root.context-menu(-1, self.absolute-position.x + self.mouse-x, self.absolute-position.y + self.mouse-y);
|
||||
|
|
@ -134,6 +169,9 @@ export component Pane inherits Rectangle {
|
|||
viewport-changed(top, height, row, cell) => {
|
||||
root.viewport-changed(top, height, row, cell);
|
||||
}
|
||||
band(c1, y1, c2, y2, add, start) => {
|
||||
root.band(c1, y1, c2, y2, add, start);
|
||||
}
|
||||
row-renamed(row, text) => {
|
||||
root.row-renamed(row, text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ export global Theme {
|
|||
|
||||
// Hairline borders.
|
||||
out property <length> hairline: 1px;
|
||||
// Pointer travel before a press on empty space becomes a selection box.
|
||||
out property <length> drag-slop: 4px;
|
||||
// The most a selection box scrolls its list per pointer move past an edge.
|
||||
out property <length> band-scroll: 24px;
|
||||
|
||||
// Floating surfaces (menus, dialogs, toasts, tooltips): one soft shadow, mixed from
|
||||
// `shadow`. Resting surfaces have none except the content card's faint lift.
|
||||
|
|
|
|||
|
|
@ -413,6 +413,71 @@ export component FolderMessages inherits Rectangle {
|
|||
|
||||
// The details view of one folder: column header, filter chip, virtualized rows and the
|
||||
// loading/empty/error states. It owns the keyboard: arrows move the cursor, typing filters.
|
||||
// The selection box dragged from empty space, over a list scrolled by `scroll`. The owner
|
||||
// passes the drag in window coordinates; the box reports it in content coordinates, with x
|
||||
// as columns (`(x - first-column) / column-width`).
|
||||
export component BandBox inherits Rectangle {
|
||||
// The list's top left in the window, its scroll offset (content-y) and its visible size.
|
||||
in property <length> origin-x;
|
||||
in property <length> origin-y;
|
||||
in property <length> scroll;
|
||||
in property <length> view-width;
|
||||
in property <length> view-height;
|
||||
in property <length> first-column;
|
||||
in property <length> column-width;
|
||||
// Corners in content coordinates (columns for x); `start` begins a new box.
|
||||
callback changed-box(c1: float, y1: length, c2: float, y2: length, add: bool, start: bool);
|
||||
|
||||
property <bool> shown;
|
||||
property <bool> add;
|
||||
property <length> x0;
|
||||
property <length> y0;
|
||||
property <length> x1;
|
||||
property <length> y1;
|
||||
|
||||
// Starts (`start`) or moves the box to the window point (ax, ay); false when a start point
|
||||
// is outside the list.
|
||||
public function drag(ax: length, ay: length, add: bool, start: bool) -> bool {
|
||||
let x = ax - root.origin-x;
|
||||
let y = ay - root.origin-y;
|
||||
if start {
|
||||
if x < 0 || y < 0 || x > root.view-width || y > root.view-height {
|
||||
return false;
|
||||
}
|
||||
root.add = add;
|
||||
root.x0 = x;
|
||||
root.y0 = y - root.scroll;
|
||||
}
|
||||
root.shown = true;
|
||||
root.x1 = max(0px, min(root.view-width, x));
|
||||
root.y1 = y - root.scroll;
|
||||
root.changed-box(
|
||||
(min(root.x0, root.x1) - root.first-column) / root.column-width,
|
||||
min(root.y0, root.y1),
|
||||
(max(root.x0, root.x1) - root.first-column) / root.column-width,
|
||||
max(root.y0, root.y1),
|
||||
root.add, start);
|
||||
true
|
||||
}
|
||||
|
||||
public function stop() {
|
||||
root.shown = false;
|
||||
}
|
||||
|
||||
// Drawn clipped to what is in view.
|
||||
property <length> top: max(0px, min(root.y0, root.y1) + root.scroll);
|
||||
property <length> bottom: min(root.view-height, max(root.y0, root.y1) + root.scroll);
|
||||
visible: root.shown;
|
||||
x: min(root.x0, root.x1);
|
||||
y: root.top;
|
||||
width: abs(root.x1 - root.x0);
|
||||
height: max(0px, root.bottom - root.top);
|
||||
background: Theme.primary.with-alpha(Theme.state-drag);
|
||||
border-width: Theme.hairline;
|
||||
border-color: Theme.primary;
|
||||
border-radius: Theme.corner-xs;
|
||||
}
|
||||
|
||||
export component DetailsView inherits Rectangle {
|
||||
in property <[DetailRow]> rows;
|
||||
in property <FolderState> state;
|
||||
|
|
@ -444,6 +509,8 @@ export component DetailsView inherits Rectangle {
|
|||
callback context-menu(int, length, length);
|
||||
// What is in view (top, height) and the row and cell heights, for the previews.
|
||||
callback viewport-changed(length, length, length, length);
|
||||
// The selection box, in content coordinates (see BandBox).
|
||||
callback band(c1: float, y1: length, c2: float, y2: length, add: bool, start: bool);
|
||||
// This pane's index in the tab, for drag and drop.
|
||||
in property <int> pane;
|
||||
|
||||
|
|
@ -457,6 +524,25 @@ export component DetailsView inherits Rectangle {
|
|||
keys.focus();
|
||||
}
|
||||
|
||||
// A drag from empty space at the window point (ax, ay); false when it didn't start in the
|
||||
// list. Past the top or bottom edge the list scrolls along.
|
||||
public function band-to(ax: length, ay: length, add: bool, start: bool) -> bool {
|
||||
if !start {
|
||||
let over = ay - list.absolute-position.y;
|
||||
let room = list.content-height - list.visible-height;
|
||||
if over < 0 {
|
||||
list.content-y = min(0px, list.content-y - max(over, -Theme.band-scroll));
|
||||
} else if over > list.visible-height && room > 0 {
|
||||
list.content-y = max(-room, list.content-y - min(over - list.visible-height, Theme.band-scroll));
|
||||
}
|
||||
}
|
||||
band.drag(ax, ay, add, start)
|
||||
}
|
||||
|
||||
public function band-end() {
|
||||
band.stop();
|
||||
}
|
||||
|
||||
// Scrolls just enough to show `row`.
|
||||
function reveal(row: int) {
|
||||
if row < 0 {
|
||||
|
|
@ -743,6 +829,19 @@ export component DetailsView inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
band := BandBox {
|
||||
origin-x: list.absolute-position.x;
|
||||
origin-y: list.absolute-position.y;
|
||||
scroll: list.content-y;
|
||||
view-width: list.visible-width;
|
||||
view-height: list.visible-height;
|
||||
first-column: Columns.inset;
|
||||
column-width: list.visible-width - 2 * Columns.inset;
|
||||
changed-box(c1, y1, c2, y2, add, start) => {
|
||||
root.band(c1, y1, c2, y2, add, start);
|
||||
}
|
||||
}
|
||||
|
||||
FolderMessages {
|
||||
state: root.state;
|
||||
row-count: root.rows.length;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { RenameField } from "../components/rename-field.slint";
|
|||
import { IconButton } from "../components/icon-button.slint";
|
||||
import {
|
||||
Columns, DetailRow, FilterChip, FolderActions, FolderKeys, FolderMessages, FolderState, HeaderCell, NavKey,
|
||||
SortColumn,
|
||||
BandBox, SortColumn,
|
||||
} from "details-view.slint";
|
||||
import { Dnd, DropTarget, DropZone } from "../components/drop-menu.slint";
|
||||
|
||||
|
|
@ -191,6 +191,8 @@ export component GridView inherits Rectangle {
|
|||
callback context-menu(int, length, length);
|
||||
// What is in view (top, height) and the row and cell heights, for the previews.
|
||||
callback viewport-changed(length, length, length, length);
|
||||
// The selection box, in content coordinates (see BandBox).
|
||||
callback band(c1: float, y1: length, c2: float, y2: length, add: bool, start: bool);
|
||||
|
||||
out property <int> columns: max(1, floor((list.visible-width - 2 * Columns.inset) / Grid.min-cell-width(root.state.zoom)));
|
||||
property <length> cell-width: (list.visible-width - 2 * Columns.inset) / root.columns;
|
||||
|
|
@ -237,6 +239,25 @@ export component GridView inherits Rectangle {
|
|||
keys.focus();
|
||||
}
|
||||
|
||||
// A drag from empty space at the window point (ax, ay); false when it didn't start in the
|
||||
// list. Past the top or bottom edge the list scrolls along.
|
||||
public function band-to(ax: length, ay: length, add: bool, start: bool) -> bool {
|
||||
if !start {
|
||||
let over = ay - list.absolute-position.y;
|
||||
let room = list.content-height - list.visible-height;
|
||||
if over < 0 {
|
||||
list.content-y = min(0px, list.content-y - max(over, -Theme.band-scroll));
|
||||
} else if over > list.visible-height && room > 0 {
|
||||
list.content-y = max(-room, list.content-y - min(over - list.visible-height, Theme.band-scroll));
|
||||
}
|
||||
}
|
||||
band.drag(ax, ay, add, start)
|
||||
}
|
||||
|
||||
public function band-end() {
|
||||
band.stop();
|
||||
}
|
||||
|
||||
// Scrolls just enough to show `line` (header lines above it are shorter).
|
||||
function reveal(line: int) {
|
||||
if line < 0 || line >= root.lines.length {
|
||||
|
|
@ -458,6 +479,19 @@ export component GridView inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
band := BandBox {
|
||||
origin-x: list.absolute-position.x;
|
||||
origin-y: list.absolute-position.y;
|
||||
scroll: list.content-y;
|
||||
view-width: list.visible-width;
|
||||
view-height: list.visible-height;
|
||||
first-column: Columns.inset;
|
||||
column-width: root.cell-width;
|
||||
changed-box(c1, y1, c2, y2, add, start) => {
|
||||
root.band(c1, y1, c2, y2, add, start);
|
||||
}
|
||||
}
|
||||
|
||||
FolderMessages {
|
||||
state: root.state;
|
||||
row-count: root.rows.length;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ export component FolderView inherits Rectangle {
|
|||
callback motion-settled();
|
||||
// What the visible view shows: top, height, row and cell heights (for the previews).
|
||||
callback viewport-changed(length, length, length, length);
|
||||
callback band(float, length, float, length, bool, bool);
|
||||
|
||||
property <bool> grid: root.state.mode == ViewMode.grid;
|
||||
|
||||
|
|
@ -127,6 +128,19 @@ export component FolderView inherits Rectangle {
|
|||
root.focus-view();
|
||||
}
|
||||
|
||||
// See DetailsView.band-to.
|
||||
public function band-to(ax: length, ay: length, add: bool, start: bool) -> bool {
|
||||
if root.grid {
|
||||
return grid.band-to(ax, ay, add, start);
|
||||
}
|
||||
details.band-to(ax, ay, add, start)
|
||||
}
|
||||
|
||||
public function band-end() {
|
||||
grid.band-end();
|
||||
details.band-end();
|
||||
}
|
||||
|
||||
list-clock := MotionClock {
|
||||
epoch: root.state.motion;
|
||||
duration: MotionPrefs.list-change;
|
||||
|
|
@ -203,6 +217,9 @@ export component FolderView inherits Rectangle {
|
|||
viewport-changed(top, height, row, cell) => {
|
||||
root.viewport-changed(top, height, row, cell);
|
||||
}
|
||||
band(c1, y1, c2, y2, add, start) => {
|
||||
root.band(c1, y1, c2, y2, add, start);
|
||||
}
|
||||
}
|
||||
|
||||
grid := GridView {
|
||||
|
|
@ -259,6 +276,9 @@ export component FolderView inherits Rectangle {
|
|||
viewport-changed(top, height, row, cell) => {
|
||||
root.viewport-changed(top, height, row, cell);
|
||||
}
|
||||
band(c1, y1, c2, y2, add, start) => {
|
||||
root.band(c1, y1, c2, y2, add, start);
|
||||
}
|
||||
columns-changed(n) => {
|
||||
root.columns-changed(n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,5 +318,10 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Verified: release build; rename of a long name in the grid and the location bar under Xvfb.
|
||||
- Not done: no test run; password fields and arrow / Home / End keys not tried.
|
||||
|
||||
## Selection box (user request)
|
||||
- Done: a drag from empty space in a folder draws a box and selects what it covers (`BandBox` in details-view.slint, `FolderModel::band`); Ctrl/Shift flips items in the old selection; the list scrolls past its top or bottom edge; status line follows. Probe: `xdnd_probe press`.
|
||||
- Verified: clippy, release build; box in grid and details view under Xvfb, status "3 of 4 selected".
|
||||
- Not done: in the details view a drag on a row still drags the file (no box from a row's blank columns); a plain click on empty space still keeps the selection; no test run.
|
||||
|
||||
## Later
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue