Klaus,

My setBackground handler doesn't give a direct translation, but does start
it.
https://github.com/bwmilby/mobileDemo/blob/48b89b37aba41afb5a7b90cfc9bdbbca9e7f052c/mobileDemo_Scripts/stack_MobileDemo_card_id_1002.livecodescript#L105

Since we are talking about portrait on mobile, the extra space will always
be in the height direction.  That simplifies a few things.  The height of
the screen from the card perspective will be:
   put tCardW / (tScreenW / tScreenH) into tNewH
You will need 3 things to calculate positions.  A ratio for each direction
and a height offset.
   put (tNewH - tCardH) / 2 into tHOffset -- 1/2 of the extra pixels with
be at the top
   put tNewH / tScreenH into tHRatio -- convert screen pixels to card pixels
   put tCardW / tScreenW into tWRatio -- convert screen pixels to card
pixels

Using this, you should be able to calculate a card XY value from a screen
XY value (safe XY for example).
   put (tScreenY * tHRatio) - tHOffset into tCardY
   put (tScreenX * tWRatio) into tCardX

This is without testing though.  I'll try to do a test to validate my
method.  And remember, that anything placed outside the bounds of the card
will just be there for looks and probably won't respond to touch.

Thanks,
Brian

On Tue, Oct 18, 2022 at 9:39 AM Klaus major-k via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Hi Mark,
>
>
> yes, sure, but i'd like to avoid this and currently only need an answer to
> my question.
>
>
> Best
>
> Klaus
> --
> Klaus Major
> https://www.major-k.de
> https://www.major-k.de/bass
> kl...@major-k.de
>
>
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to