Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added hotkey for ESC key to scroll chat to bottom #547

Merged
merged 11 commits into from
Nov 15, 2024

Conversation

Voiture-0
Copy link
Contributor

@Voiture-0 Voiture-0 commented Nov 6, 2024

This update introduces a hotkey function similar to Discord's. When the chat window is scrolled up, pressing ESC will bring the view back to the latest messages.

In DGG, if the chat is not already pinned to the bottom, pressing ESC will scroll it down. However, if any menus are open (e.g., emote or settings), ESC will first close those menus instead of scrolling. Scrolling will only occur when there are no other actions for ESC to perform.

assets/chat/js/chat.js Outdated Show resolved Hide resolved
@Voiture-0 Voiture-0 force-pushed the feature/escape-pins-chat branch from bf62375 to 44355fc Compare November 7, 2024 17:42
assets/chat/js/chat.js Outdated Show resolved Hide resolved
Copy link
Contributor

@11k 11k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind merging in master and making it so that if an event bar event is selected, ESC would unselect it? This can occur after the menu check, but before the pinned check.

Also, I'd like you to remove the comments and switch to if statements that aren't single-line/braceless.

@@ -415,7 +415,13 @@ class Chat {

// ESC
document.addEventListener('keydown', (e) => {
if (isKeyCode(e, KEYCODES.ESC)) ChatMenu.closeMenus(this); // ESC key
if (isKeyCode(e, KEYCODES.ESC)) {
const activeView = this.getActiveWindow().scrollplugin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can go ahead and add a method to ChatWindow that scrolls it to the bottom so you don't have to interface with its scroll plugin directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Added methods on ChatWindow to interface with its scroll plugin

@11k 11k added the enhancement New feature or request label Nov 14, 2024
@Voiture-0
Copy link
Contributor Author

Voiture-0 commented Nov 15, 2024

@11k

Would you mind merging in master and making it so that if an event bar event is selected, ESC would unselect it? This can occur after the menu check, but before the pinned check.

Also, I'd like you to remove the comments and switch to if statements that aren't single-line/braceless.

Updated!

I also added clearing the user focus as well, as the lowest priority check. Let me know if you think that is okay or if I should removed that part entirely.

@11k 11k merged commit c86d965 into destinygg:master Nov 15, 2024
2 checks passed
@Voiture-0 Voiture-0 deleted the feature/escape-pins-chat branch November 16, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants