Example #1
0
static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
    if (event->type == MOUSEZOOM) {
        float factor;

        factor = 1.0f + (event->x - event->prevx + event->y - event->prevy) / 300.0f;
        RNA_float_set(op->ptr, "factor", factor);

        sclip_zoom_set_factor_exec(C, event, factor);

        return OPERATOR_FINISHED;
    }
    else {
        view_zoom_init(C, op, event);

        return OPERATOR_RUNNING_MODAL;
    }
}
Example #2
0
static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
		float delta, factor;

		delta = event->prevx - event->x + event->prevy - event->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_factor_exec(C, event, factor);

		return OPERATOR_FINISHED;
	}
	else {
		view_zoom_init(C, op, event);

		return OPERATOR_RUNNING_MODAL;
	}
}