JZCalendarWeekView
JZCalendarWeekView copied to clipboard
Error : Fix limited scrolling range when dragging
Hi @zjfjack
I've found this error since long ago. I have solved this problem and have been using it. Upload the Pull Request to share with everyone.
Error situation :
- Stop in the middle when you drag.
- The calendar automatically aligns with the screen.
- But if you start dragging again Before views are automatically sorted,
- You will be able to drag beyond the limited range. ex) Set limited range to September 10, 2019. If you drag quickly as described, you can drag before September 10.
- I am not good at English, so I will take a video if you can't understand it
2 Causes :
First, change the scrollDirection variable to nil unconditionally in the scrollViewDidEndDecelating()
function.
Second, the loadPage()
function is called very often.
Change point :
Added checkDragRangesInHorizontalScroll()
function to JZBaseWeekView.swift.
Use the function when setting the scrollDirection
variable in the scrollViewDidEndDecelating()
function.
Also invokes the function before using loadPageSectionScroll().
The checkDragRangesInHorizontalScroll()
function compares the difference between the date on the screen that I am viewing and the date that is limited.
I couldn't analyze all the sources. So I don't think this is a good way. But it works! (CAUTION: Not many tests try.)