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

Hovering a Pin when adding a Link is causing the canvas to clip #117

Closed
krejov100 opened this issue Jul 2, 2023 · 10 comments
Closed

Hovering a Pin when adding a Link is causing the canvas to clip #117

krejov100 opened this issue Jul 2, 2023 · 10 comments

Comments

@krejov100
Copy link

I have found that the node editor canvas is clipping when attempting to create a link.
I believe it is related to this issue in the underlying imgui-node-editor, which has a workaround.
thedmd/imgui-node-editor#237

Screen.Recording.2023-07-02.at.11.49.10.AM.mov
@pthom
Copy link
Owner

pthom commented Jul 3, 2023

Hi,

It is strange that the issue was closed in the imgui-node-editor repository. Having an issue or a related PR would be the best way to get this to be solved in the main repository.

Did you try the workaround on your side with your project, and does it fix the issue?

@krejov100
Copy link
Author

I have not reproduced the workaround, I've been using the precompiled wheel from pip.
I did also find this possibly related issue that remains open on the imgui-node-editor repository.

thedmd/imgui-node-editor#205

@pthom
Copy link
Owner

pthom commented Jul 4, 2023

Could you post a minimal reproducible example?

@krejov100
Copy link
Author

To reproduce, it requires the graph to be in a docking window, and the clipping is screen position depended.

from imgui_bundle import imgui, imgui_node_editor as ed, immapp
from imgui_bundle.immapp import static, run_anon_block as anon
from imgui_bundle import hello_imgui


@immapp.static(id=0)
def next_id():
    next_id.id += 1
    return next_id.id

@immapp.static(id=0)
def next_link_id():
    next_link_id.id += 1
    return next_link_id.id

def gui():
    next_id.id = 0

    ed.begin("My Editor", imgui.ImVec2(0.0, 0.0))

    ed.begin_node(ed.NodeId(next_id()))
    imgui.text("Node 1")
    ed.begin_pin(ed.PinId(next_id()), ed.PinKind.output)
    imgui.text("Out ->")
    ed.end_pin()
    ed.end_node()

    ed.begin_node(ed.NodeId(next_id()))
    imgui.text("Node 2")
    ed.begin_pin(ed.PinId(next_id()), ed.PinKind.input)
    imgui.text("-> In")
    ed.end_pin()
    ed.end_node()

    if ed.begin_create():
        input_pin_id = ed.PinId()
        output_pin_id = ed.PinId()
        if ed.query_new_link(input_pin_id, output_pin_id):
            if ed.accept_new_item():
                ed.link(ed.LinkId(next_link_id()), input_pin_id, output_pin_id)
    ed.end_create()

    ed.end()


runner_params = immapp.RunnerParams()
runner_params.imgui_window_params.menu_app_title = "Pipeline"
runner_params.imgui_window_params.enable_viewports = True
win = hello_imgui.DockableWindow()
win.gui_function = gui
win.label = "graph"
runner_params.docking_params.dockable_windows = [win]

add_on_params = immapp.AddOnsParams()
add_on_params.with_node_editor = True

immapp.run(runner_params, add_on_params)
Screenshot 2023-07-04 at 10 47 57 AM

@pthom
Copy link
Owner

pthom commented Jul 8, 2023

Yes, the workaround seems to solve the issue.
I will consider adding this to my node fork, will keep you posted

@krejov100
Copy link
Author

Thank you for reproducing!

pthom added a commit to pthom/imgui-node-editor that referenced this issue Jul 20, 2023
@pthom
Copy link
Owner

pthom commented Jul 20, 2023

Hi, I just pushed a commit that correct this:

As of now, I did not release a new version of the pip package (this might take a few weeks, as I want to group updates).
If you want the modification on your side, you will need to build the pip package from source.

git clone https://github.com/pthom/imgui_bundle.git
cd imgui_bundle
git submodule update --init --recursive  # Since there are lots of submodules, this might take a few minutes
pip install -v . # The build process might take up to 15 minutes
pip install opencv-contrib-python

@pthom
Copy link
Owner

pthom commented Jul 20, 2023

I'll need to find an appropriate way to transmit the fix to @thedmd, together with an easily reproducible example.

I'll work on this a little later.

pthom added a commit to pthom/imgui-node-editor that referenced this issue Aug 2, 2023
This is a workaround for
         thedmd#205
         pthom/imgui_bundle#117
     Adding a simple pixel at m_WidgetRect.Max is enough to bypass the issue
@thedmd
Copy link

thedmd commented Sep 2, 2023

@pthom Issue is now resolved in node editor. Thanks for your help!

@pthom
Copy link
Owner

pthom commented Sep 6, 2023

This issue is now fixed, and also fixed in @thedmd repo. Thanks a lot!

@pthom pthom closed this as completed Sep 6, 2023
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

No branches or pull requests

3 participants