Page 2 of 2

Re: fitting to screen size

Posted: Fri Jul 27, 2018 6:24 pm
by jacque
For fullscreenmode, set it up in a preOpenStack handler, and since you don't care about distortion, use exactFit as first recommended:

Code: Select all

on preOpenStack 
   if the environment is "mobile" then 
      set the fullscreenmode of this stack to "exactFit" 
   end if
end preOpenStack 

Re: fitting to screen size

Posted: Fri Jul 27, 2018 9:13 pm
by bogs
Hm. I think I did something similarly a long time ago when I first started working with Lc. If I recall correctly, I actually used the reported screenRect to choose the scale factor. Mind you, though, that I only ever played with this on desktops and have no idea what it would do on a mobile device. To boot, the code isn't exactly great code (inexperienced with the language at the time of writing, never revisited it). These were the two original methods I used (ScalingDemo and ScalingDemoTwo).

A minimum of Lc 6.7.x is required for the 2nd one, as scalefactor was introduced at that time.
Scaling Demos
ajperks wrote:
Fri Jul 27, 2018 3:26 pm

Yes, I know a table field could contain the scale value, but the cells are to small to put a value in, physically.
You can set the size of the table cells (if I understand correctly that is the problem), and even edit them directly (or prevent them from being edited, if that is undesirable).

Hope that helps :)

Re: fitting to screen size

Posted: Sat Jul 28, 2018 12:18 am
by FourthWorld
So much has improved since the scaleFactor was introduced. For the last several versions LC now renders in logical pixels according to the device specs automatically. LC's resolution independence today is quite good.

It's now very rare that anyone is working on something exotic enough to require manually translating between logical pixels and physical pixels using scaleFactor.

Re: fitting to screen size

Posted: Sat Jul 28, 2018 4:27 pm
by bogs
From his postings, it does seem he has an intention for which scalefactor may be a better fit. Of course, I work pretty far behind the newer versions, so perhaps you could give him an example of how to use what your talking about to achieve his goal?

Just to bring his goals up to the forefront again -
ajperks wrote:
Fri Jul 27, 2018 12:09 pm
Also I need to clarify what I am doing, why I am doing it and what on.
I am attempting to fit a fixed card size, designed for a specific desktop monitor/screen to a smartphone. ...<sic>...

...<sic>...The fact the image will be small and distorted beyond reason, is not a concern. Neither is the fact that desktop buttons rather than smartphone style controls are used. They actually work well, from what is visible so far.
Once I find what works, I can create a new program that interfaces properly.

...<sic>...The Phone/tablet component is for viewing and interacting, like you might with a Facebook App, but the desktop component provides the design and creation of data that is not practical on a small screen, touch device.

OK, The Rectangle method works well for the stack, but I cannot resize the card the same way, so this is not a complete solution.

The fullscreenmode and options does not work at all, for me. It stays in the same location and size as the stack is saved in. Dictionary does not explain why it fails. No solution here.

Any more ideas?
I have tried other things, but scalefactor of stack seems to work perfectly for a set ratio
The little poorly written demo I posted scales windows in the way it looks to me like he is looking to do (minus font adjusting, etc., which should be easy enough to adjust), although I have no way to test which of the lower scales would look on anything mobile, when I was testing it I used a vm and set the resolutions to verify it "looked" right.

Examples (due to the way the board displays shots in default, 1080 and 768 look the same below, but open them in separate windows and the difference is readily apparent) -
Scaling Demo 2_003.png
Scaling Demo 2_004.png
Scaling Demo 2_005.png
Scaling Demo 2_005.png (19.52 KiB) Viewed 1232 times
...but if there is currently a better way to implement it by all means share :)

Re: fitting to screen size

Posted: Sun Jul 29, 2018 8:54 pm
by jacque
perhaps you could give him an example of how to use what your talking about to achieve his goal?
Since this is only intended to test functionality and appearance doesn't matter, I'd do this:

Code: Select all

on preOpenStack
  if the environment is "mobile" then
    mobileSetAllowedOrientations "landscape left,landscape right"
    set the fullscreenMode of this stack to "exactFit"
  end if
end preOpenstack
This assumes that a desktop stack will be wider than it is high, so on mobile it should display in landscape mode. If that's not the case then add to or replace the orientations with "portrait,portrait upside down".

When the app launches on mobile, it should automatically resize itself to the size of the mobile screen. It will be distorted if the screen ratio is not the same as the original stack size ratio. To keep the original ratio use "showAll" instead; the entire content will be scaled and displayed. If you do not set any fullscreenMode at all (or use fullscreenMode "empty",) the default method is to align the stack at the upper left corner with any remaining content clipped where it exceeds the screen dimensions.

Re: fitting to screen size

Posted: Mon Jul 30, 2018 3:55 am
by bogs
I hope that is helpful for the Op. I did come across this nifty chart showing a bunch of resolutions (I was curious since I have no mobile awareness :D ). I doubt it will be as helpful as Jacque's tip though ;)

*Edit - it is interesting to me to find out a great deal of those have resolutions similar to my desktop :shock: with quite a few larger than my laptop (15.1") :? :?