Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d_edge_pan.c
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | static float edge_pan_speed(View2DEdgePanData *vpd, | ||||
| int distance = 0.0; | int distance = 0.0; | ||||
| if (event_loc > max) { | if (event_loc > max) { | ||||
| distance = event_loc - max; | distance = event_loc - max; | ||||
| } | } | ||||
| else if (event_loc < min) { | else if (event_loc < min) { | ||||
| distance = min - event_loc; | distance = min - event_loc; | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_assert(!"Calculating speed outside of pan zones"); | BLI_assert_msg(0, "Calculating speed outside of pan zones"); | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| float distance_factor = distance / (vpd->speed_ramp * U.widget_unit); | float distance_factor = distance / (vpd->speed_ramp * U.widget_unit); | ||||
| CLAMP(distance_factor, 0.0f, 1.0f); | CLAMP(distance_factor, 0.0f, 1.0f); | ||||
| /* Apply a fade in to the speed based on a start time delay. */ | /* Apply a fade in to the speed based on a start time delay. */ | ||||
| const double start_time = x_dir ? vpd->edge_pan_start_time_x : vpd->edge_pan_start_time_y; | const double start_time = x_dir ? vpd->edge_pan_start_time_x : vpd->edge_pan_start_time_y; | ||||
| const float delay_factor = smootherstep(vpd->delay, (float)(current_time - start_time)); | const float delay_factor = smootherstep(vpd->delay, (float)(current_time - start_time)); | ||||
| ▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines | |||||