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

ImSequencer: Fix clip when scrolling out of view #271

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

idbrii
Copy link
Contributor

@idbrii idbrii commented Oct 22, 2022

Fix failure to clip within our parent when using BeginChild.

This is a reimplementation of #57 which no longer merges cleanly.
It pulls simpler changes out of #195 to get them merged. See #195 (comment).

It's just passing true for intersect_with_current_clip_rect in PushClipRect and removing an outdated comment. I've been using this (via #195 for a year and it's worked well).

Test case

Build sample app but with this sequencer section:

if (ImGui::CollapsingHeader("Sequencer"))
{
   // let's create the sequencer
   static int selectedEntry = -1;
   static int firstFrame = 0;
   static bool expanded = true;
   static int currentFrame = 100;
   static bool was_expanded = false;
   ImVec2 sequencer_size = ImGui::GetContentRegionAvail();
   sequencer_size.y -= 20;
   if (was_expanded) {
      sequencer_size.y -= 25 * 2;
   }

   ImGui::BeginChild("Sequencer", sequencer_size);
   {
      Sequencer(&mySequence, &currentFrame, &expanded, &selectedEntry, &firstFrame, ImSequencer::SEQUENCER_EDIT_ALL);
   }
   ImGui::EndChild();

   was_expanded = ImGui::CollapsingHeader("Colors");
   if (was_expanded) {
      static float color[4] = { 0, 0, 0, 0, };
      for (int i = 0; i < 10; ++i) {
         ImGui::ColorEdit4("Color", color);
      }
   }
}

Before

image

After

image

Related to CedricGuillemet#57: clip rectangle not correct when slots out of parent
window.

This is a reimplementation of CedricGuillemet#57 which no longer merges cleanly.
@CedricGuillemet CedricGuillemet merged commit ae8925a into CedricGuillemet:master Oct 25, 2022
@idbrii idbrii deleted the clip-parent branch October 26, 2022 00:10
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.

2 participants