Skip to content

Commit

Permalink
Fixed popup menu location for library panel and nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Nov 5, 2024
1 parent 0a58d42 commit 9c23081
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions material_maker/nodes/base.gd
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func randomness_button_create_popup():
if ! generator.is_seed_locked() and DisplayServer.clipboard_get().left(5) == "seed=":
menu.add_item(tr("Paste seed"), 2)
add_child(menu)
menu.popup(Rect2i(get_global_mouse_position(), Vector2i(0, 0)))
menu.popup(Rect2i(get_local_mouse_position()+get_screen_position(), Vector2i(0, 0)))
menu.connect("popup_hide", Callable(menu, "queue_free"))
menu.connect("id_pressed", Callable(self, "_on_seed_menu"))

Expand All @@ -96,7 +96,7 @@ func buffer_button_create_popup():
menu.add_separator()
menu.add_item(tr("Dump buffers"), MENU_BUFFER_DUMP)
add_child(menu)
menu.popup(Rect2(get_global_mouse_position(), Vector2(0, 0)))
menu.popup(Rect2(get_local_mouse_position()+get_screen_position(), Vector2(0, 0)))
menu.connect("popup_hide",Callable(menu,"queue_free"))
menu.connect("id_pressed",Callable(self,"_on_buffer_menu"))

Expand Down Expand Up @@ -281,7 +281,7 @@ func _on_gui_input(event) -> void:
add_child(menu)
menu.popup_hide.connect(menu.queue_free)
menu.id_pressed.connect(self._on_menu_id_pressed)
menu.popup(Rect2(get_global_mouse_position(), Vector2(0, 0)))
menu.popup(Rect2(get_local_mouse_position()+get_screen_position(), Vector2(0, 0)))
else:
menu.free()
elif doubleclicked:
Expand Down Expand Up @@ -324,7 +324,6 @@ func get_slot_tooltip(pos : Vector2, io : Dictionary = {}) -> String:
if input_def.has("longdesc"):
return MMGraphNodeBase.wrap_string(TranslationServer.translate(input_def.longdesc))
"output":

var output_def = generator.get_output_defs()[io.index]
if output_def.has("longdesc"):
return MMGraphNodeBase.wrap_string(TranslationServer.translate(output_def.longdesc))
Expand Down
2 changes: 1 addition & 1 deletion material_maker/nodes/generic/generic.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func generic_button_create_popup():
add_child(popup_menu)
popup_menu.connect("popup_hide",Callable(popup_menu,"queue_free"))
popup_menu.connect("id_pressed",Callable(self,"update_generic"))
popup_menu.popup(Rect2(get_global_mouse_position(), Vector2(0, 0)))
popup_menu.popup(Rect2(get_local_mouse_position()+get_screen_position(), Vector2(0, 0)))



Expand Down
2 changes: 1 addition & 1 deletion material_maker/panels/library/library.gd
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func _on_Tree_item_rmb_selected(mouse_position : Vector2i):
item_menu.set_item_disabled(0, read_only)
item_menu.set_item_disabled(1, read_only)
item_menu.set_item_disabled(2, read_only)
item_menu.popup(Rect2(get_global_mouse_position(), Vector2(0, 0)))
item_menu.popup(Rect2(get_local_mouse_position()+get_screen_position(), Vector2(0, 0)))

func _on_PopupMenu_index_pressed(index):
var library_index : int = 0
Expand Down

0 comments on commit 9c23081

Please sign in to comment.