WIP: Custom build, mostly selection options #105712
|
@ -1611,7 +1611,7 @@ bool WM_event_is_modal_drag_exit(const struct wmEvent *event,
|
|||
short init_event_val);
|
||||
bool WM_event_is_mouse_drag(const struct wmEvent *event);
|
||||
bool WM_event_is_mouse_drag_or_press(const wmEvent *event);
|
||||
int WM_event_drag_direction(const wmEvent *event, const struct Scene *scene);
|
||||
int WM_event_drag_direction(const wmEvent *event, struct ToolSettings *ts);
|
||||
char WM_event_utf8_to_ascii(const struct wmEvent *event) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
|
|
|
@ -264,7 +264,7 @@ bool WM_event_is_mouse_drag_or_press(const wmEvent *event)
|
|||
(ISMOUSE_BUTTON(event->type) && (event->val == KM_PRESS));
|
||||
}
|
||||
|
||||
int WM_event_drag_direction(const wmEvent *event, const Scene *scene)
|
||||
int WM_event_drag_direction(const wmEvent *event, ToolSettings *ts)
|
||||
{
|
||||
const int delta[2] = {
|
||||
event->xy[0] - event->prev_press_xy[0],
|
||||
|
@ -324,16 +324,11 @@ int WM_event_drag_direction(const wmEvent *event, const Scene *scene)
|
|||
}
|
||||
}
|
||||
if (lasso > 1) {
|
||||
if (lasso == box) {
|
||||
ts->lasso_direction_upright = ts->box_direction_upright;
|
||||
}
|
||||
else {
|
||||
ts->lasso_direction_upright = false;
|
||||
theta = lasso == 2 ? round_fl_to_int(atan2f(0.0f, (float)delta[0]) / (float)M_PI) :
|
||||
round_fl_to_int(atan2f(0.0f, (float)delta[1]) / (float)M_PI);
|
||||
if (theta == 0) {
|
||||
ts->lasso_direction_upright = true;
|
||||
}
|
||||
ts->lasso_direction_upright = false;
|
||||
theta = lasso == 2 ? round_fl_to_int(atan2f(0.0f, (float)delta[0]) / (float)M_PI) :
|
||||
round_fl_to_int(atan2f(0.0f, (float)delta[1]) / (float)M_PI);
|
||||
if (theta == 0) {
|
||||
ts->lasso_direction_upright = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3432,8 +3432,8 @@ static eHandlerActionFlag wm_handlers_do(bContext *C, wmEvent *event, ListBase *
|
|||
if ((event->flag & WM_EVENT_FORCE_DRAG_THRESHOLD) ||
|
||||
WM_event_drag_test(event, event->prev_press_xy)) {
|
||||
win->event_queue_check_drag_handled = true;
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const int direction = WM_event_drag_direction(event, scene);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
const int direction = WM_event_drag_direction(event, ts);
|
||||
|
||||
/* Intentionally leave `event->xy` as-is, event users are expected to use
|
||||
* `event->prev_press_xy` if they need to access the drag start location. */
|
||||
|
|
Loading…
Reference in New Issue