browser&scroller: fullscreen(mode) bugs?

Interested adding compiled externals from LiveCode and third parties to your LiveCode projects? This is the place to talk about them.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rmuzzini
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Mon Oct 08, 2012 11:30 am

browser&scroller: fullscreen(mode) bugs?

Post by rmuzzini » Mon Jul 21, 2014 9:19 am

using LC 6.6.2, i'm getting strange behaviors related to the "new" fullscreen LC feature. as if the new geometry was not reflected on "external" object (i.e browser on desktop and scroller on mobile).
i had a look @ http://quality.runrev.com/ but i didn't find any about.
therefore it could be a bug or i missed something.
surely, it seems quite strange to me nobody got these bugs yet. so, probably i missed something…

scenario 1:
desktop application.
create a browser instance setting its rect like (for example) the rect of a hidden img, i.e. = the rect of img "browserimage" (following LC example stack).
open the browser: good, it's where you expected it to be, of course.
now set the fullscreenmode to "letterbox" and switch to fullscreen. due to the stack rect aspect ratio not matching that one of your screen (i.e 4/3 on a 16/9 display) you get blank spaces on left & right side (or top & bottom, depending on aspect ratio).
now open the browser again: ops! it is where it should be with fullscreen=false (and it is smaller, consequently): the rect is still the "real" one, despite the fullscreen "true".

that is a bug, in my opinion… isn't it?
[tested on osx, i had no time to test it on windows]

to fix that "bug" i had to write a function to return relative rect coordinates, based on the screenrect/stack rect ratio.

scenario 2:
mobile application.
create a scroller setting its rect & content rect as usual (i.e. rect = the rect of field, content rect = 0,0, the formattedwidth of field, the formattedheight of field).
run the app. if the stack aspect ratio matches the screen size, no problem. but that is quite impossible, due to the multitude of different screen sizes on the android side (one of the main reason LC guys implemented the fullscreen properties, after all…).
so, if it's not the lucky case, and fullscreenmode is letterbox, then -again- the scroller behavior is wrong: scrollerDidScroll has wrong parameter passed (the real pOffsetX - the left blank space, the real pOffsetY - the top blank space: yes, negative numbers at start!) and you can't rightly reach the end of the content rect, this way.
again: that is a bug, in my opinion… isn't it?
[the above example is about fields, but the same occurs with groups and datagrids as well. tested on iOS and android]

to fix this one i had to write a function to get the blank spaces size and "move" the contentRect according to.


any comments?
maybe i missed something, and i'd be glad to know more about.
whilst, if i'm right i'll post these bugs on http://quality.runrev.com/

appendix: the code i'm using as a fix:

Code: Select all


on openBrowser
[…]
   mobileControlSet sBrowserId, "rect", getRect(the rect of image "browserimage")
[…]
end openBrowser

on createController
[…]
   put getGap() into tGap
   mobileControlSet sScrollerId, "contentRect", "0,0," & (the dgFormattedWidth of me)+tGap["W"] & "," & (the dgFormattedHeight of me)+tGap["H"]
   //mobileControlSet sScrollerId, "contentRect", (0,0,the formattedWidth of me+tGap["W"),the formattedHeight of me+tGap["H") //for field or group
[…]
end createController

function getRect tRect
   if the fullscreen of this stack then      
      put item 3 of tRect - item 1 of tRect into tWidth
      put item 4 of tRect - item 2 of tRect into tHeight
      put item 3 of the screenRect into tRight
      put item 4 of the screenRect into tBottom
      
      put getGap() into tGap
        
      #the new rect
      put (tRight - trunc(tWidth*tGap["ratio"])-tGap["W"]) & "," & (tBottom- trunc(tHeight*tGap["ratio"])-tGap["H"]) & "," & tRight-tGap["W"] & "," & tBottom-tGap["H"] into tRect
   end if
   return tRect
end getRect

function getGap
   put 0 into tGapW
   put 0 into tGapH
   put 1 into tRatio

   if the fullscreenmode of this stack is "letterbox" then      
      put item 1 of the screenRect into tLeft
      put item 2 of the screenRect into tTop
      put item 3 of the screenRect into tRight
      put item 4 of the screenRect into tBottom
      
      put (tRight-tLeft) into tWidthS
      put (tBottom-tTop) into tHeightS
      put (tWidthS / the width of this stack) into tRatioX
      put (tHeightS / the height of this stack) into tRatioY
      put min(tRatioX,tRatioY) into tRatio //needed to calculate the object's new width&height.
      #and the following to get rid of the blank spaces
      put (tWidthS - the width of this stack*tRatio)/2 Into tGapW
      put (tHeightS - the height of this stack*tRatio)/2 Into tGapH
   end if
   put tGapW into tGap["W"]
   put tGapH into tGap["H"]
   put tRatio into tGap["ratio"]
   return tGap
end getGap

Post Reply

Return to “Using Externals”