[Bf-blender-cvs] [1dc12dc5d1f] temp-gpencil-fill: GPencil: Don't center if the zoom is 1.0
Antonio Vazquez
noreply at git.blender.org
Wed Feb 3 22:25:21 CET 2021
Commit: 1dc12dc5d1f88729d2c7362d3d860634a293a722
Author: Antonio Vazquez
Date: Wed Feb 3 22:25:18 2021 +0100
Branches: temp-gpencil-fill
https://developer.blender.org/rB1dc12dc5d1f88729d2c7362d3d860634a293a722
GPencil: Don't center if the zoom is 1.0
If no need zoom is because all image is visible.
===================================================================
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index d4bee2b8355..0d4fb39a2f9 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -670,15 +670,17 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
viewplane.ymax *= tgpf->zoom;
/* Center view in the mouse click position. */
- float width = viewplane.xmax - viewplane.xmin;
- float height = viewplane.ymax - viewplane.ymin;
- float offset_x = (width * tgpf->mouse_offset[0]);
- float offset_y = (height * tgpf->mouse_offset[1]);
-
- viewplane.xmin += offset_x;
- viewplane.xmax += offset_x;
- viewplane.ymin += offset_y;
- viewplane.ymax += offset_y;
+ if (tgpf->zoom > 1.0f) {
+ float width = viewplane.xmax - viewplane.xmin;
+ float height = viewplane.ymax - viewplane.ymin;
+ float offset_x = (width * tgpf->mouse_offset[0]);
+ float offset_y = (height * tgpf->mouse_offset[1]);
+
+ viewplane.xmin += offset_x;
+ viewplane.xmax += offset_x;
+ viewplane.ymin += offset_y;
+ viewplane.ymax += offset_y;
+ }
if (is_ortho) {
orthographic_m4(winmat,
More information about the Bf-blender-cvs
mailing list