diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-15 15:33:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-15 15:33:13 +0400 |
commit | 474b9224722953b36b46a00e1a8201858f2a99ae (patch) | |
tree | bf729a0e1a59332f73b662d1796793f7160b392a /source/blender/editors/space_node/node_edit.c | |
parent | 10253f73bcdfc9aee865e06e9000505e08e009dd (diff) |
fix: node background image move operator didn't take zoom into account when clamping pan bounds.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 82f3eb1890d..5e5ffe2049c 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1573,11 +1573,13 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event) static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) { + SpaceNode *snode = CTX_wm_space_node(C); ARegion *ar = CTX_wm_region(C); NodeViewMove *nvm; Image *ima; ImBuf *ibuf; - int pad = 10; + const float pad = 32.0f; /* better be bigger then scrollbars */ + void *lock; ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node"); @@ -1593,10 +1595,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event) nvm->mvalo[0] = event->mval[0]; nvm->mvalo[1] = event->mval[1]; - nvm->xmin = -(ar->winx / 2) - ibuf->x / 2 + pad; - nvm->xmax = ar->winx / 2 + ibuf->x / 2 - pad; - nvm->ymin = -(ar->winy / 2) - ibuf->y / 2 + pad; - nvm->ymax = ar->winy / 2 + ibuf->y / 2 - pad; + nvm->xmin = -(ar->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad; + nvm->xmax = (ar->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad; + nvm->ymin = -(ar->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad; + nvm->ymax = (ar->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad; BKE_image_release_ibuf(ima, lock); |