mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
e2bb0b8440
* Add dockable container plugin Experimenting with it, also added a tabs_visible property to the DockableContainer. Removed some code about Tallscreen from Main.gd, but not all of it. * Add a panel behind the UI, temporarily restore the dark theme * Remove tallscreen code * Add edit mode, toggles DockableContainer's tab visibility on and off * Split tool options into color pickers, left and right tool options * Remove alternate_transparent_background * Re-order tool buttons on resize * Clip content in timeline * Changes to the tool panel * Removed some old unused node variables * Restore Zen mode * Set tabs_visible = false by default * Better way to set tabs_visible = false by default * Added the license of godot-dockable-container * Remove unneeded lines * Update README.md * Restore window transparency with the canvas It makes all of the TabContainers transparent however, which may not be what we actually want. * Change tab names of the UI elements * Remove unneeded nodes from ColorPickers.tscn * Update default.tres * Let the user hide elements individually * Add some checks in HandleThemes * Center tool icons * Remove unneeded custom panel in SplashDialog * Bump version to v0.10-dev and some other minor changes * Fix crash on Zen Mode * Added a hacky way to fix the issue with the palette panel size
99 lines
1.9 KiB
GDScript
99 lines
1.9 KiB
GDScript
tool
|
|
extends "layout_node.gd"
|
|
# Layout binary tree nodes, defining subtrees and leaf panels
|
|
|
|
enum Direction {
|
|
HORIZONTAL,
|
|
VERTICAL,
|
|
}
|
|
|
|
const LayoutPanel = preload("layout_panel.gd")
|
|
|
|
export(Direction) var direction = Direction.HORIZONTAL setget set_direction, get_direction
|
|
export(float, 0, 1) var percent = 0.5 setget set_percent, get_percent
|
|
export(Resource) var first = LayoutPanel.new() setget set_first, get_first
|
|
export(Resource) var second = LayoutPanel.new() setget set_second, get_second
|
|
|
|
var _direction = Direction.HORIZONTAL
|
|
var _percent = 0.5
|
|
var _first
|
|
var _second
|
|
|
|
|
|
func _init() -> void:
|
|
resource_name = "Split"
|
|
|
|
|
|
func clone():
|
|
var new_split = get_script().new()
|
|
new_split._direction = _direction
|
|
new_split._percent = _percent
|
|
new_split.first = _first.clone()
|
|
new_split.second = _second.clone()
|
|
return new_split
|
|
|
|
|
|
func set_first(value) -> void:
|
|
if value == null:
|
|
_first = LayoutPanel.new()
|
|
else:
|
|
_first = value
|
|
_first.parent = self
|
|
emit_tree_changed()
|
|
|
|
|
|
func get_first():
|
|
return _first
|
|
|
|
|
|
func set_second(value) -> void:
|
|
if value == null:
|
|
_second = LayoutPanel.new()
|
|
else:
|
|
_second = value
|
|
_second.parent = self
|
|
emit_tree_changed()
|
|
|
|
|
|
func get_second():
|
|
return _second
|
|
|
|
|
|
func set_direction(value: int) -> void:
|
|
if value != _direction:
|
|
_direction = value
|
|
emit_tree_changed()
|
|
|
|
|
|
func get_direction() -> int:
|
|
return _direction
|
|
|
|
|
|
func set_percent(value: float) -> void:
|
|
var clamped_value = clamp(value, 0, 1)
|
|
if not is_equal_approx(_percent, clamped_value):
|
|
_percent = clamped_value
|
|
emit_tree_changed()
|
|
|
|
|
|
func get_percent() -> float:
|
|
return _percent
|
|
|
|
|
|
func get_names() -> PoolStringArray:
|
|
var names = _first.get_names()
|
|
names.append_array(_second.get_names())
|
|
return names
|
|
|
|
|
|
func empty() -> bool:
|
|
return _first.empty() and _second.empty()
|
|
|
|
|
|
func is_horizontal() -> bool:
|
|
return _direction == Direction.HORIZONTAL
|
|
|
|
|
|
func is_vertical() -> bool:
|
|
return _direction == Direction.VERTICAL
|