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:
authorHans Goudey <h.goudey@me.com>2020-07-21 17:12:35 +0300
committerHans Goudey <h.goudey@me.com>2020-07-21 17:12:35 +0300
commitc2b0c64843084b6e4189d289fd2d201257fd9448 (patch)
treedec8ce388fe4afeae9735fe5824e0ad12dcbfe0a /source/blender/editors/space_outliner/outliner_dragdrop.c
parent696c23f284b8af2164d8d239e680301523badec1 (diff)
UI: Add an outer boundary for edge panning, use in outliner
Currently if you drag and drop an item from the outliner elsewhere in the Blender window, the outliner will scroll the entire time, even if the mouse is far away. This commit adds optional behavior for the edge pan operator that makes it only act if the mouse is close enough to the region. Differential Revision: https://developer.blender.org/D8193
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_dragdrop.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 09d7f889bde..5baaef958fa 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -858,6 +858,8 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
/* ********************* Outliner Drag Operator ******************** */
+#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD 7 /* In UI units */
+
static TreeElement *outliner_item_drag_element_find(SpaceOutliner *soops,
ARegion *region,
const wmEvent *event)
@@ -892,8 +894,16 @@ static int outliner_item_drag_drop_invoke(bContext *C,
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
- /* Scroll view when dragging near edges */
- WM_operator_name_call(C, "VIEW2D_OT_edge_pan", WM_OP_INVOKE_DEFAULT, NULL);
+ /* Scroll the view when dragging near edges, but not
+ * when the drag goes too far outside the region. */
+ {
+ wmOperatorType *ot = WM_operatortype_find("VIEW2D_OT_edge_pan", true);
+ PointerRNA op_ptr;
+ WM_operator_properties_create_ptr(&op_ptr, ot);
+ RNA_int_set(&op_ptr, "outside_padding", OUTLINER_DRAG_SCOLL_OUTSIDE_PAD);
+ WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr);
+ WM_operator_properties_free(&op_ptr);
+ }
wmDrag *drag = WM_event_start_drag(C, data.icon, WM_DRAG_ID, NULL, 0.0, WM_DRAG_NOP);
@@ -993,6 +1003,8 @@ void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
}
+#undef OUTLINER_DRAG_SCOLL_OUTSIDE_PAD
+
/* *************************** Drop Boxes ************************** */
/* region dropbox definition */