Fix screen split refresh issues
authorGermano <germano.costa@ig.com.br>
Tue, 23 Jan 2018 01:06:38 +0000 (23:06 -0200)
committerGermano <germano.costa@ig.com.br>
Tue, 23 Jan 2018 01:07:36 +0000 (23:07 -0200)
`Ctrl` (enable snapping) ans `TAB` (Switching direction) didn't refresh.

source/blender/editors/screen/screen_ops.c

index d2fc1d6fc0b35a0204e01128c8f796eb062a5262..2e5f93ff521dc3eb71f01757728113ca2af44a7c 100644 (file)
@@ -1762,55 +1762,9 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
        /* execute the events */
        switch (event->type) {
                case MOUSEMOVE:
-               {
-                       const int dir = RNA_property_enum_get(op->ptr, prop_dir);
-
-                       sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
-
-                       if (sd->previewmode == 0) {
-                               if (sd->do_snap) {
-                                       const int snap_loc = area_snap_calc_location(
-                                               CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->bigger, sd->smaller);
-                                       sd->delta = snap_loc - sd->origval;
-                               }
-                               area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, false);
-                       }
-                       else {
-                               if (sd->sarea) {
-                                       ED_area_tag_redraw(sd->sarea);
-                               }
-                               /* area context not set */
-                               sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
-
-                               if (sd->sarea) {
-                                       ScrArea *sa = sd->sarea;
-                                       if (dir == 'v') {
-                                               sd->origsize = sa->winx;
-                                               sd->origmin = sa->totrct.xmin;
-                                       }
-                                       else {
-                                               sd->origsize = sa->winy;
-                                               sd->origmin = sa->totrct.ymin;
-                                       }
-
-                                       if (sd->do_snap) {
-                                               sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
-
-                                               const int snap_loc = area_snap_calc_location(
-                                                       CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
-
-                                               sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
-                                               sd->delta = snap_loc - sd->origval;
-                                       }
-
-                                       update_factor = true;
-                               }
-
-                               CTX_wm_window(C)->screen->do_draw = true;
-
-                       }
+                       update_factor = true;
                        break;
-               }
+
                case LEFTMOUSE:
                        if (sd->previewmode) {
                                area_split_apply(C, op);
@@ -1855,12 +1809,54 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
        }
 
        if (update_factor) {
-               float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
-               RNA_float_set(op->ptr, "factor", fac);
+               const int dir = RNA_property_enum_get(op->ptr, prop_dir);
+
+               sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
+
+               if (sd->previewmode == 0) {
+                       if (sd->do_snap) {
+                               const int snap_loc = area_snap_calc_location(
+                                       CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->bigger, sd->smaller);
+                               sd->delta = snap_loc - sd->origval;
+                       }
+                       area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, false);
+               }
+               else {
+                       if (sd->sarea) {
+                               ED_area_tag_redraw(sd->sarea);
+                       }
+                       /* area context not set */
+                       sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
+
+                       if (sd->sarea) {
+                               ScrArea *sa = sd->sarea;
+                               if (dir == 'v') {
+                                       sd->origsize = sa->winx;
+                                       sd->origmin = sa->totrct.xmin;
+                               }
+                               else {
+                                       sd->origsize = sa->winy;
+                                       sd->origmin = sa->totrct.ymin;
+                               }
 
-               if (sd->sarea) {
-                       ED_area_tag_redraw(sd->sarea);
+                               if (sd->do_snap) {
+                                       sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
+
+                                       const int snap_loc = area_snap_calc_location(
+                                               CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
+
+                                       sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
+                                       sd->delta = snap_loc - sd->origval;
+                               }
+
+                               ED_area_tag_redraw(sd->sarea);
+                       }
+
+                       CTX_wm_window(C)->screen->do_draw = true;
                }
+
+               float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
+               RNA_float_set(op->ptr, "factor", fac);
        }
 
        return OPERATOR_RUNNING_MODAL;