Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/clip_ops.c
| Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | if (zoom_to_pos && location) { | ||||
| ED_space_clip_get_aspect(sc, &aspx, &aspy); | ED_space_clip_get_aspect(sc, &aspx, &aspy); | ||||
| w = width * aspx; | w = width * aspx; | ||||
| h = height * aspy; | h = height * aspy; | ||||
| dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; | dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; | ||||
| dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; | dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; | ||||
| if (sc->flag & SC_LOCK_SELECTION) { | if (clip_view_has_locked_selection(C)) { | ||||
| sc->xlockof += dx; | sc->xlockof += dx; | ||||
| sc->ylockof += dy; | sc->ylockof += dy; | ||||
| } | } | ||||
| else { | else { | ||||
| sc->xof += dx; | sc->xof += dx; | ||||
| sc->yof += dy; | sc->yof += dy; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| vpd->own_cursor = (win->grabcursor == 0); | vpd->own_cursor = (win->grabcursor == 0); | ||||
| if (vpd->own_cursor) { | if (vpd->own_cursor) { | ||||
| WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); | WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); | ||||
| } | } | ||||
| vpd->x = event->x; | vpd->x = event->x; | ||||
| vpd->y = event->y; | vpd->y = event->y; | ||||
| if (sc->flag & SC_LOCK_SELECTION) { | if (clip_view_has_locked_selection(C)) { | ||||
| vpd->vec = &sc->xlockof; | vpd->vec = &sc->xlockof; | ||||
| } | } | ||||
| else { | else { | ||||
| vpd->vec = &sc->xof; | vpd->vec = &sc->xof; | ||||
| } | } | ||||
| copy_v2_v2(&vpd->xof, vpd->vec); | copy_v2_v2(&vpd->xof, vpd->vec); | ||||
| copy_v2_v2(&vpd->xorig, &vpd->xof); | copy_v2_v2(&vpd->xorig, &vpd->xof); | ||||
| Show All 21 Lines | |||||
| static int view_pan_exec(bContext *C, wmOperator *op) | static int view_pan_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| SpaceClip *sc = CTX_wm_space_clip(C); | SpaceClip *sc = CTX_wm_space_clip(C); | ||||
| float offset[2]; | float offset[2]; | ||||
| RNA_float_get_array(op->ptr, "offset", offset); | RNA_float_get_array(op->ptr, "offset", offset); | ||||
| if (sc->flag & SC_LOCK_SELECTION) { | if (clip_view_has_locked_selection(C)) { | ||||
| sc->xlockof += offset[0]; | sc->xlockof += offset[0]; | ||||
| sc->ylockof += offset[1]; | sc->ylockof += offset[1]; | ||||
| } | } | ||||
| else { | else { | ||||
| sc->xof += offset[0]; | sc->xof += offset[0]; | ||||
| sc->yof += offset[1]; | sc->yof += offset[1]; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,455 Lines • Show Last 20 Lines | |||||