Fix T66322 Object with particle system have expanded selection region
authorClément Foucault <foucault.clem@gmail.com>
Tue, 2 Jul 2019 12:04:27 +0000 (14:04 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 2 Jul 2019 12:06:03 +0000 (14:06 +0200)
This was caused by wrong pixsize calculation during selection.

Note that this was affecting selectability of lamps too.

source/blender/editors/space_view3d/view3d_draw.c

index d14a6870a6ca4b4e18fd920122383e34a0445f41..2e34ff7f9c185f548ace191ab79864bf0a88ee7a 100644 (file)
@@ -169,7 +169,13 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
     v2[2] = rv3d->persmat[2][1];
 
     len_px = 2.0f / sqrtf(min_ff(len_squared_v3(v1), len_squared_v3(v2)));
-    len_sc = (float)MAX2(ar->winx, ar->winy);
+
+    if (rect) {
+      len_sc = (float)max_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
+    }
+    else {
+      len_sc = (float)MAX2(ar->winx, ar->winy);
+    }
 
     rv3d->pixsize = len_px / len_sc;
   }