static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event) { ViewZoomData *vpd = op->customdata; float delta, factor; switch (event->type) { case MOUSEMOVE: delta = event->x - vpd->x + event->y - vpd->y; if (U.uiflag & USER_ZOOM_INVERT) delta *= -1; factor = 1.0f + delta / 300.0f; RNA_float_set(op->ptr, "factor", factor); sclip_zoom_set(C, vpd->zoom * factor, vpd->location); ED_region_tag_redraw(CTX_wm_region(C)); break; default: if (event->type == vpd->event_type && event->val == KM_RELEASE) { view_zoom_exit(C, op, 0); return OPERATOR_FINISHED; } break; } return OPERATOR_RUNNING_MODAL; }
static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event) { ViewZoomData *vpd = op->customdata; switch (event->type) { case TIMER: if (event->customdata == vpd->timer) { view_zoom_apply(C, vpd, op, event); } break; case MOUSEMOVE: view_zoom_apply(C, vpd, op, event); break; default: if (event->type == vpd->event_type && event->val == KM_RELEASE) { view_zoom_exit(C, op, 0); return OPERATOR_FINISHED; } break; } return OPERATOR_RUNNING_MODAL; }
static int view_zoom_cancel(bContext *C, wmOperator *op) { view_zoom_exit(C, op, 1); return OPERATOR_CANCELLED; }
static void view_zoom_cancel(bContext *C, wmOperator *op) { view_zoom_exit(C, op, true); }