1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix popups appearing in wrong places when single window mode is disabled

This commit is contained in:
Emmanouil Papadeas 2024-08-03 22:36:05 +03:00
parent 95d96b9b00
commit a3d7725a44
14 changed files with 19 additions and 20 deletions

View file

@ -148,7 +148,7 @@ func set_nodes() -> void:
live_checkbox.button_pressed = live_preview
func display_animate_dialog():
func display_animate_dialog() -> void:
var animate_dialog: Popup = animate_panel.get_parent()
var pos := Vector2(position.x + size.x, position.y)
var animate_dialog_rect := Rect2(pos, Vector2(animate_dialog.size.x, size.y))

View file

@ -213,8 +213,8 @@ func _on_PaletteGrid_swatch_double_clicked(_mb: int, index: int, click_position:
# Open color picker popup with its right bottom corner next to swatch
var popup := hidden_color_picker.get_popup()
popup.position = click_position - Vector2(popup.size)
popup.popup()
var popup_position := click_position - Vector2(popup.size)
popup.popup_on_parent(Rect2i(popup_position, Vector2i.ONE))
func _on_PaletteGrid_swatch_dropped(source_index: int, target_index: int) -> void:

View file

@ -58,7 +58,7 @@ func _on_BrushType_pressed() -> void:
for child in categories.get_children():
if child is GridContainer:
child.columns = columns
Global.brushes_popup.popup(Rect2(pop_position, Vector2(size_x, size_y)))
Global.brushes_popup.popup_on_parent(Rect2(pop_position, Vector2(size_x, size_y)))
Tools.flip_rotated.emit(
_brush_flip_x, _brush_flip_y, _brush_rotate_90, _brush_rotate_180, _brush_rotate_270
)

View file

@ -79,7 +79,7 @@ func _on_PatternType_pressed() -> void:
var popup: Popup = Global.patterns_popup
if !popup.pattern_selected.is_connected(_on_Pattern_selected):
popup.pattern_selected.connect(_on_Pattern_selected.bind(), CONNECT_ONE_SHOT)
popup.popup(Rect2i($FillPattern/Type.global_position, Vector2i(226, 72)))
popup.popup_on_parent(Rect2i($FillPattern/Type.global_position, Vector2i(226, 72)))
func _on_Pattern_selected(pattern: Patterns.Pattern) -> void:

View file

@ -272,7 +272,7 @@ func _on_BrushType_pressed() -> void:
for child in categories.get_children():
if child is GridContainer:
child.columns = columns
Global.brushes_popup.popup(Rect2(pop_position, Vector2(size_x, size_y)))
Global.brushes_popup.popup_on_parent(Rect2(pop_position, Vector2(size_x, size_y)))
func _on_Brush_selected(brush: Brushes.Brush) -> void:

View file

@ -49,8 +49,8 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("reference_quick_menu"):
var list: Array[ReferenceImage] = Global.current_project.reference_images
populate_reference_menu(list, true)
reference_menu.position = Global.control.get_global_mouse_position()
reference_menu.popup()
var popup_position := Global.control.get_global_mouse_position()
reference_menu.popup_on_parent(Rect2i(popup_position, Vector2i.ONE))
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
@ -104,8 +104,8 @@ func _input(event: InputEvent) -> void:
# 2. There are more than 1 Reference Images
elif overlapping.size() > 1:
populate_reference_menu(overlapping, true)
reference_menu.position = Global.control.get_global_mouse_position()
reference_menu.popup()
var popup_position := Global.control.get_global_mouse_position()
reference_menu.popup_on_parent(Rect2i(popup_position, Vector2i.ONE))
# 3. There are no Reference Images
else:
Global.current_project.set_reference_image_index(-1)

View file

@ -79,4 +79,4 @@ func _on_alpha_lock_toggled(toggled_on: bool) -> void:
func _on_Dynamics_pressed() -> void:
var pos := dynamics.global_position + Vector2(0, 32)
dynamics_panel.popup(Rect2(pos, dynamics_panel.size))
dynamics_panel.popup_on_parent(Rect2(pos, dynamics_panel.size))

View file

@ -151,8 +151,7 @@ func select_color(cursor: GradientCursor, pos: Vector2) -> void:
pos.x = global_position.x + size.x
else:
pos.x = global_position.x - $Popup.size.x
$Popup.position = pos
$Popup.popup()
$Popup.popup_on_parent(Rect2i(pos, Vector2.ONE))
func get_sorted_cursors() -> Array:

View file

@ -163,7 +163,7 @@ func _on_Start_toggled(button_pressed: bool) -> void:
func _on_Settings_pressed() -> void:
options_dialog.popup(Rect2(position, options_dialog.size))
options_dialog.popup_on_parent(Rect2(position, options_dialog.size))
func _on_SkipAmount_value_changed(value: float) -> void:

View file

@ -141,8 +141,8 @@ func _on_Remove_pressed() -> void:
references_container.remove_reference_image(index)
references_panel._on_references_changed()
else:
confirm_remove_dialog.position = Global.control.get_global_mouse_position()
confirm_remove_dialog.popup()
var popup_position := Global.control.get_global_mouse_position()
confirm_remove_dialog.popup_on_parent(Rect2i(popup_position, Vector2i.ONE))
Global.dialog_open(true)

View file

@ -563,7 +563,7 @@ func _on_OnionSkinning_pressed() -> void:
func _on_timeline_settings_button_pressed() -> void:
var pos := Vector2i(onion_skinning_button.global_position) - timeline_settings.size
timeline_settings.popup(Rect2i(pos.x - 16, pos.y + 32, 136, 126))
timeline_settings.popup_on_parent(Rect2i(pos.x - 16, pos.y + 32, 136, 126))
func _on_LoopAnim_pressed() -> void:

View file

@ -111,7 +111,7 @@ func _on_CelButton_pressed() -> void:
elif Input.is_action_just_released("right_mouse"):
if cel is PixelCel:
popup_menu.popup(Rect2(get_global_mouse_position(), Vector2.ONE))
popup_menu.popup_on_parent(Rect2(get_global_mouse_position(), Vector2.ONE))
button_pressed = !button_pressed
elif Input.is_action_just_released("middle_mouse"):
button_pressed = !button_pressed

View file

@ -69,7 +69,7 @@ func _button_pressed() -> void:
popup_menu.set_item_disabled(MOVE_LEFT, false)
if frame < Global.current_project.frames.size() - 1:
popup_menu.set_item_disabled(MOVE_RIGHT, false)
popup_menu.popup(Rect2(get_global_mouse_position(), Vector2.ONE))
popup_menu.popup_on_parent(Rect2(get_global_mouse_position(), Vector2.ONE))
button_pressed = !button_pressed
elif Input.is_action_just_released("middle_mouse"):
button_pressed = !button_pressed

View file

@ -147,7 +147,7 @@ func _on_main_button_gui_input(event: InputEvent) -> void:
elif event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
var layer := Global.current_project.layers[layer_index]
if not layer is GroupLayer:
popup_menu.popup(Rect2(get_global_mouse_position(), Vector2.ONE))
popup_menu.popup_on_parent(Rect2(get_global_mouse_position(), Vector2.ONE))
func _on_layer_name_line_edit_focus_exited() -> void: