forked from LGDG/ExampleProject
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:
parent
5bdca00c5e
commit
d47c6ed935
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue