Skip to content

Node's internals rendering misalignments #36

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

Open
aleksradojkovic opened this issue Sep 15, 2024 · 6 comments
Open

Node's internals rendering misalignments #36

aleksradojkovic opened this issue Sep 15, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@aleksradojkovic
Copy link

Hello there!

First of all, Thanks for contributing and helping our industry with this project!

When using ImGui 1.91.1 version, pins seems to be a little bit offset. Using your provided example, slightly and trivially modified in my app, I get:
image

Is there same thing happening on your workspace?

Kind regards,
Alex

@Fattorino
Copy link
Owner

Could you provide the ImNodeFlow related code?

@aleksradojkovic
Copy link
Author

aleksradojkovic commented Sep 16, 2024

Hello!

https://gist.github.com/aleksradojkovic/a71aa3939a7ad63cd2a0296432643062

Using this CMakeFile (sorry for bad file, still nothing special there) and test.cpp file (still sorry for bad code, but still nothing special), I get:

image

Feel free to reuse my code for examples

EDIT: You're closing application with ALT+F4, with succcess

Kind regards,
Alex

@Fattorino
Copy link
Owner

Fattorino commented Sep 17, 2024

try removing https://gist.github.com/aleksradojkovic/a71aa3939a7ad63cd2a0296432643062#:~:text=PinStyle%3A%3Ablue())%2D%3E-,setPos(%7B%20%2D10%2C%200%20%7D),-%3B

setPos() for pins is for internal use only, I'll have to fix it, it's confusing this way

Edit: You can always modify some style parameters to change the padding and offsets of the pins

@aleksradojkovic
Copy link
Author

Hello!

Even with removed setPos, situation remains the same.

I investigated issue further, and I concluded next:

If window size, when it's first time created, as smallest as possible, pins will not be rendered fine. Also, if you have window any size, and make it the smallest possible, and restore it back, pin positions will be also corrupted for some reason.

Kind regards,
Alex

@Fattorino Fattorino added the bug Something isn't working label Jan 4, 2025
@Riztazz
Copy link

Riztazz commented Jan 4, 2025

The same happens if you tab into a widget of a node that is drawn outside of visible view.
This happens because GetCursorPos() used in calculation of Pin position also includes "scroll" value which is set when we actually tab into the widget. I think the intention from ImGui is that tabbed widget should always be in view.
That's what i was able to debug but i couldn't come up with a neat solution and since im gonna clip out of view nodes, i didn't invest more time into it

ImGui GetCursorPos code

To reproduce this:

  1. Create a node that has a tabble into widget, e.g. InputScalar
  2. Add any output pin to the node
  3. Move the grid so the node is not in canvas view
  4. Use tab to activate the nodes widget

@Fattorino
Copy link
Owner

about nodes out of view: many months ago I was working on implementing a sort of "Clip rectangle" and splitting the logic of the nodes in two. One part is for the behavior to be executed as needed, and one is for rendering to be executed in view. This feature sadly never came to life because I don't have time to actively work on this project anymore. But if implemented could maybe fix these issues

@Fattorino Fattorino changed the title Pins rendered with offset Node rendering misalignments Jan 4, 2025
@Fattorino Fattorino changed the title Node rendering misalignments Node's internals rendering misalignments Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants