JZCalendarWeekView icon indicating copy to clipboard operation
JZCalendarWeekView copied to clipboard

Error : Fix limited scrolling range when dragging

Open aron1127 opened this issue 5 years ago • 0 comments

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 :

  1. Stop in the middle when you drag.
  2. The calendar automatically aligns with the screen.
  3. But if you start dragging again Before views are automatically sorted,
  4. 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.)

aron1127 avatar Sep 20 '19 05:09 aron1127