GMGridView icon indicating copy to clipboard operation
GMGridView copied to clipboard

Bug when calling scrollToObjectAtIndex with paging enabled (paged horizontal layout strategy)

Open mtrubnikov opened this issue 12 years ago • 4 comments

When calling scrollToObjectAtIndex with paging enabled (paged horizontal layout strategy) and centerGrid = YES targetRect is calculated wrong. The problem seems to be that we have edgeInsets not equal 0; so - (CGRect)rectForPoint:(CGPoint)point inPaggingMode:(BOOL)paging returns rect for another cell (row+1 and column+1).

mtrubnikov avatar May 16 '12 22:05 mtrubnikov

This is a real problem - seems that even pageSize calculation is wrong...

mtrubnikov avatar May 17 '12 16:05 mtrubnikov

I guess there is a link with https://github.com/gmoledina/GMGridView/issues/103

jrmgx avatar May 18 '12 10:05 jrmgx

The pageSize calculation seems to be OK, the problem is in the while condition: while (originScroll.x + pageSize.width < point.x) ---> should be while (originScroll.x + pageSize.width <= point.x) { originScroll.x += pageSize.width; }

    while (originScroll.y + pageSize.height < point.y) ----> Should be  while (originScroll.y + pageSize.height <= point.y) 

    {
        originScroll.y += pageSize.height;
    }

In any case in the commit e575ce2 Mar, 11, 2012 There is a change that introduce a new method named

  • (CGRect)rectForPoint: inPaggingMode: that seems to fix the problem. I have not had time to verify, I will let you know.

jfeijoob avatar May 23 '12 09:05 jfeijoob

Still doesn't work I think.

narup avatar Sep 30 '12 22:09 narup