From 51efeb683451d896531baac949de65043edff0b6 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Mon, 7 May 2018 01:31:18 +0200 Subject: 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. --- source/blender/editors/include/ED_screen_types.h | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/include/ED_screen_types.h') 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__ */ -- cgit v1.2.3