From e574e54a53b87ef4bbb33404b6fdb6b97c72dd81 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:45:51 -0500 Subject: allow selecting multiple chat tabs at the same time --- .../cc/woverflow/chatting/gui/components/TabButton.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/cc/woverflow/chatting/gui') diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt index f320925..e3b96f1 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt @@ -1,5 +1,6 @@ package cc.woverflow.chatting.gui.components +import cc.polyfrost.oneconfig.libs.universal.UKeyboard import cc.polyfrost.oneconfig.libs.universal.UResolution import cc.woverflow.chatting.chat.ChatTab import cc.woverflow.chatting.chat.ChatTabs @@ -21,11 +22,20 @@ class TabButton(buttonId: Int, x: Int, widthIn: Int, heightIn: Int, private val }) { override fun onMousePress() { - ChatTabs.currentTab = chatTab + if (UKeyboard.isShiftKeyDown()) { + if (ChatTabs.currentTabs.contains(chatTab)) { + ChatTabs.currentTabs.remove(chatTab) + } else { + ChatTabs.currentTabs.add(chatTab) + } + } else { + ChatTabs.currentTabs.clear() + ChatTabs.currentTabs.add(chatTab) + } } override fun isEnabled(): Boolean { - return chatTab != ChatTabs.currentTab + return ChatTabs.currentTabs.contains(chatTab) } companion object { -- cgit