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

Safe clamp from UI drag and slider #2884

Merged
merged 3 commits into from
Jun 25, 2024
Merged

Conversation

Grantim
Copy link
Contributor

@Grantim Grantim commented Jun 24, 2024

No description provided.

@@ -257,6 +257,10 @@ bool slider( const char* label, T& v, const U& vMin, const U& vMax, UnitToString
ret = true;
detail::markItemEdited( ImGui::GetItemID() );
}

if ( *elemMin < *elemMax ) // sometimes ImGui does not clamp it, so make sure that value is clamped
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Please move this up to line 239 above, to prevent it from flashing incorrect value for one frame.
  2. I think we should also add flags & ...AlwaysClamp to the condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I think its better to clamp just before returning
  2. Done

@Grantim Grantim merged commit d13163e into master Jun 25, 2024
25 checks passed
@Grantim Grantim deleted the Safe_clamp_from_UI_drag_and_slider branch June 25, 2024 10:30
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