diff options
Diffstat (limited to 'source/blender/editors/interface/view2d_ops.c')
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 8fff2957fa7..b9504a3a96b 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -187,9 +187,10 @@ static void view_pan_apply(bContext *C, wmOperator *op) { v2dViewPanData *vpd = op->customdata; - view_pan_apply_ex(C, vpd, - RNA_int_get(op->ptr, "deltax"), - RNA_int_get(op->ptr, "deltay")); + view_pan_apply_ex( + C, vpd, + RNA_int_get(op->ptr, "deltax"), + RNA_int_get(op->ptr, "deltay")); } @@ -733,9 +734,10 @@ static void view_zoomstep_apply_ex( static void view_zoomstep_apply(bContext *C, wmOperator *op) { v2dViewZoomData *vzd = op->customdata; - view_zoomstep_apply_ex(C, vzd, true, - RNA_float_get(op->ptr, "zoomfacx"), - RNA_float_get(op->ptr, "zoomfacy")); + view_zoomstep_apply_ex( + C, vzd, true, + RNA_float_get(op->ptr, "zoomfacx"), + RNA_float_get(op->ptr, "zoomfacy")); } /* --------------- Individual Operators ------------------- */ @@ -788,9 +790,10 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event) ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomin_exec(C, op); @@ -853,9 +856,10 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomout_exec(C, op); @@ -1056,9 +1060,10 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } if (v2d->keepofs & V2D_LOCKOFS_X) @@ -1345,9 +1350,10 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event) vzd = op->customdata; - view_zoomstep_apply_ex(C, vzd, false, - do_zoom_xy[0] ? zoom_factor : 0.0f, - do_zoom_xy[1] ? zoom_factor : 0.0f); + view_zoomstep_apply_ex( + C, vzd, false, + do_zoom_xy[0] ? zoom_factor : 0.0f, + do_zoom_xy[1] ? zoom_factor : 0.0f); view_zoomstep_exit(op); } @@ -1392,14 +1398,18 @@ struct SmoothView2DStore { */ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) { - const float size_a[2] = {BLI_rctf_size_x(rect_a), - BLI_rctf_size_y(rect_a)}; - const float size_b[2] = {BLI_rctf_size_x(rect_b), - BLI_rctf_size_y(rect_b)}; - const float cent_a[2] = {BLI_rctf_cent_x(rect_a), - BLI_rctf_cent_y(rect_a)}; - const float cent_b[2] = {BLI_rctf_cent_x(rect_b), - BLI_rctf_cent_y(rect_b)}; + const float size_a[2] = { + BLI_rctf_size_x(rect_a), + BLI_rctf_size_y(rect_a)}; + const float size_b[2] = { + BLI_rctf_size_x(rect_b), + BLI_rctf_size_y(rect_b)}; + const float cent_a[2] = { + BLI_rctf_cent_x(rect_a), + BLI_rctf_cent_y(rect_a)}; + const float cent_b[2] = { + BLI_rctf_cent_x(rect_b), + BLI_rctf_cent_y(rect_b)}; float fac_max = 0.0f; float tfac; @@ -1699,9 +1709,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[0], - v2d->hor.xmin, v2d->hor.xmax, - scrollers->hor_min, scrollers->hor_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[0], + v2d->hor.xmin, v2d->hor.xmax, + scrollers->hor_min, scrollers->hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1720,9 +1731,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[1], - v2d->vert.ymin, v2d->vert.ymax, - scrollers->vert_min, scrollers->vert_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[1], + v2d->vert.ymin, v2d->vert.ymax, + scrollers->vert_min, scrollers->vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ |