screenloc not actually centered after changing scalefactor (was Screen Resolution for Desktop Apps)

Nicolas Cueto niconiko at gmail.com
Thu Jan 4 00:52:14 EST 2018


Jacqueline yet again saves the day. Thank you!

--
N.

On 2 January 2018 at 08:34, J. Landman Gay via use-livecode <
use-livecode at lists.runrev.com> wrote:

> On 12/31/17 7:31 PM, Nicolas Cueto via use-livecode wrote:
>
>> To do "some calculations", I thought of comparing the loc to the
>> scalefactor. So ran the standalone on three devices, but saw no consistent
>> corelation between the differing locs and the scalefactor.
>>
>> So, still no clue what to use for these calculations...
>>
>
> My math skills are terrible so we need someone more clever to fix my
> calculation. But this seems to work for most scalefactors until you get
> down to about 0.6 or lower:
>
> on setloc pScale
>   -- pScale = the desired scaleFactor
>   put the screenloc into tSLoc
>   if pScale <= 1 then
>     put 1 + (1-pScale) into tRatio
>   else
>     put 1/pScale into tRatio
>   end if
>   put item 1 of tSLoc * tRatio into item 1 of tNewLoc
>   put item 2 of tSLoc * tRatio into item 2 of tNewLoc
>   set the scalefactor of this stack to pScale
>   set the loc of this stack to tNewLoc
> end setloc
>
> I'm pretty sure there's a way to calculate the ratio without the "if"
> clause so that it works for both large and small scales and I'm not sure
> why it breaks at about 0.6. Hopefully one of our math gurus can advise.
>
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list