Patch [#25409] Changes to panels header "open/close" and "drag" zones
authorJoshua Leung <aligorith@gmail.com>
Wed, 12 Jan 2011 02:15:38 +0000 (02:15 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 12 Jan 2011 02:15:38 +0000 (02:15 +0000)
Submitted by: Peter Tarasenko (pit)

This patch switches the screen real-estate given to the "open/close"
and "drag" zones for panels.
- Now, the entire header is used for resizing (open/close) panels
instead of just the triangle widget being used for this. This makes it
a larger target for clicking on, making it easier to do so (Fitt's Law
in action!)
- Dragging panels now is relegated to the "grabber" zone on the top-
right corner only now. This reflects the lesser importance of panel
reordering in the panel designs now over being able to open/close
them.

source/blender/editors/interface/interface_panel.c

index d819ecd7ec8adb20203255c08c946df020b28fae..db4af4c11e54b23c38f5087670cf885fcdfed08c 100644 (file)
@@ -955,10 +955,11 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
                if(my >= block->maxy) button= 1;
        }
        else if(block->panel->control & UI_PNL_CLOSE) {
-               if(mx <= block->minx+10+PNL_ICON-2) button= 2;
-               else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
+               /* whole of header can be used to collapse panel (except top-right corner) */
+               if(mx <= block->maxx-8-PNL_ICON) button= 2;
+               //else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
        }
-       else if(mx <= block->minx+10+PNL_ICON+2) {
+       else if(mx <= block->maxx-PNL_ICON-12) {
                button= 1;
        }
        
@@ -996,10 +997,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
                else
                        ED_region_tag_redraw(ar);
        }
-       else if(block->panel->flag & PNL_CLOSED) {
-               panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
-       }
-       else {
+       else if(mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
                panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
        }
 }