[Bf-blender-cvs] [765d077] master: Zoom to mouse position didn't work in MCE when locked to a selection

Sergey Sharybin noreply at git.blender.org
Tue Mar 25 16:59:11 CET 2014


Commit: 765d077a1a1f6bbaa9c5c5808af313f07f0c06ab
Author: Sergey Sharybin
Date:   Tue Mar 25 21:58:45 2014 +0600
https://developer.blender.org/rB765d077a1a1f6bbaa9c5c5808af313f07f0c06ab

Zoom to mouse position didn't work in MCE when locked to a selection

===================================================================

M	source/blender/editors/space_clip/clip_ops.c

===================================================================

diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index a7cdff0..124852c 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -110,10 +110,21 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
 	}
 
 	if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
+		float dx, dy;
+
 		ED_space_clip_get_size(sc, &width, &height);
 
-		sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
-		sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
+		dx = ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
+		dy= ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
+
+		if (sc->flag & SC_LOCK_SELECTION) {
+			sc->xlockof += dx;
+			sc->ylockof += dy;
+		}
+		else {
+			sc->xof += dx;
+			sc->yof += dy;
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list