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:

committed by
Brecht Van Lommel

parent
420da872a6
commit
ad7980a51a
@@ -620,7 +620,7 @@ static int view_zoom_in_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
RNA_float_get_array(op->ptr, "location", location);
|
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));
|
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);
|
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));
|
ED_region_tag_redraw(CTX_wm_region(C));
|
||||||
|
|
||||||
|
@@ -776,10 +776,10 @@ static int image_view_zoom_in_exec(bContext *C, wmOperator *op)
|
|||||||
SpaceImage *sima = CTX_wm_space_image(C);
|
SpaceImage *sima = CTX_wm_space_image(C);
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
float location[2];
|
float location[2];
|
||||||
|
|
||||||
RNA_float_get_array(op->ptr, "location", location);
|
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));
|
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);
|
SpaceImage *sima = CTX_wm_space_image(C);
|
||||||
ARegion *ar = CTX_wm_region(C);
|
ARegion *ar = CTX_wm_region(C);
|
||||||
float location[2];
|
float location[2];
|
||||||
|
|
||||||
RNA_float_get_array(op->ptr, "location", location);
|
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));
|
ED_region_tag_redraw(CTX_wm_region(C));
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
Reference in New Issue
Block a user