PDA

View Full Version : Anchoring to resizable windows/panels on the bottom or right edge



Ken L
December 14th, 2018, 00:18
This seem to produce unexpected behaviors. I've noticed that sometimes it seems to happily follow the edge, and other times, only for initial positioning then ignoring the edge completely afterward.

https://giant.gfycat.com/SlimDaringBlueandgoldmackaw.webm

The panel defines are as follows (3.3.7)


<panel name="characterlistanchor">
<class>shortcutsanchor</class>
<bounds>100,-122,0,0</bounds>
<disabled />
</panel>
<panel name="characterlist">
<class>characterlist</class>
<bounds>5,-140,1,1</bounds>
</panel>

<panel name="chat" modes="host">
<class>chat</class>
<anchored width="414" height="350">
<right offset="-5"/>
<bottom offset="-100" />
</anchored>
<!--<bounds>-414,-450,-15,-150</bounds>-->
<dynamic />
<locked />
</panel>

<panel name="chat" modes="client,local">
<class>chat</class>
<bounds>-414,-450,-15,-150</bounds>
<dynamic />
<locked />
</panel>

<panel name="modifierstack" modes="host,client,local">
<class>modifierstack</class>
<anchored width="64" height="57">
<left parent="chat" offset="0" anchor="left" />
<bottom parent="chat" offset="0" anchor="top" />
</anchored>
<dynamic />
<locked />
</panel>

<panel name="identitylist" modes="host">
<class>identitylist</class>
<anchored height="20">
<left parent="chat" />
<top parent="chat" anchor="bottom" offset="0" />
<right/>
</anchored>
</panel>

<panel name="stack_ui_minor" nodes="host,client">
<class>stack_ui_minor</class>
<anchored width="192" height="32">
<left parent="modifierstack" offset="0" anchor="left" />
<top parent="modifierstack" offset="-37" anchor="top" />
</anchored>
<locked />
</panel>

<panel name="stack_ui_major" nodes="host,client">
<class>stack_ui_major</class>
<anchored width="42" height="42">
<right parent="stack_ui_minor" offset="-3" anchor="left" />
<top parent="stack_ui_minor" offset="0" anchor="top" />
</anchored>
<locked />
</panel>

<panel name="shortcuts" nodes="host,client">
<class>shortcuts</class>
<anchored width="192" height="96">
<left parent="stack_ui_minor" offset="18" anchor="right" />
<top parent="stack_ui_minor" offset="0" anchor="top" />
</anchored>
<locked />
</panel>

<panel name="dicetower" modes="host,client">
<anchored height="100" width="100">
<bottom parent="chat" anchor="bottom" offset="0" />
<right parent="chat" anchor="left" />
</anchored>
<class>dicetower</class>
<dynamic />
<locked />
</panel>

<panel name="ct_panel" modes="host">
...
<anchored>
<top />
<left parent="chat" offset="0" anchor="left" />
<right parent="chat" offset="0" anchor="right" />
<bottom parent="stack_ui_minor" offset="-0" anchor="top" />
</anchored>
<dynamic/>
<locked/>
</panel>


relevant windowclass defines:


<windowclass name="chat">
<noclose />
<sizelimits>
<dynamic />
<minimum width="414" height="350" />
</sizelimits>
...
...
</windowclass>


<windowclass name="identitylist">
<sizelimits>
<minimum height="20" />
</sizelimits>
...
</windowclass>

<windowclass name="dicetower" merge="join">
<sizelimits merge="replace">
<minimum width="100" height="100" />
</sizelimits>
<noclose />
...
</windowclass>



As a bonus, despite all these defines, my chat window spawns in the upper left hand corner like an idiot when I launch the campaign. Even if I close with a different position.
https://giant.gfycat.com/FrigidClearAmericanbittern.webm

Ken L
December 14th, 2018, 22:51
*edit*

It actually seems to be an timing issue, I have a script that gets the chat position but onInit it returns its position as 0 0 despite all the anchoring and bound defines. It seems at early init, the position of the chat window is undetermined despite the defines.

Moon Wizard
December 14th, 2018, 23:18
Top-level windows are laid out before onInit is called, because they manage their own size and that can happen. Because panels are laid out in a globally and need to allow initialization before they are first laid out, the onInit is handled before the first layout occurs.

You might also look at the onFirstLayout event I added in v3.3.7, which is triggered after the window calculates full layout for the first time.

Regards,
JPG