Resolve T45301 by adding option for old behavior
Some users really liked previous behavior, so making it an option. Cursor Lock Adjustment can be disabled to give something close to 2.4x behavior of cursor locking. When lock-adjustment is disabled placing the cursor the view. This avoids the issue reported in T40353 where the cursor could get *lost*.
This commit is contained in:
@@ -4753,13 +4753,20 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
|
||||
float co_curr[2], co_prev[2];
|
||||
if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
|
||||
|
||||
if ((ED_view3d_project_float_global(ar, fp_prev, co_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
|
||||
(ED_view3d_project_float_global(ar, fp_curr, co_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
|
||||
{
|
||||
rv3d->ofs_lock[0] += (co_curr[0] - co_prev[0]) / (ar->winx * 0.5f);
|
||||
rv3d->ofs_lock[1] += (co_curr[1] - co_prev[1]) / (ar->winy * 0.5f);
|
||||
float co_curr[2], co_prev[2];
|
||||
|
||||
if ((ED_view3d_project_float_global(ar, fp_prev, co_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
|
||||
(ED_view3d_project_float_global(ar, fp_curr, co_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
|
||||
{
|
||||
rv3d->ofs_lock[0] += (co_curr[0] - co_prev[0]) / (ar->winx * 0.5f);
|
||||
rv3d->ofs_lock[1] += (co_curr[1] - co_prev[1]) / (ar->winy * 0.5f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Cursor may be outside of the view, prevent it getting 'lost', see: T40353 & T45301 */
|
||||
zero_v2(rv3d->ofs_lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user