From 239f177e97a789e7169451dd747f5f8f49333fc6 Mon Sep 17 00:00:00 2001 From: KrLite Date: Thu, 19 Dec 2024 20:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20content=20margins?= =?UTF-8?q?=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Luminare/Main Window/Sidebar/LuminareSidebar.swift | 2 +- .../Utilities/Extensions/View+Extensions.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Luminare/Main Window/Sidebar/LuminareSidebar.swift b/Sources/Luminare/Main Window/Sidebar/LuminareSidebar.swift index d8e04d2..ddc50f4 100644 --- a/Sources/Luminare/Main Window/Sidebar/LuminareSidebar.swift +++ b/Sources/Luminare/Main Window/Sidebar/LuminareSidebar.swift @@ -37,7 +37,7 @@ public struct LuminareSidebar: View where Content: View { .scrollContentBackground(.hidden) .padding(.horizontal, 12) .frame(maxHeight: .infinity, alignment: .top) - .padding(.top, -overflow) + .padding(.vertical, -overflow) .mask { VStack(spacing: 0) { LinearGradient( diff --git a/Sources/Luminare/Utilities/Extensions/View+Extensions.swift b/Sources/Luminare/Utilities/Extensions/View+Extensions.swift index 2ba0f1d..48e764b 100644 --- a/Sources/Luminare/Utilities/Extensions/View+Extensions.swift +++ b/Sources/Luminare/Utilities/Extensions/View+Extensions.swift @@ -276,11 +276,11 @@ public extension View { .environment(\.luminareContentMarginsTrailing, insets.trailing) } - @ViewBuilder func luminareContentMargins(_: Edge.Set, _ length: CGFloat) -> some View { - assigning(\.luminareContentMarginsTop, length) - .assigning(\.luminareContentMarginsLeading, length) - .assigning(\.luminareContentMarginsBottom, length) - .assigning(\.luminareContentMarginsTrailing, length) + @ViewBuilder func luminareContentMargins(_ edges: Edge.Set, _ length: CGFloat) -> some View { + assigning(\.luminareContentMarginsTop, edges.contains(.top) ? length : nil) + .assigning(\.luminareContentMarginsLeading, edges.contains(.leading) ? length : nil) + .assigning(\.luminareContentMarginsBottom, edges.contains(.bottom) ? length : nil) + .assigning(\.luminareContentMarginsTrailing, edges.contains(.trailing) ? length : nil) } @ViewBuilder func luminareContentMargins(_ length: CGFloat) -> some View {