screenloc not actually centered after changing scalefactor (was Screen Resolution for Desktop Apps)
J. Landman Gay
jacque at hyperactivesw.com
Mon Jan 1 18:34:26 EST 2018
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
More information about the use-livecode
mailing list