Help: Dialog Centering with Toolkit Scale?

I use scaling for mobile using the Toolkit scale. It works fine, but not so with Dialogs. The scale seems to work fine but the coordinates are wrong, and it’s at the bottom right somewhat clipped. On windows and html, it’s centered, presumably because there is no scaling. If I disable scaling, the Dialog is centered. I want to make the two play nice.

I tried setting autoCenterDialog and centerDialog to true (which I believe also defaults to true from DialogBase). I tried styling margins of .dialog to auto. No luck.

I tried setting the dialog coordinates manually, and am able to do so only if I set centerDialog to false. So I suspect that the centering somewhat does the job, but incorrectly due to the scaling. Is this a bug or did I miss a step?

For additional info, I have autoscaling on (default) and adjusted the my main component’s dimensions based on the scale.

main.percentHeight = 100/Toolkit.scale;
main.percentWidth = 100/Toolkit.scale;

Hmm, ok, ill have a play, i guess the same issue happens on desktop if you explicitly scale the app? (Toolkit.scale = 2 or something similar?)

Cheers,
Ian

Well, thats certainly not centered:

:slight_smile:

Yes, got the same results on html. I was digging around in the forum and looking into the haxeui code to see if I missed something. I guess I didn’t and it’s a bug?

Yup, its certainly a bug… looking at it now

Ok, that should be fixed now in git version… I actually noticed some other little issues regarding scale, ive made a note to make some revisions, but there are fixes for the obvious ones i found.

Lemme know if that works for you.

Cheers,
Ian

2 Likes

Wow, that was fast! Thanks, I’ll switch to the git and take a look at the changes as well.

1 Like

It’s working perfect now, tested on mobile devices too. Thanks so much, Ian!

For the curious, this was the fix:
Scale Fixes

2 Likes

Great, glad thats fixed it… ive made a note on my list to review the scale handling so that maybe this type of fix isnt needed. But ill need to play with all backends first

Cheers,
Ian

1 Like