Skip to content
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

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

rakuyoMo
Copy link
Contributor

@rakuyoMo rakuyoMo commented Jun 3, 2024

If the user sets a timeline.startHour, the event's start time should be shifted backwards.

@@ -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
Copy link
Owner

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? 🤔

Copy link
Contributor Author

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.

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.

Copy link
Contributor Author

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.

Copy link
Owner

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 👍🏻

Copy link
Contributor Author

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

@kvyatkovskys kvyatkovskys merged commit 5e19b14 into kvyatkovskys:master Jun 27, 2024
@rakuyoMo rakuyoMo deleted the fix/calculateChangingTime branch June 27, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants