Skip to content

Commit 26d31c9

Browse files
committed
fix row drag animation
1 parent 7e0f094 commit 26d31c9

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- add Real, Group, Vector graphic classes
1414
- better row drop
1515
- cancel row drag with Esc
16+
- better row drag animation
1617

1718
## 9.0.11 2025/07/21
1819

TODO

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11

2-
- annoying animation feedback when dragging rows
3-
42
- get judder with rotate and images smaller than the window
53

64
draw on update, then draw again on relayout

src/workspaceview.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,43 +1187,42 @@ workspaceview_drag_update(GtkEventControllerMotion *self,
11871187

11881188
if (cview) {
11891189
int pos;
1190-
11911190
// row we are over, if any
11921191
Rowview *local = columnview_find_rowview(cview,
11931192
mouse_x, mouse_y);
11941193

1195-
if (local) {
1194+
// the area in the column containing the set of rows
1195+
graphene_rect_t scol_bounds;
1196+
if (!gtk_widget_compute_bounds(GTK_WIDGET(cview->sview),
1197+
wview->fixed, &scol_bounds))
1198+
return;
1199+
1200+
pos = -1;
1201+
if (mouse_y < scol_bounds.origin.y)
1202+
pos = 0;
1203+
else if (mouse_y >
1204+
scol_bounds.origin.y + scol_bounds.size.height)
1205+
// this will get renumbered on drop
1206+
pos = 100000;
1207+
else if (local) {
11961208
Rowview *top = rowview_get_top(local);
11971209

1198-
graphene_rect_t bounds;
1210+
graphene_rect_t row_bounds;
11991211
if (!gtk_widget_compute_bounds(GTK_WIDGET(top->frame),
1200-
wview->fixed, &bounds))
1212+
wview->fixed, &row_bounds))
12011213
return;
12021214

12031215
Row *row = ROW(VOBJECT(top)->iobject);
12041216
pos = 2 * ICONTAINER(row)->pos + 1;
1205-
if (mouse_y > bounds.origin.y + bounds.size.height / 2)
1217+
if (mouse_y >
1218+
row_bounds.origin.y + row_bounds.size.height / 2)
12061219
pos += 1;
12071220
else
12081221
pos -= 1;
12091222
}
1210-
else {
1211-
// we are over a column, but not over a row ... we
1212-
// could be over the titlebar, or over the entry area
1213-
// at the bottom
1214-
Columnview *title =
1215-
workspaceview_find_columnview_title(wview,
1216-
mouse_x, mouse_y);
1217-
1218-
if (title)
1219-
pos = 0;
1220-
else
1221-
// not in the title, append to end of column
1222-
// this will get renumbered on drop
1223-
pos = 100000;
1224-
}
12251223

1226-
workspaceview_move_row_shadow(wview, cview, pos);
1224+
if (pos >= 0)
1225+
workspaceview_move_row_shadow(wview, cview, pos);
12271226
}
12281227
else
12291228
workspaceview_move_row_shadow(wview, NULL, -1);

0 commit comments

Comments
 (0)