Skip to content

Commit

Permalink
[CtrlInventoryGrid] Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-kish committed Apr 22, 2024
1 parent d341421 commit a197038
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions addons/gloot/ui/ctrl_inventory_grid_ex.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ signal item_mouse_exited(item)

const Verify = preload("res://addons/gloot/core/verify.gd")
const CtrlInventoryGridBasic = preload("res://addons/gloot/ui/ctrl_inventory_grid_basic.gd")
const CtrlInventoryItemRect = preload("res://addons/gloot/ui/ctrl_inventory_item_rect.gd")
const CtrlDragable = preload("res://addons/gloot/ui/ctrl_dragable.gd")


Expand Down
2 changes: 1 addition & 1 deletion addons/gloot/ui/ctrl_inventory_item_rect.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class_name CtrlInventoryItemRect
extends "res://addons/gloot/ui/ctrl_dragable.gd"

const CtrlInventoryItemRect = preload("res://addons/gloot/ui/ctrl_inventory_item_rect.gd")
const StacksConstraint = preload("res://addons/gloot/core/constraints/stacks_constraint.gd")
const GridConstraint = preload("res://addons/gloot/core/constraints/grid_constraint.gd")

Expand Down
6 changes: 3 additions & 3 deletions addons/gloot/ui/ctrl_item_slot.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class_name CtrlItemSlot
extends Control

const CtrlInventoryRect = preload("res://addons/gloot/ui/ctrl_inventory_item_rect.gd")
const CtrlInventoryItemRect = preload("res://addons/gloot/ui/ctrl_inventory_item_rect.gd")
const CtrlDropZone = preload("res://addons/gloot/ui/ctrl_drop_zone.gd")
const CtrlDragable = preload("res://addons/gloot/ui/ctrl_dragable.gd")
const StacksConstraint = preload("res://addons/gloot/core/constraints/stacks_constraint.gd")
Expand Down Expand Up @@ -94,7 +94,7 @@ var item_slot: ItemSlotBase :

_refresh()
var _hbox_container: HBoxContainer
var _ctrl_inventory_item_rect: CtrlInventoryRect
var _ctrl_inventory_item_rect: CtrlInventoryItemRect
var _label: Label
var _ctrl_drop_zone: CtrlDropZone

Expand Down Expand Up @@ -144,7 +144,7 @@ func _ready():
add_child(_hbox_container)
_hbox_container.resized.connect(func(): size = _hbox_container.size)

_ctrl_inventory_item_rect = CtrlInventoryRect.new()
_ctrl_inventory_item_rect = CtrlInventoryItemRect.new()
_ctrl_inventory_item_rect.visible = item_texture_visible
_ctrl_inventory_item_rect.size_flags_horizontal = SIZE_EXPAND_FILL
_ctrl_inventory_item_rect.size_flags_vertical = SIZE_EXPAND_FILL
Expand Down
6 changes: 3 additions & 3 deletions tests/ctrl_tests/drag_test/drag_test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ extends Control
const CtrlDragable = preload("res://addons/gloot/ui/ctrl_dragable.gd")
const CtrlDropZone = preload("res://addons/gloot/ui/ctrl_drop_zone.gd")

@onready var panel = $Panel
@onready var panel2 = $Panel2
@onready var dragable: CtrlDragable = $Dragable
@onready var panel = %Panel
@onready var panel2 = %Panel2
@onready var dragable: CtrlDragable = %Dragable


# Called when the node enters the scene tree for the first time.
Expand Down
18 changes: 11 additions & 7 deletions tests/ctrl_tests/drag_test/drag_test.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,27 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_u86bx")

[node name="Panel" type="Panel" parent="."]
layout_mode = 0
[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="Panel" type="Panel" parent="CanvasLayer"]
unique_name_in_owner = true
offset_left = 137.0
offset_top = 134.0
offset_right = 452.0
offset_bottom = 345.0
script = ExtResource("2_4tjx6")

[node name="Panel2" type="Panel" parent="."]
layout_mode = 0
[node name="Panel2" type="Panel" parent="CanvasLayer"]
unique_name_in_owner = true
offset_left = 276.0
offset_top = 225.0
offset_right = 591.0
offset_bottom = 436.0
offset_right = 650.0
offset_bottom = 479.0
script = ExtResource("2_4tjx6")

[node name="Dragable" type="Control" parent="."]
[node name="Dragable" type="Control" parent="CanvasLayer"]
unique_name_in_owner = true
layout_mode = 3
anchors_preset = 0
offset_right = 64.0
offset_bottom = 64.0
Expand Down

0 comments on commit a197038

Please sign in to comment.