JTAppleCalendar icon indicating copy to clipboard operation
JTAppleCalendar copied to clipboard

errorDelta value in scrollToSegment

Open sambong0113 opened this issue 6 years ago • 6 comments

(Required) Version Number: v.8.0.0. ipad

Description

My calendarView frame.width(fixedScrollSize) is 931.875 and scrollMode is horizontal I just did scrollToSegment(.next) in my project, but it doesn't scroll next section every four months.

Then I read your scrollToSegment code and I found that difference between rounded section value and my section value is higher than your errorDelta value. For example, in section 55 my section value comes 54.99986586183769.

So When I change error Delta to 0.001. It works fine. Please fix this error.

Steps To Reproduce

Expected Behavior

Additional Context

sambong0113 avatar Aug 28 '19 07:08 sambong0113

will fix

patchthecode avatar Sep 02 '19 12:09 patchthecode

Hmm, The code i have there is

if abs(roundedSection - section) < errorDelta { section = roundedSection }

and my errorDelta is

let errorDelta: CGFloat = 0.0000001

So are you saying that your value was less than this? I am confused because you are setting it at a higher value

patchthecode avatar Sep 04 '19 21:09 patchthecode

When I call scrollToSegment(.next),

abs(roundedSection - section)

value is bigger than errorDelta. So It didn't scroll to next segment.

This bug just occur periodically.

sambong0113 avatar Sep 05 '19 10:09 sambong0113

ok thanks. In that case, I think i need better logic than using an error delta. I'll rethink this over the weekend.

patchthecode avatar Sep 05 '19 10:09 patchthecode

In my case, My fixed scroll Size is 931.875, but difference between each section offset value is 932 or 931.5(periodically).

I hope it'll be helpful.

sambong0113 avatar Sep 05 '19 10:09 sambong0113

Hi. Is is fixed?

sambong0113 avatar Sep 21 '19 11:09 sambong0113