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

Fix disabled slider highlighting #78776

Merged

Conversation

NiskashY
Copy link
Contributor

Fix #78748

Added missing check for the grabber_area.

@NiskashY NiskashY requested a review from a team as a code owner June 27, 2023 23:35
@KoBeWi KoBeWi added this to the 4.2 milestone Jun 27, 2023
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works.

simplescreenrecorder-2023-06-28_08.40.25.mp4

Testing project: test_pr_78776.zip

@Calinou Calinou added cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.0 labels Jun 28, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Jun 28, 2023

Maybe it would be better to change highlighted instead?

bool highlighted = editable && (mouse_inside || has_focus());

Right now it's used only once, but technically it has wrong value if the Slider should never be highlighted when uneditable.

@NiskashY
Copy link
Contributor Author

NiskashY commented Jun 28, 2023

Maybe it would be better to change highlighted instead?

bool highlighted = editable && (mouse_inside || has_focus());

Right now it's used only once, but technically it has wrong value if the Slider should never be highlighted when uneditable.

Seems good to me.
I propose to separate focused status ('mouse_inside || has_focus())' from highlighted status

so we get:

bool focused = mouse_inside || has_focus();
bool highlighted = editable && focused;
// same code here
if (highlighted) {
    graber_area = ...

Would that be okey?

@KoBeWi
Copy link
Member

KoBeWi commented Jun 28, 2023

mouse_inside means the Slider is hovered, not focused, so it wouldn't be accurate.

@YuriSizov
Copy link
Contributor

@NiskashY Will you be willing to make the requested changes?

@NiskashY
Copy link
Contributor Author

NiskashY commented Jul 7, 2023

@YuriSizov Make changes KoBeWi suggested?

bool highlighted = editable && (mouse_inside || has_focus());

@YuriSizov
Copy link
Contributor

Make changes KoBeWi suggested?

Yep!

scene/gui/slider.cpp Outdated Show resolved Hide resolved
@YuriSizov
Copy link
Contributor

Also, please make sure to squash your commits into one. Make sure that the final commit has a short but descriptive message (the title of this PR is a good option). See this documentation, if you need help with squashing.

@NiskashY NiskashY force-pushed the fix-disabled-slider-highlighting branch from 87e68d7 to 4394936 Compare July 7, 2023 21:46
@YuriSizov YuriSizov merged commit bbb1100 into godotengine:master Jul 10, 2023
@YuriSizov
Copy link
Contributor

Thanks! And congrats on your first merged Godot pull-request!

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 10, 2023
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.1.

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled Sliders shouldn't be highlightable
4 participants