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

Possible regression introduced between version 6.1.2 and 6.1.3 #344

Closed
boborbt opened this issue Mar 14, 2017 · 7 comments
Closed

Possible regression introduced between version 6.1.2 and 6.1.3 #344

boborbt opened this issue Mar 14, 2017 · 7 comments

Comments

@boborbt
Copy link

boborbt commented Mar 14, 2017

Hi, I'm experiencing a visual glitch on the first tap on my JTAppleCalendar: the whole calendar seems to be shifted downwards and rightwards by few points.

Context:

  • I create the calendar and then scroll to today (without animating the scroll);
  • then when I tap anywhere in the calendar the problem occurs;
  • the problem does not depend on didSelect didDeselect or didScrollToDateSegmentWith handlers: if I leave them empty the problem occurs anyway

I traced the problem down to some modification between versions 6.1.2 and 6.1.3. More in particular:

  • versions predating version 6.1 have bigger scrolling problems (probably they do not fully respect the animate: false option)
  • versions 6.1.1 and 6.1.2 work fine
  • versions 6.1.3 ~> 6.1.5 show the problem

Hope this helps to fix the problem. Thanks again for the great library.

@boborbt
Copy link
Author

boborbt commented Mar 14, 2017

Hi @patchthecode, I've done a bit of debugging and I tracked down the problem to this diff:

@@ -421,17 +410,15 @@ open class JTAppleCalendarView: UIView {
         }

         let section = CGFloat(Int(theTargetContentOffset / fixedScrollSize))
-        let destinationRectOffset = fixedScrollSize * section
-        var x: CGFloat = 0
-        var y: CGFloat = 0
-        if direction == .horizontal {
+        let destinationRectOffset = (fixedScrollSize * section) + 1
+        var x: CGFloat = 1
+        var y: CGFloat = 1
+        if scrollDirection == .horizontal {
             x = destinationRectOffset
         } else {
             y = destinationRectOffset
         }
-        retval = CGRect(x: x, y: y, width: calendarView.frame.width, height: calendarView.frame.height)
-
-        return retval
+        return CGPoint(x: x, y: y)
     }

In my testing reverting to the old way of calculating the resulting CGPoint solves the problem.

@patchthecode
Copy link
Owner

thanks for finding this.
This should be fixed already.

I may have accidentally put that code back in.
Let me check the master branch.

@boborbt
Copy link
Author

boborbt commented Mar 14, 2017

Nice to be helpful 😊

Feel free to close this issue if you think that you do not need it any more.

@patchthecode
Copy link
Owner

Oh ok. This is an issue that I have fixed on master branch already.
It will be released in the upcoming version.

If you want to use the master branch code, you can put his in your pod file:

pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git'

then do a pod install.
Thanks so much for the debugging!

@patchthecode
Copy link
Owner

I wil leave this issue open until i release, so that other will know.

@boborbt
Copy link
Author

boborbt commented Mar 14, 2017

I'm still with carthage 😊
and I can wait 😊

Thanks again. Bye.

@patchthecode
Copy link
Owner

closing issue
released 6.1.6

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

No branches or pull requests

2 participants