Index: binaries/data/mods/public/gui/session/chat/Chat.js =================================================================== --- binaries/data/mods/public/gui/session/chat/Chat.js +++ binaries/data/mods/public/gui/session/chat/Chat.js @@ -22,6 +22,15 @@ this.ChatAddressees.registerSelectionChangeHandler(this.ChatInput.onSelectionChange.bind(this.ChatInput)); this.ChatAddressees.registerSelectionChangeHandler(this.ChatWindow.onSelectionChange.bind(this.ChatWindow)); + const maxCaptionSizeRight = this.Margin + Math.max( + this.ChatHistory.getCaptionSizeRight(), + this.ChatInput.getCaptionSizeRight(), + this.ChatAddressees.getCaptionSizeRight()); + + this.ChatHistory.align(maxCaptionSizeRight); + this.ChatInput.align(maxCaptionSizeRight); + this.ChatAddressees.align(maxCaptionSizeRight); + this.ChatMessageHandler = new ChatMessageHandler(); this.ChatMessageHandler.registerMessageFormatClass(ChatMessageFormatNetwork); this.ChatMessageHandler.registerMessageFormatClass(ChatMessageFormatSimulation); @@ -95,3 +104,5 @@ }); } } + +Chat.prototype.Margin = 15; Index: binaries/data/mods/public/gui/session/chat/ChatAddressees.js =================================================================== --- binaries/data/mods/public/gui/session/chat/ChatAddressees.js +++ binaries/data/mods/public/gui/session/chat/ChatAddressees.js @@ -7,10 +7,28 @@ { this.selectionChangeHandlers = []; + this.chatAddresseeCaption = Engine.GetGUIObjectByName("chatAddresseeCaption"); + this.chatAddressee = Engine.GetGUIObjectByName("chatAddressee"); this.chatAddressee.onSelectionChange = this.onSelectionChange.bind(this); } + getCaptionSizeRight() + { + return this.chatAddresseeCaption.size.left + Engine.GetTextWidth(this.chatAddresseeCaption.font, this.chatAddresseeCaption.caption); + } + + align(horizPos) + { + const chatAddresseeCaptionSize = this.chatAddresseeCaption.size; + chatAddresseeCaptionSize.right = horizPos; + this.chatAddresseeCaption.size = chatAddresseeCaptionSize; + + const chatAddresseeSize = this.chatAddressee.size; + chatAddresseeSize.left = horizPos; + this.chatAddressee.size = chatAddresseeSize; + } + registerSelectionChangeHandler(handler) { this.selectionChangeHandlers.push(handler); Index: binaries/data/mods/public/gui/session/chat/ChatHistory.js =================================================================== --- binaries/data/mods/public/gui/session/chat/ChatHistory.js +++ binaries/data/mods/public/gui/session/chat/ChatHistory.js @@ -13,6 +13,8 @@ this.selectionChangeHandlers = []; + this.chatHistoryFilterCaption = Engine.GetGUIObjectByName("chatHistoryFilterCaption"); + this.chatHistoryFilter = Engine.GetGUIObjectByName("chatHistoryFilter"); let filters = prepareForDropdown(this.Filters.filter(chatFilter => !chatFilter.hidden)); this.chatHistoryFilter.list = filters.text.map(text => translateWithContext("chat history filter", text)); @@ -23,6 +25,22 @@ this.chatHistoryText = Engine.GetGUIObjectByName("chatHistoryText"); } + getCaptionSizeRight() + { + return this.chatHistoryFilterCaption.size.left + Engine.GetTextWidth(this.chatHistoryFilterCaption.font, this.chatHistoryFilterCaption.caption); + } + + align(horizPos) + { + const chatHistoryFilterCaptionSize = this.chatHistoryFilterCaption.size; + chatHistoryFilterCaptionSize.right = horizPos; + this.chatHistoryFilterCaption.size = chatHistoryFilterCaptionSize; + + const chatHistoryFilterSize = this.chatHistoryFilter.size; + chatHistoryFilterSize.left = horizPos; + this.chatHistoryFilter.size = chatHistoryFilterSize; + } + registerSelectionChangeHandler(handler) { this.selectionChangeHandlers.push(handler); Index: binaries/data/mods/public/gui/session/chat/ChatInput.js =================================================================== --- binaries/data/mods/public/gui/session/chat/ChatInput.js +++ binaries/data/mods/public/gui/session/chat/ChatInput.js @@ -9,6 +9,8 @@ this.chatSubmitHandlers = []; this.chatSubmittedHandlers = []; + this.chatInputCaption = Engine.GetGUIObjectByName("chatInputCaption"); + this.chatInput = Engine.GetGUIObjectByName("chatInput"); this.chatInput.onPress = this.submitChatInput.bind(this); this.chatInput.onTab = this.autoComplete.bind(this); @@ -19,6 +21,22 @@ registerHotkeyChangeHandler(this.onHotkeyChange.bind(this)); } + getCaptionSizeRight() + { + return this.chatInputCaption.size.left + Engine.GetTextWidth(this.chatInputCaption.font, this.chatInputCaption.caption); + } + + align(horizPos) + { + const chatInputCaptionSize = this.chatInputCaption.size; + chatInputCaptionSize.right = horizPos; + this.chatInputCaption.size = chatInputCaptionSize; + + const chatInputSize = this.chatInput.size; + chatInputSize.left = horizPos; + this.chatInput.size = chatInputSize; + } + onHotkeyChange() { let tooltip = this.getInputHotkeyTooltip() + this.getOpenHotkeyTooltip(); Index: binaries/data/mods/public/gui/session/chat/chat_window.xml =================================================================== --- binaries/data/mods/public/gui/session/chat/chat_window.xml +++ binaries/data/mods/public/gui/session/chat/chat_window.xml @@ -15,7 +15,7 @@ - + Filter: @@ -42,7 +42,7 @@ - + To: - + Text: