Bugfix #19923: UVImage editor gets stuck in move/zoom mode
authorJoshua Leung <aligorith@gmail.com>
Fri, 20 Nov 2009 10:21:31 +0000 (10:21 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 20 Nov 2009 10:21:31 +0000 (10:21 +0000)
source/blender/editors/interface/view2d_ops.c
source/blender/editors/space_image/image_ops.c

index 92d4c4271d84cc62302959092a12966248e2b4a7..6579e30900bd27191299b2b0e064c19254e64fc8 100644 (file)
@@ -237,6 +237,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
                        
                case LEFTMOUSE:
                case MIDDLEMOUSE:
+               case ESCKEY:
                        if (event->val==KM_RELEASE) {
                                /* calculate overall delta mouse-movement for redo */
                                RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
@@ -253,6 +254,12 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
+static int view_pan_cancel(bContext *C, wmOperator *op)
+{
+       view_pan_exit(C, op);
+       return OPERATOR_CANCELLED;
+}
+
 void VIEW2D_OT_pan(wmOperatorType *ot)
 {
        /* identifiers */
@@ -264,6 +271,7 @@ void VIEW2D_OT_pan(wmOperatorType *ot)
        ot->exec= view_pan_exec;
        ot->invoke= view_pan_invoke;
        ot->modal= view_pan_modal;
+       ot->cancel= view_pan_cancel;
        
        /* operator is repeatable */
        ot->flag= OPTYPE_BLOCKING;
index 9ef7a4d9ae4131775fe8afcb1aee725628f83275..897b02404ef6f949c02f288770604ee0c786e0fb 100644 (file)
@@ -234,6 +234,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
                        view_pan_exec(C, op);
                        break;
                case MIDDLEMOUSE:
+               case LEFTMOUSE:
                        if(event->val==KM_RELEASE) {
                                view_pan_exit(C, op, 0);
                                return OPERATOR_FINISHED;
@@ -349,6 +350,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
                        ED_area_tag_redraw(CTX_wm_area(C));
                        break;
                case MIDDLEMOUSE:
+               case LEFTMOUSE:
                        if(event->val==KM_RELEASE) {
                                view_zoom_exit(C, op, 0);
                                return OPERATOR_FINISHED;