fullscreenmode and rect of a substack on mobile device ?

Brian Milby brian at milby7.com
Thu Aug 23 21:30:39 EDT 2018


@Ludovic / @Jacque

If you are just wanting a background to cover the extra space, why not just
make it oversized and not worry about adjusting it?

The original stack worked fine on my iPad (since it was sized at the same
resolution).  I made it a substack of another one and used a button to "go
stack ipad".  It filled the entire screen.  On my iPhone 8 Plus, the resize
did not work correctly.  Here's a handler that will take care of it on my
phone properly:

on fixBackground
   local tCardW, tScreenW, tScreenH, tNewH
   put the width of this card into tCardW
   put item 3 of the screenrect into tScreenW
   put item 4 of the screenrect into tScreenH
   put tCardW / (tScreenW / tScreenH) into tNewH
   set the height of grc "bkg" to tNewH
   set the loc of grc "bkg" to the loc of this card
end fixBackground

I added the size logging to the `openCard` handler and everything reports
the dimensions of the phone (this stack/this cd/stack "ipad").  Same
numbers before/after the FSM call.  If I did a send "fixbackground" to me
in 0 ms, then it was wrong (based on screenrect).  If I did a send
"fixbackground" to me in 10 ms then it worked fine (I can see the
background jump though).

The above code only works in one direction (W/H ratio is smaller than
iPad).  To cover both variations, you would need to check and possibly do
the opposite (adjust the background width).  I don't know if any
phones/tablets would cause an issue there.  The code wouldn't be difficult
though.

As to the location of the stack... since resize is not sent when in FSM,
the stack is reporting the rect from when it was last saved on the
desktop.  It doesn't really matter though.  My approach doesn't care about
the actual stack rect, only the H/W dimensions.

Thanks,
Brian



More information about the use-livecode mailing list