Fix region snap-size threshold check
Checking to snap the region within a threshold didn't use the absolute delta before comparison, making a larger snap size always pass the threshold check. Also assign variables for clarity.
This commit is contained in:
@@ -3866,12 +3866,10 @@ int ED_region_snap_size_test(const ARegion *region)
|
||||
/* Use a larger value because toggling scrollbars can jump in size. */
|
||||
const int snap_match_threshold = 16;
|
||||
if (region->type->snap_size != nullptr) {
|
||||
return ((((region->sizex - region->type->snap_size(region, region->sizex, 0)) <=
|
||||
snap_match_threshold)
|
||||
<< 0) |
|
||||
(((region->sizey - region->type->snap_size(region, region->sizey, 1)) <=
|
||||
snap_match_threshold)
|
||||
<< 1));
|
||||
const int snap_size_x = region->type->snap_size(region, region->sizex, 0);
|
||||
const int snap_size_y = region->type->snap_size(region, region->sizey, 1);
|
||||
return (((abs(region->sizex - snap_size_x) <= snap_match_threshold) << 0) |
|
||||
((abs(region->sizey - snap_size_y) <= snap_match_threshold) << 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user