Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-03-03 17:13:04 +0300
committerJulian Eisel <julian@blender.org>2022-03-03 17:17:23 +0300
commit6e487228a5952ac538718e56241d8d2082baa279 (patch)
tree3831e577a6c11467a91469c9ce46db72a56ea6d4 /source/blender/editors/space_file/file_draw.c
parent544bd0c353cf54c28b9bb3e0714f17b16a257731 (diff)
File Browser UI: Allow dragging anywhere in a file preview tile to drag
Previously you'd have to be careful to drag the image itself. Dragging anywhere else on the tile (e.g. between the preview and the text, or the text itself) would trigger border select. This often conflicts with user expectations and causes frustration when trying to work quick, I've seen many people complain about this. Note that the "hitbox" for dragging is a bit smaller than the tile, to not make border select by dragging from in-between the tiles too hard. Differential Revision: https://developer.blender.org/D14228
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r--source/blender/editors/space_file/file_draw.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 92469773ed4..6c67d95674f 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -476,7 +476,26 @@ static void file_draw_preview(const SpaceFile *sfile,
immUnbindProgram();
}
- but = uiDefBut(block, UI_BTYPE_LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, NULL);
+ /* Invisible button for dragging. */
+ rcti drag_rect = *tile_draw_rect;
+ /* A bit smaller than the full tile, to increase the gap between items that users can drag from
+ * for box select. */
+ BLI_rcti_pad(&drag_rect, -layout->tile_border_x, -layout->tile_border_y);
+
+ but = uiDefBut(block,
+ UI_BTYPE_LABEL,
+ 0,
+ "",
+ drag_rect.xmin,
+ drag_rect.ymin,
+ BLI_rcti_size_x(&drag_rect),
+ BLI_rcti_size_y(&drag_rect),
+ NULL,
+ 0.0,
+ 0.0,
+ 0,
+ 0,
+ NULL);
/* Drag-region. */
if (drag) {