-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the issue where the timeline.startHour
was ignored
#353
Fix the issue where the timeline.startHour
was ignored
#353
Conversation
@@ -728,7 +728,7 @@ extension TimelineView: EventDelegate { | |||
let firstY = time.frame.origin.y - (calculatedTimeY + style.timeline.heightTime) | |||
let percent = (pointY - firstY) / (calculatedTimeY + style.timeline.heightTime) | |||
let newMinute = Int(60.0 * percent) | |||
let newHour = time.tag - 1 | |||
let newHour = time.tag - 1 + style.timeline.startHour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, did you test this case? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, did you test this case? 🤔
Yes, I have tested it.
Logically speaking, as shown in the code below, the time tag starts at 0, which does not really reflect the time corresponding to the label.
time.tag = idx - start |
I still don't understand why the above code needs to subtract start. Because the time tag is used in many places, I used a method with less impact, as shown in this PR.
Perhaps after understanding the above reasons for modification, you will have a more correct way to modify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My current testing is not comprehensive, but I will be able to do some more comprehensive testing next week. Based on my current test results, there is nothing wrong with this modification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check this case before merging. Thanks for your explanation 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kvyatkovskys I have tested it in my project and it is necessary
If the user sets a
timeline.startHour
, the event's start time should be shifted backwards.