forked from mirrors/0ad
Fix chat line button sizing
The issue was that the rright value was 100%. That's why the buttons would always extend across the full width of the screen. Replacing the value right in the XML would result in an invalid size, so we can remove it from there and create a full, separate size in the code each time (Object.assign just edits it), since the top and bottom values specified in the XML were overwritten anyway. And since the left margin of 3 is fixed, we better move it to the parent object to avoid a constant like that in the code. Fixes #8322
This commit is contained in:
@@ -39,11 +39,11 @@ class ChatOverlay
|
||||
this.chatLines[i].caption = chatMessage.text;
|
||||
const newSize = this.chatLines[i].getPreferredTextSize();
|
||||
|
||||
Object.assign(this.chatLines[i].size, {
|
||||
this.chatLines[i].size = {
|
||||
"top": i * newSize.height,
|
||||
"bottom": (i + 1) * newSize.height,
|
||||
"right": this.chatLines[i].size.left + newSize.width
|
||||
});
|
||||
"right": newSize.width
|
||||
};
|
||||
|
||||
if (chatMessage.callback)
|
||||
this.chatLines[i].onPress = chatMessage.callback;
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
<include file="gui/session/TimeNotificationOverlay.xml"/>
|
||||
|
||||
<!-- Chat messages -->
|
||||
<object name="chatPanel" size="0 131 100% 100%-240" z="0" absolute="true">
|
||||
<object name="chatPanel" size="3 131 100% 100%-240" z="0" absolute="true">
|
||||
<object name="chatLines">
|
||||
<repeat count="20">
|
||||
<object name="chatLine[n]" size="3 0 100% 17" type="button" style="chatPanelOverlay" tooltip_style="sessionToolTipBottomBold" ghost="true" hidden="true"/>
|
||||
<object name="chatLine[n]" type="button" style="chatPanelOverlay" tooltip_style="sessionToolTipBottomBold" ghost="true" hidden="true"/>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user