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

Z-index strikes again #2

Closed
richardtallent opened this issue May 18, 2017 · 1 comment
Closed

Z-index strikes again #2

richardtallent opened this issue May 18, 2017 · 1 comment

Comments

@richardtallent
Copy link
Owner

richardtallent commented May 18, 2017

I'm embarrassed to say that way multi-day events are rendered doesn't work with days that have a defined background color due to my completely forgetting about the z-index stacking context (which is different for each day since the events are grandchildren of the day they start).

There seem to be only two solutions:

  1. Draw the calendar grid twice, once for borders and background colors and again for days and events, using the same metrics for both. This would put the events on a plane that is transparent, allowing them to "spill over" on top of siblings of their grandparent element. We can still use z-index to avoid vertical spilling.

  2. Position each event relative to the grid upper-left corner, separately from rendering the grid. This can still be done with classes indicating the week number, day of week, and event number on that day. This would require having a hard-set day and event height, providing the end developer no flexibility in margins, padding, font size, or border size unless they override a significant number of classes.

  3. The final solution is to simply not support background colors by the day. It would still be safe to do so to the day number row, but not the area where the events live. This may be the best short-term solution.

The other open issue is how to handle staggering of the "slots" for each day. The current approach minimizes overlap, but doesn't completely avoid it. To avoid overlap, each day must be rendered with knowledge of which "slots" are already spilling over from previous days of that week, and thus not reuse them. This is making me lean toward solution (2).

Not sure when I'll have time to work on this.

@richardtallent
Copy link
Owner Author

Resolved by rewriting the component to (a) render by week and (b) move the events out of the day blocks, positioning them over the week using a calculated vertical and horizontal offset. This also gave me the opportunity to fix proper utilization of each slot on each day. Also improved drag and drop.

beljand added a commit to beljand/vue-simple-calendar that referenced this issue Jul 1, 2019
beljand added a commit to beljand/vue-simple-calendar that referenced this issue Jul 29, 2019
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

No branches or pull requests

1 participant