contectRect and scaleFactor

Dan Friedman dan at clearvisiontech.com
Wed Jun 7 14:57:44 EDT 2017


So, I have a stack that I set the scaleFactor to 1.5 if it’s on a iPhone (I leave it at 1 if it’s an iPad).  All is fine, looks great!   However, when I add a native scroller to a locked group, the contectRect doesn’t take the scaleFactor into account.  So, the scroller scrolls too far to the right and the bottom.  I would have thought this would have fixed it, but it’s not right:

if the scaleFactor of this stack <> 1 then
    put the scaleFactor of this stack into tFactor
    put mobileControlGet(scrollerName,"contentRect") into fRect

    put round(item 3 of fRect/ tFactor) into item 3 of fRect
    subtract round(item 1 of fRect/ tFactor) from item 3 of fRect

    put round(item 4 of fRect/ tFactor) into item 4 of fRect
    subtract round(item 2 of fRect/ tFactor) from item 4 of fRect

    mobileControlSet scrollerName,"contentRect",fRect
end if

Anyone have any ideas how to correct the scroller so it correctly stays in the bounds like it does when  the scaleFactor = 1?

Thanks in advance!
-Dan


More information about the use-livecode mailing list