Git Product home page Git Product logo

Comments (4)

Nelarius avatar Nelarius commented on August 16, 2024

Oh shoot, I'm not sure I have a good solution for this right now 😰

When ImGui::Separator is called, we don't yet know the size of the node because imnodes::EndNode hasn't been called yet. So the ImGui::Separator call uses the size of the current window, which is the canvas, I guess? 😬

I will have to create a list of known issues or something, and add this there until I can figure out what to do about this.

EDIT: in general, this is related to the problem of layout using imnodes: you also have to manually "align" your UI elements on the right side of the node for the same reason. I will have to investigate better ways of handling window size.

EDIT2: it also looks like ImGui::PushItemWidth has no effect on ImGui::Separator 😞

from imnodes.

Nelarius avatar Nelarius commented on August 16, 2024

Added a mention of this in the README for now, thanks for reporting this!

from imnodes.

ketoo avatar ketoo commented on August 16, 2024

Thanks, I use a small button to meet the same goal.

from imnodes.

hiroMTB avatar hiroMTB commented on August 16, 2024

This can be solved by similar approach like #167 (comment)

But for Separator() we overwrite window->Size.x

ImGuiWindow* window = ImGui::GetCurrentWindow();
  
int xbackup = window->Size.x;
window->Size.x = window->DC.CursorPos.x + width;

ImGui::Separator();

// don't forget to tidy up
window->Size.x = xbackup;

I tested and can confirm it works but somehow Separator's line became slightly longer than node width like 10%.
It might be good to do this overwrite window variable inside BeginNode() so that all imgui widgets work fine until imgui officially supports this kind of feature.

from imnodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.