diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-10-26 14:42:19 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-10-27 11:22:06 +0300 |
commit | 4d605ef2f413e8ab484743218f0d0517138513d5 (patch) | |
tree | 8b3e3b1a9dd430484ebba859d2ef069cd469aab7 /source/blender/editors/interface | |
parent | b94447a298146f273c848541a3122afea001ba39 (diff) |
Fix T92427: Adding new nodes does no edge-panning
Unlike translating existing nodes [which disables cursor wrapping and
enables edge-panning instead since rBSa1cc7042a74], adding new nodes
would still show the old behavior of cursor wrapping.
This has been disabled for the case when the node whould be added
outside (due to menus overlapping other editors).
Now enable edge-panning for adding new nodes as well and make sure
this only starts once the mouse has returned into the inside rect once.
Maniphest Tasks: T92427
Differential Revision: https://developer.blender.org/D13005
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/view2d_edge_pan.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/interface/view2d_edge_pan.c b/source/blender/editors/interface/view2d_edge_pan.c index a49666ebbd3..8d8b9a4fe48 100644 --- a/source/blender/editors/interface/view2d_edge_pan.c +++ b/source/blender/editors/interface/view2d_edge_pan.c @@ -92,6 +92,8 @@ void UI_view2d_edge_pan_init(bContext *C, vpd->delay = delay; vpd->zoom_influence = zoom_influence; + vpd->enabled = false; + /* Calculate translation factor, based on size of view. */ const float winx = (float)(BLI_rcti_size_x(&vpd->region->winrct) + 1); const float winy = (float)(BLI_rcti_size_y(&vpd->region->winrct) + 1); @@ -227,9 +229,16 @@ void UI_view2d_edge_pan_apply(bContext *C, View2DEdgePanData *vpd, const int xy[ BLI_rcti_pad(&inside_rect, -vpd->inside_pad * U.widget_unit, -vpd->inside_pad * U.widget_unit); BLI_rcti_pad(&outside_rect, vpd->outside_pad * U.widget_unit, vpd->outside_pad * U.widget_unit); + /* Check if we can actually start the edge pan (e.g. adding nodes outside the view will start + * disabled). */ + if (BLI_rcti_isect_pt_v(&inside_rect, xy)) { + /* We are inside once, can start. */ + vpd->enabled = true; + } + int pan_dir_x = 0; int pan_dir_y = 0; - if ((vpd->outside_pad == 0) || BLI_rcti_isect_pt_v(&outside_rect, xy)) { + if (vpd->enabled && ((vpd->outside_pad == 0) || BLI_rcti_isect_pt_v(&outside_rect, xy))) { /* Find whether the mouse is beyond X and Y edges. */ if (xy[0] > inside_rect.xmax) { pan_dir_x = 1; |