37 if (region ==
nullptr) {
41 View2D *v2d = ®ion->v2d;
112 const double current_time)
114 if (pan_dir_x == 0) {
120 if (pan_dir_y == 0) {
136 x =
clamp_f(x / domain_max, 0.0, 1.0);
137 return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);
143 const double current_time)
149 const int min = (x_dir ? region->winrct.xmin : region->winrct.ymin) +
pad;
150 const int max = (x_dir ? region->winrct.xmax : region->winrct.ymax) -
pad;
152 if (event_loc > max) {
153 distance = event_loc -
max;
155 else if (event_loc <
min) {
156 distance =
min - event_loc;
162 float distance_factor = distance / (vpd->
speed_ramp *
U.widget_unit);
163 CLAMP(distance_factor, 0.0f, 1.0f);
167 const float delay_factor = vpd->
delay > 0.01f ?
174 const float zoom_factor = 1.0f + std::clamp(vpd->
zoom_influence, 0.0f, 1.0f) * (zoomx - 1.0f);
176 return distance_factor * delay_factor * zoom_factor * vpd->
max_speed *
U.widget_unit *
201 if (dx != 0.0f || dy != 0.0f) {
219 rcti inside_rect, outside_rect;
220 inside_rect = region->winrct;
221 outside_rect = region->winrct;
258 float dx = 0.0f, dy = 0.0f;
259 if (pan_dir_x != 0) {
261 dx = dtime * speed *
float(pan_dir_x);
263 if (pan_dir_y != 0) {
265 dy = dtime * speed *
float(pan_dir_y);
322 float zoom_influence)
331 "Inside distance in UI units from the edge of the region within which to start panning",
341 "Outside distance in UI units from the edge of the region at which to stop panning",
350 "Width of the zone in UI units where speed increases with distance from the edge",
359 "Maximum speed in UI units per second",
368 "Delay in seconds before maximum speed is reached",
377 "Influence of the zoom factor on scroll speed",
bScreen * CTX_wm_screen(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
#define BLI_assert_msg(a, msg)
MINLINE float clamp_f(float value, float min, float max)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_pad(struct rcti *rect, int pad_x, int pad_y)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Platform independent time functions.
double BLI_time_now_seconds(void)
void ED_region_tag_redraw_no_rebuild(ARegion *region)
Read Guarded memory(de)allocation.
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
void UI_view2d_curRect_changed(const bContext *C, View2D *v2d)
int pad[32 - sizeof(int)]
draw_view in_light_buf[] float
float RNA_float_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
double edge_pan_last_time
double edge_pan_start_time_x
double edge_pan_start_time_y
static void edge_pan_apply_delta(bContext *C, View2DEdgePanData *vpd, float dx, float dy)
static void edge_pan_manage_delay_timers(View2DEdgePanData *vpd, int pan_dir_x, int pan_dir_y, const double current_time)
void UI_view2d_edge_pan_operator_init(bContext *C, View2DEdgePanData *vpd, wmOperator *op)
void UI_view2d_edge_pan_set_limits(View2DEdgePanData *vpd, float xmin, float xmax, float ymin, float ymax)
void UI_view2d_edge_pan_cancel(bContext *C, View2DEdgePanData *vpd)
void UI_view2d_edge_pan_operator_properties_ex(wmOperatorType *ot, float inside_pad, float outside_pad, float speed_ramp, float max_speed, float delay, float zoom_influence)
void UI_view2d_edge_pan_init(bContext *C, View2DEdgePanData *vpd, float inside_pad, float outside_pad, float speed_ramp, float max_speed, float delay, float zoom_influence)
static float edge_pan_speed(View2DEdgePanData *vpd, int event_loc, bool x_dir, const double current_time)
void UI_view2d_edge_pan_apply(bContext *C, View2DEdgePanData *vpd, const int xy[2])
void UI_view2d_edge_pan_operator_properties(wmOperatorType *ot)
static float smootherstep(const float domain_max, float x)
void UI_view2d_edge_pan_reset(View2DEdgePanData *vpd)
void UI_view2d_edge_pan_apply_event(bContext *C, View2DEdgePanData *vpd, const wmEvent *event)
bool view2d_edge_pan_poll(bContext *C)
void WM_event_add_mousemove(wmWindow *win)