hoffstadt / hoffstadt/DearPyGui
Individual mouse click callback for Node Editor grid & nodes
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
I'd like to implement right mouse click callbacks for 2 purposes and launch different popup(window) for selections.
firstly, the "node editor" has the callback for the right mouse click :
# Add the actual node editor
dpg.add_node_editor(tag=self._tag,
callback=self.__callbackAddLink,
delink_callback=self.callbackRemoveLink)
# Regist callbacks for mouse & keyboard operations for node & link controls
with dpg.handler_registry():
dpg.add_mouse_click_handler(button=dpg.mvMouseButton_Right, callback=self.__callbackRightMouseClick)
secondary, the node has a dedicated callback for the right mouse click with popup:
with dpg.node(tag=self._tag,
parent=editorHandle.tag,
label=self.nodeLabel,
pos=pos):
with dpg.node_attribute(tag=self._attrImageInput.tag,
attribute_type=dpg.mvNode_Attr_Input,
shape=dpg.mvNode_PinShape_CircleFilled):
dpg.add_image(tag=self._previewImageTag, texture_tag=self._previewTextureTag)
with dpg.popup(parent=self._previewImageTag):
dpg.add_text(default_value="image size", color=(232, 173, 9))
the problem is that the right mouse click calls only the "node editor" callback.
if I change the mode callback with the item handler with following APIs, the right mouse callback happens for both.
with dpg.item_handler_registry(...) as handler:
dpg.add_item_clicked_handler(...)
dpg.bind_item_handler_registry(...)
the expected behavior is independent callbacks such as the right mouse click on node should call only the dedicated callback for node and the right mouse click on the "node editor" grid calls the callback for "node editor".
is there any way to register different callbacks for node & "node editor" with same mouse click ?
Contributor guide
Assessment
This issue has not been assessed yet.