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

Enhancement/add touch to sliders #470

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

MihailTodorov
Copy link
Contributor

  • Self-reviewed and fixed any obvious mistakes, TODOs, removed debugging code, logs, etc
  • Updated package.json in related components, the library or the cli
  • Created tests
  • Tested in a browser
  • Tested in Gameface
  • Created or updated the documentation
  • Transferred or updated the Hugo documentation and example

Remove any item from the list if not applicable by editing this message.

Comment on lines +257 to +262
if (targetClassList && (targetClassList.contains('guic-horizontal-rangeslider-handle') ||
targetClassList.contains('guic-vertical-rangeslider-handle')) ) {
targetClassList.contains('handle-1') ? this.activeHandle = 1 : this.activeHandle = 0;
} else {
this.activeHandle = this.getClosestHandleToMousePosition(percent);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we directly check if the classList contains 'handle-1' and omit the rest checks?Why do we want to check for the horizontal or vertical rangeslider handle? Is it possible another element to have the class 'handle-1'?

Also as we have the refs to the handles, can't we simply check by ref the target?
For example:

if(e.target === this.handle[0]) this.activeHandle = 0;
else if(e.target === this.handle[1]) this.activeHandle = 1;
else this.activeHandle = this.getClosestHandleToMousePosition(percent);

@MihailTodorov MihailTodorov merged commit 998448e into master Jan 28, 2025
2 of 4 checks passed
@MihailTodorov MihailTodorov deleted the enhancement/add-touch-to-sliders branch January 28, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants