1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 09:39:48 +00:00
Pixelorama/addons/dockable_container/dockable_panel_reference_control.gd
mrtripie e8281bf056
Animation Timeline UI Improvements (#769)
* Fixed link cel indicator color and animation tags position

* New scrolling and min size

* fixed dockable container for the timeline min size

* Cleanup

* Tweaked minimum size

* Removed some hacks that are no longer needed

* Fixed frame scrollbar not being in the right place at startup, added ensure_control_visible

* frame scroll horziontally without shift if can't scroll vertically + min size tweaks

* Renamed the frames/layer/cel containers

* Always scroll by whole frames

* Fixed conflict

* reoranized AnimationTimeline scene's node tree to wrok as expected

* tweaks

* Fixed tag position and removed uneeded layer button theme code

* added the icon theme code back, I thought this was for the timeline XD

* Smaller LayerButtons

* Save Layer and Cel size between sessions

* Combined _on_AddLayer_pressed and _on_AddGroup_pressed into 1 add_layer method

* Rename scroll container

* formatting

Co-authored-by: MrTriPie <MrTriPie>
2022-10-21 16:04:26 +03:00

52 lines
1.4 KiB
GDScript

tool
extends Container
# Control that mimics its own visibility and rect into another Control.
signal moved_in_parent(control)
var reference_to: Control setget set_reference_to, get_reference_to
var _reference_to: Control = null
func _ready() -> void:
mouse_filter = MOUSE_FILTER_IGNORE
func _notification(what: int) -> void:
if what == NOTIFICATION_VISIBILITY_CHANGED and _reference_to:
_reference_to.visible = visible
elif what == NOTIFICATION_SORT_CHILDREN and _reference_to:
_reposition_reference()
func _get_minimum_size() -> Vector2:
return _reference_to.get_combined_minimum_size() if _reference_to else Vector2.ZERO
func set_reference_to(control: Control) -> void:
if _reference_to != control:
if _reference_to:
_reference_to.disconnect("renamed", self, "_on_reference_to_renamed")
_reference_to.disconnect("minimum_size_changed", self, "minimum_size_changed")
_reference_to = control
_reference_to.connect("minimum_size_changed", self, "minimum_size_changed")
minimum_size_changed()
if not _reference_to:
return
_reference_to.connect("renamed", self, "_on_reference_to_renamed")
_reference_to.visible = visible
func get_reference_to() -> Control:
return _reference_to
func _reposition_reference() -> void:
_reference_to.rect_global_position = rect_global_position
_reference_to.rect_size = rect_size
func _on_reference_to_renamed() -> void:
name = _reference_to.name