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:
authorMatt Ebb <matt@mke3.net>2010-03-18 07:09:59 +0300
committerMatt Ebb <matt@mke3.net>2010-03-18 07:09:59 +0300
commit35a5be71e7589e64bb5579748cbb2566f04a2c9c (patch)
tree35e537063e8adc1453921e8bef38bc40485e03aa /source/blender/editors/space_file/filesel.c
parent25ea2fafdd4494b1d3d462201442060c5be8111b (diff)
Fix [#20908] Box Select On File/Append Selects Too Many Files
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 6945e8c959a..da8dc4b654c 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -220,7 +220,7 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar)
}
}
-int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
+int ED_fileselect_layout_offset(FileLayout* layout, int clamp_bounds, int x, int y)
{
int offsetx, offsety;
int active_file;
@@ -231,9 +231,14 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
- if (offsetx > layout->columns-1) return -1 ;
- if (offsety > layout->rows-1) return -1 ;
-
+ if (clamp_bounds) {
+ CLAMP(offsetx, 0, layout->columns-1);
+ CLAMP(offsety, 0, layout->rows-1);
+ } else {
+ if (offsetx > layout->columns-1) return -1 ;
+ if (offsety > layout->rows-1) return -1 ;
+ }
+
if (layout->flag & FILE_LAYOUT_HOR)
active_file = layout->rows*offsetx + offsety;
else