DMCircularScrollView icon indicating copy to clipboard operation
DMCircularScrollView copied to clipboard

if page size is set to 320 and view width to 320, it doesnt work

Open ekimia opened this issue 12 years ago • 4 comments

any ideas why so i could fix it maybe?

ekimia avatar Feb 07 '13 05:02 ekimia

if set to sometihng like 300, it can actually scroll to the left without an issue, just cant to the rigth

ekimia avatar Feb 07 '13 05:02 ekimia

The problem appears to be related to the reloadData method where 'visibilePages' is calculated.

NSUInteger visiblePages = ceilf(self.frame.size.width/self.pageSize.width);

If self.frame.size.width is evenly divisible by self.pageSize.width (e.g. 320/320) the contentSize of the scrollView. I think what we need to do here is perform a modulo between the two values and if the output is 0 (i.e. the values are evenly divisible) then we want visiblePages + 1

if (fmodf(self.frame.size.width, self.pageSize.width) == 0)
{
    visiblePages += 1;
}

I hope this helps.

lennypham avatar Apr 18 '13 16:04 lennypham

Wrong.

should be

visiblePages += 2;

keyclipse avatar Dec 04 '13 08:12 keyclipse

nope. should be

if (fmodf(self.frame.size.width, self.pageSize.width) == 0)
    {
        visiblePages += 2;
    }
    else
    {
        visiblePages += 1;
    }

tahabebek avatar Mar 04 '14 00:03 tahabebek