help with a text popup [possible bug?]

  • hi there to the experienced :)

    could you help me with a dynamic and responsive text popup ?

    1) it should be defined by width and a (minimal) height
    2) the height should scale/auto adjust to the given text
    3) if the screen gets smaller than the given width / height
    there should be a (10px) padding to the screen borders
    (overriding the autoheight feature)

    anybody with a good setup for this?

    it maybe needs more than one layer, and i couldnt get it right yet...
    if possible without event actions is preferred (ie. onresize for the padding)

    index *rolleyes*

  • below is what i've come up with so far
    (couldnt think of a method without event)

    for layer[popup] there are options i tried,
    but each version fails in some aspect.... see comments

    note: intention is dynamic creation of popups,
    so it must work for different widths, minheights and text(sizes)

    the resize event takes care of the padding. seems to work well

    Code
    <events name="popup_events" keep="true" onresize="popup_resize();" />
    <action name="popup_resize">
    	calc(layer[popup].maxwidth, stagewidth - 10);
    	calc(layer[popup].maxheight, stageheight - 10);
    </action>


    now to the popup itself...

    version 1) good! it is centered and the height scales to text

    Code
    <layer name="popup" keep="true"
    	type="text" html="some text[br]some text[br]some text[br]some text[br]some text[br]some text[br]some text"
    	align="center" edge="center"
    	width="800"
    	height="" minheight="10">


    version 2) just a different minheight and suddenly not centered anymore???

    Code
    <layer name="popup" keep="true"
    	type="text" html="some text[br]some text[br]some text[br]some text[br]some text[br]some text[br]some text"
    	align="center" edge="center"
    	width="800"
    	height="" minheight="600">


    version 3) hm, with a height of 1 it gets centered again

    Code
    <layer name="popup" keep="true"
    	type="text" html="some text[br]some text[br]some text[br]some text[br]some text[br]some text[br]some text"
    	align="center" edge="center"
    	width="800"
    	height="1" minheight="600">


    version 4) but now with the small minheight it is not adjusting to the text anymore

    Code
    <layer name="popup" keep="true"
    	type="text" html="some text[br]some text[br]some text[br]some text[br]some text[br]some text[br]some text"
    	align="center" edge="center"
    	width="800"
    	height="1" minheight="10">


    bollocks! *cursing*


    really strange is version 1/2 ...
    the popup adjusts to the text if the given minheight is too small,
    but the vertical centering gets messed up..
    the higher the minheight value, the more the popup is moving to the top edge

    is this a bug?

    (all tests were done with 1.19pr10)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!