From 469d7bcdd4168768892cda0d203314fbad57839c Mon Sep 17 00:00:00 2001 From: relikd Date: Tue, 9 Dec 2025 15:08:20 +0100 Subject: [PATCH] feat: separator with direction flip --- baRSS/Helper/DrawImage.h | 1 + baRSS/Helper/DrawImage.m | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/baRSS/Helper/DrawImage.h b/baRSS/Helper/DrawImage.h index 9fe66a5..64af52e 100644 --- a/baRSS/Helper/DrawImage.h +++ b/baRSS/Helper/DrawImage.h @@ -3,6 +3,7 @@ /// Draw separator line in @c NSOutlineView IB_DESIGNABLE @interface DrawSeparator : NSView +@property (assign) BOOL invert; @end diff --git a/baRSS/Helper/DrawImage.m b/baRSS/Helper/DrawImage.m index 2417700..d9535b7 100644 --- a/baRSS/Helper/DrawImage.m +++ b/baRSS/Helper/DrawImage.m @@ -7,7 +7,8 @@ @implementation DrawSeparator - (void)drawRect:(NSRect)r { NSColor *color = [NSColor darkGrayColor]; - NSGradient *grdnt = [[NSGradient alloc] initWithStartingColor:color endingColor:[color colorWithAlphaComponent:0.0]]; + NSColor *transparent = [color colorWithAlphaComponent:0.0]; + NSGradient *grdnt = [[NSGradient alloc] initWithStartingColor:self.invert ? transparent : color endingColor:self.invert ? color : transparent]; NSRect separatorRect = NSMakeRect(1, NSMidY(self.bounds) - 1, NSWidth(self.bounds) - 2, 2); NSBezierPath *rounded = [NSBezierPath bezierPathWithRoundedRect:separatorRect xRadius:1 yRadius:1]; [grdnt drawInBezierPath:rounded angle:0];