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

zPosition enhancement for eventViews #262

Open
3 tasks done
aditya-rastogi23 opened this issue Jun 18, 2020 · 14 comments
Open
3 tasks done

zPosition enhancement for eventViews #262

aditya-rastogi23 opened this issue Jun 18, 2020 · 14 comments
Labels

Comments

@aditya-rastogi23
Copy link

aditya-rastogi23 commented Jun 18, 2020

New Issue Checklist

Issue Description

I am trying to add zPosition to eventView.layer. Currently, there seems to be no right way to do it without editing the library code. (since I intend to use the library for long I would prefer not to edit library code). I will be willing to take up this issue and make a pull request. zPosition can be defaulted to 0. This issue occurs only when eventsWillOverlap is true. Essentially I have a hierarchy where for every day I have free time and working time and under them I have subEvents. However, if I call reloadData the events move on top of each other in an undesired manner. By adding zPosition this issue will be resolved. Is there an enhancement you would be open to?

Code I'm using with CalendarKit
[INSERT CODE HERE]

Result I am trying to achieve

[INSERT API OR UI MOCKUPS HERE]

@richardtop
Copy link
Owner

Hi, yes please go ahead with the pull request!
Also, could you please share some screenshots showing the issue and the desired behavior?

@aditya-rastogi23
Copy link
Author

aditya-rastogi23 commented Jun 26, 2020

Screenshot (8)
Screenshot (9)

As you will see In the above two files, currently non-work time is drawing under work-time, same for holiday. I can't seem to control this flow without changing the library code. For the same, I will be editing a bit of calendarKit code and likely making a pull request this week

@richardtop
Copy link
Owner

@aditya-rastogi23 thanks for the idea, but I suggest changing the layout algorithm, as it could put smaller events on top of the larger ones and the beginning of the event on top of the end of the event.

@richardtop
Copy link
Owner

Could you please attach a project with the reproducible example of this issue?

@richardtop
Copy link
Owner

I'm not sure how you're getting the results as shown on the screenshot, as the current CalendarKit layout algorithm should produce the results as shown:

Simulator Screen Shot - iPhone 11 Pro - 2020-07-13 at 15 36 04

Please, provide a reproducible example or sample code you're using to achieve the result shown on the screenshot, or I'll have to close this issue.

@aditya-rastogi23
Copy link
Author

Hey! I will be attaching the project in a couple of days. Having some issues with my setup. The screenshot you've provided I believe does not use the eventsWillOverlap as true, correct me if I am wrong.

@richardtop
Copy link
Owner

Thank you for getting back quickly! Yes, you're right. eventsWillOverlap feature is not commonly supported, so there might be issues.

Once you attach the project, I'll be able to help you troubleshoot the issue.

@aditya-rastogi23
Copy link
Author

aditya-rastogi23 commented Jul 18, 2020

Hey! sorry for taking so long but you can find a sample project with this issue here:
https://github.com/aditya-rastogi23/calendarKitExample
The solution for this that I found optimal would be to allow users to define their own zPosition for each event. The zPosition for eventView.layer.zPosition can be updated using event.zPosition once the events are dequeued and added to their respective superview.

@richardtop
Copy link
Owner

Hi, thanks for following up.

Few comments:

  1. event reuse is actually disabled right now and could be completely removed from the library.
  2. I'd also recommend taking a look at simpler solution: there is an option to set a z-position of the events happening later to a higher value than that of the events happening earlier.

E.g.

Event 1 - 10:00 - 13:00 - zPosition 0
Event 2 -12:00 - 14:00 - zPosition 1
.....

That would keep zPosition property out of the Event completely, so that the interface would be cleaner.

Later, I plan on introducing an option to plug in a custom layout algorithm, so that you'll be able to control and modify behaviors like that programmatically.

@aditya-rastogi23
Copy link
Author

How am I supposed to access the zposition of events?(or access eventview in general) I don't want to alter the library code

@richardtop
Copy link
Owner

@aditya-rastogi23 indeed, I encourage you to alter the library code and submit a pull request which will be incorporated in the next version of the library. How does that sound?

@aditya-rastogi23
Copy link
Author

Sounds good I'll start working on it

@sanath9
Copy link

sanath9 commented May 28, 2021

HI aditya any update on that issue ?

@aditya-rastogi23
Copy link
Author

My MacOS basically broke down, will not be able to work on it till august

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants