1
0
Fork 0

Change maximizing logic

Before this, maximizing a window functioned by reparenting it to a
margincontainer. Now, maximizing a window is a matter of setting its
anchors and offsets. It will require more code but the reparenting
strategy was causing problems because maximized windows were always
displayed below windowed ones. This could technically be solved by
modifying z-indexes of windows individually but this seems like a less
annoying solution than that in the long run.
This commit is contained in:
under 2024-03-20 13:42:53 -07:00
parent 5bdca00c5e
commit d47c6ed935
1 changed files with 3 additions and 3 deletions

View File

@ -21,13 +21,13 @@ func _input(event: InputEvent):
# toggle maximized
func toggle_maximized():
if get_parent() == maximized_windows:
if anchors_preset == Control.PRESET_FULL_RECT:
set_anchors_and_offsets_preset(Control.PRESET_TOP_LEFT)
position = windowed_rect.position
size = windowed_rect.size
reparent(desktop)
else:
windowed_rect = get_global_rect()
reparent(maximized_windows)
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
func close():
visible = false