diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-03-25 19:58:45 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-03-25 19:58:45 +0400 |
commit | 765d077a1a1f6bbaa9c5c5808af313f07f0c06ab (patch) | |
tree | b98ce1cf002121441a11b14767978b244bbe6d04 /source/blender/editors/space_clip/clip_ops.c | |
parent | a7ed1db51fa32a80b943816d354b45b413d98fa3 (diff) |
Zoom to mouse position didn't work in MCE when locked to a selection
Diffstat (limited to 'source/blender/editors/space_clip/clip_ops.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index a7cdff0f9ba..124852c5182 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; + } } } |