diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-05-07 02:31:18 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-05-07 12:42:12 +0300 |
commit | 51efeb683451d896531baac949de65043edff0b6 (patch) | |
tree | a36b7c037205b77a78a0b0266a7e9ca4571a0a5a /source/blender/editors/include | |
parent | 4ec467d3b52744ba2aa4f938973efa27202b23ee (diff) |
UI: Hide & shrink scroll-bars based on cursor position
Scroll-bars are now hidden unless the cursor approaches them, in which case they
smoothly grow and become more & more visible. Note that since 0d309144020168e55,
scroll-bars are drawn on top of editor contents. There's no more jumping of
buttons when scroll-bars appear.
Technical notes:
* AZones are used to adjust scrollbars based on mouse movements
We may want to support screen level AZones if we want scrollbars to also
smoothly appear when approaching them from a different area.
I also plan to make further changes to AZones to clean up stuff a bit.
* Had to move AZone handling to a post ARegion init stage, since we need the
updated View2D data from there.
* View2D masks and scroller rectangles are now updated on every redraw. It's
cheap to do that though.
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/ED_screen_types.h | 26 | ||||
-rw-r--r-- | source/blender/editors/include/UI_view2d.h | 2 |
2 files changed, 23 insertions, 5 deletions
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 1c41b14a874..0fed5eb03fd 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -83,13 +83,22 @@ typedef enum { AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */ } AZEdge; +typedef enum { + AZ_SCROLL_VERT, + AZ_SCROLL_HOR, +} AZScrollDirection; + /* for editing areas/regions */ typedef struct AZone { struct AZone *next, *prev; ARegion *ar; int type; - /* region-azone, which of the edges (only for AZONE_REGION) */ - AZEdge edge; + + union { + /* region-azone, which of the edges (only for AZONE_REGION) */ + AZEdge edge; + AZScrollDirection direction; + }; /* for draw */ short x1, y1, x2, y2; /* for clip */ @@ -99,8 +108,15 @@ typedef struct AZone { } AZone; /* actionzone type */ -#define AZONE_AREA 1 /* corner widgets for splitting areas */ -#define AZONE_REGION 2 /* when a region is collapsed, draw a handle to expose */ -#define AZONE_FULLSCREEN 3 /* when in editor fullscreen draw a corner to go to normal mode */ +enum { + /* corner widgets for splitting areas */ + AZONE_AREA = 1, + /* when a region is collapsed, draw a handle to expose */ + AZONE_REGION, + /* when in editor fullscreen draw a corner to go to normal mode */ + AZONE_FULLSCREEN, + /* Hotspot azone around scrollbars to show/hide them. */ + AZONE_REGION_SCROLL, +}; #endif /* __ED_SCREEN_TYPES_H__ */ diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index a19b2f05e2e..1f106e3f08d 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -103,6 +103,8 @@ enum eView2D_Gridlines { /* ------ Defines for Scrollers ----- */ /* scroller area */ +#define V2D_SCROLL_HEIGHT_MIN (0.25f * U.widget_unit) +#define V2D_SCROLL_WIDTH_MIN (0.25f * U.widget_unit) #define V2D_SCROLL_HEIGHT (0.45f * U.widget_unit) #define V2D_SCROLL_WIDTH (0.45f * U.widget_unit) /* For scrollers with scale markings (text written onto them) */ |