From c191ae5c3dbc9b23dbd46cc3239ae87a63e52e27 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Mon, 19 Aug 2024 14:39:01 +0800 Subject: [PATCH] Add `offsetTop` for `TimelineStyle` --- Sources/KVKCalendar/DayView.swift | 2 ++ Sources/KVKCalendar/Style.swift | 2 ++ Sources/KVKCalendar/WeekView.swift | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Sources/KVKCalendar/DayView.swift b/Sources/KVKCalendar/DayView.swift index ae4151d4..c8d9c814 100644 --- a/Sources/KVKCalendar/DayView.swift +++ b/Sources/KVKCalendar/DayView.swift @@ -328,6 +328,8 @@ extension DayView: CalendarSettingProtocol { timelineFrame.size.height -= scrollableWeekView.frame.height } + timelineFrame.origin.y += style.timeline.offsetTop + if isAvailableEventViewer { if UIApplication.shared.orientation.isPortrait { timelineFrame.size.width = UIScreen.main.bounds.width * 0.5 diff --git a/Sources/KVKCalendar/Style.swift b/Sources/KVKCalendar/Style.swift index 53fb67c3..267c743b 100644 --- a/Sources/KVKCalendar/Style.swift +++ b/Sources/KVKCalendar/Style.swift @@ -158,6 +158,7 @@ public struct TimelineStyle { return 0.5 #endif }() + public var offsetTop: CGFloat = 0 public var offsetLineLeft: CGFloat = 10 public var offsetLineRight: CGFloat = 10 public var backgroundColor: UIColor = .white @@ -859,6 +860,7 @@ extension TimelineStyle: Equatable { && compare(\.movingMinuteLabelRoundUpTime) && compare(\.minuteLabelRoundUpTime) && compare(\.widthLine) + && compare(\.offsetTop) && compare(\.offsetLineLeft) && compare(\.offsetLineRight) && compare(\.backgroundColor) diff --git a/Sources/KVKCalendar/WeekView.swift b/Sources/KVKCalendar/WeekView.swift index 9a84dba1..ee3786ec 100644 --- a/Sources/KVKCalendar/WeekView.swift +++ b/Sources/KVKCalendar/WeekView.swift @@ -251,6 +251,8 @@ extension WeekView: CalendarSettingProtocol { timelineFrame.size.height -= scrollableWeekView.frame.height } + timelineFrame.origin.y += style.timeline.offsetTop + let timelineViews = Array(0.. [TimelineView] in return acc + [createTimelineView(frame: timelineFrame)] }