Image and clip editor: change zoom step to end up at powers of two.

When you press zoom 3 times you will now get 2:1, 4:1, 8:1, etc. Fixes T36916.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D409
This commit is contained in:
Harshit Mehta 2014-04-01 17:33:43 +02:00 committed by Brecht Van Lommel
parent 420da872a6
commit ad7980a51a
2 changed files with 7 additions and 7 deletions

View File

@ -620,7 +620,7 @@ static int view_zoom_in_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "location", location);
sclip_zoom_set_factor(C, 1.25f, location);
sclip_zoom_set_factor(C, powf(2.0f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
@ -663,7 +663,7 @@ static int view_zoom_out_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "location", location);
sclip_zoom_set_factor(C, 0.8f, location);
sclip_zoom_set_factor(C, powf(0.5f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));

View File

@ -776,10 +776,10 @@ static int image_view_zoom_in_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
sima_zoom_set_factor(sima, ar, 1.25f, location);
sima_zoom_set_factor(sima, ar, powf(2.0f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
@ -821,11 +821,11 @@ static int image_view_zoom_out_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
sima_zoom_set_factor(sima, ar, 0.8f, location);
sima_zoom_set_factor(sima, ar, powf(0.5f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;