Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d_ops.c
| Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| fac = 0.01f * (event->prevx - event->x); | fac = 0.01f * (event->prevx - event->x); | ||||
| dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f; | dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f; | ||||
| if (event->type == MOUSEPAN) { | if (event->type == MOUSEPAN) { | ||||
| fac = 0.01f * (event->prevy - event->y); | fac = 0.01f * (event->prevy - event->y); | ||||
| } | } | ||||
| dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f; | dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f; | ||||
| /* support trackpad zoom to always zoom entirely - the v2d code uses portrait or | /* Support zoom to always zoom entirely. Only respect Zoom Axis user setting | ||||
| * landscape exceptions */ | * if the view does not have any zoom restrictions any will be scaled uniformly. */ | ||||
| if (v2d->keepzoom & V2D_KEEPASPECT) { | if (v2d->keepzoom & V2D_KEEPASPECT) { | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) { | |||||
| if (U.uiflag & USER_ZOOM_HORIZ) { | |||||
| dy = 0; | |||||
| } | |||||
| else { | |||||
| dx = 0; | |||||
| } | |||||
| } | |||||
| if (fabsf(dx) > fabsf(dy)) { | if (fabsf(dx) > fabsf(dy)) { | ||||
| dy = dx; | dy = dx; | ||||
| } | } | ||||
| else { | else { | ||||
| dx = dy; | dx = dy; | ||||
| } | } | ||||
| } | } | ||||
| RNA_float_set(op->ptr, "deltax", dx); | RNA_float_set(op->ptr, "deltax", dx); | ||||
| ▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
| /* x-axis transform */ | /* x-axis transform */ | ||||
| fac = zoomfac * (event->x - vzd->lastx); | fac = zoomfac * (event->x - vzd->lastx); | ||||
| dx = fac * BLI_rctf_size_x(&v2d->cur); | dx = fac * BLI_rctf_size_x(&v2d->cur); | ||||
| /* y-axis transform */ | /* y-axis transform */ | ||||
| fac = zoomfac * (event->y - vzd->lasty); | fac = zoomfac * (event->y - vzd->lasty); | ||||
| dy = fac * BLI_rctf_size_y(&v2d->cur); | dy = fac * BLI_rctf_size_y(&v2d->cur); | ||||
| /* Only respect user setting zoom axis if the view does not have any zoom restrictions | /* Support zoom to always zoom entirely. Only respect Zoom Axis user setting | ||||
| * any will be scaled uniformly */ | * if the view does not have any zoom restrictions any will be scaled uniformly. */ | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && | if (v2d->keepzoom & V2D_KEEPASPECT) { | ||||
| (v2d->keepzoom & V2D_KEEPASPECT)) { | if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) { | ||||
| if (U.uiflag & USER_ZOOM_HORIZ) { | if (U.uiflag & USER_ZOOM_HORIZ) { | ||||
| dy = 0; | dy = 0; | ||||
| } | |||||
| else { | |||||
| dx = 0; | |||||
| } | |||||
| } | |||||
| if (fabsf(dx) > fabsf(dy)) { | |||||
| dy = dx; | |||||
| } | } | ||||
| else { | else { | ||||
| dx = 0; | dx = dy; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* support zoom to always zoom entirely - the v2d code uses portrait or | |||||
| * landscape exceptions */ | |||||
| if (v2d->keepzoom & V2D_KEEPASPECT) { | |||||
| if (fabsf(dx) > fabsf(dy)) { | |||||
| dy = dx; | |||||
| } | |||||
| else { | |||||
| dx = dy; | |||||
| } | |||||
| } | |||||
| /* set transform amount, and add current deltas to stored total delta (for redo) */ | /* set transform amount, and add current deltas to stored total delta (for redo) */ | ||||
| RNA_float_set(op->ptr, "deltax", dx); | RNA_float_set(op->ptr, "deltax", dx); | ||||
| RNA_float_set(op->ptr, "deltay", dy); | RNA_float_set(op->ptr, "deltay", dy); | ||||
| vzd->dx += dx; | vzd->dx += dx; | ||||
| vzd->dy += dy; | vzd->dy += dy; | ||||
| /* Store mouse coordinates for next time, if not doing continuous zoom: | /* Store mouse coordinates for next time, if not doing continuous zoom: | ||||
| ▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines | |||||