Somewhat working prototype

This commit is contained in:
2025-10-20 18:05:23 -06:00
parent 309591a9b6
commit a82f3ac09e
7 changed files with 90 additions and 2 deletions

3
is_dragging.gd Normal file
View File

@@ -0,0 +1,3 @@
extends Node
var is_dragging = false

1
is_dragging.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://568n56xr8gm6

View File

@@ -12,9 +12,22 @@ config_version=5
config/name="tween-scroll-test"
config/tags=PackedStringArray("experiment", "project_elysium")
config/features=PackedStringArray("4.4", "Forward Plus")
run/main_scene="uid://xvl65qci5w1b"
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
is_dragging="*res://is_dragging.gd"
[dotnet]
project/assembly_name="tween-scroll-test"
[input]
click={
"deadzone": 0.2,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}

View File

@@ -0,0 +1,22 @@
[gd_scene format=3 uid="uid://dtsyn6bqpojn"]
[node name="EmptySpaceThing" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_right = 8.0
offset_bottom = 8.0
text = "YEehaw"
[node name="Button" type="Button" parent="Button"]
layout_mode = 0
offset_left = 101.0
offset_right = 176.0
offset_bottom = 31.0
text = "Button 2"

31
src/empty_space_thing.gd Normal file
View File

@@ -0,0 +1,31 @@
extends Control
class_name SpaceNode
var initial_pos: Vector2
var offset: Vector2
var draggable: bool = false
func _ready() -> void:
draggable = true
return
func _process(delta: float) -> void:
if draggable:
if Input.is_action_pressed("click", true):
self.global_position = Vector2(get_global_mouse_position().x, self.global_position.y)
elif Input.is_action_just_released("click"):
is_dragging.is_dragging = false
var tween = get_tree().create_tween()
tween.tween_property(self, "global_position", Vector2(get_global_mouse_position().x, self.global_position.y), 0.5).set_ease(Tween.EASE_IN_OUT)
else:
return
func reset_draggable():
if not is_dragging.is_dragging:
is_dragging.is_dragging = false
draggable = false

View File

@@ -0,0 +1 @@
uid://vabpak15285q

View File

@@ -1,4 +1,7 @@
[gd_scene format=3 uid="uid://xvl65qci5w1b"]
[gd_scene load_steps=3 format=3 uid="uid://xvl65qci5w1b"]
[ext_resource type="PackedScene" uid="uid://dtsyn6bqpojn" path="res://src/empty space thing.tscn" id="1_is8xv"]
[ext_resource type="Script" uid="uid://vabpak15285q" path="res://src/empty_space_thing.gd" id="2_mej84"]
[node name="ScrollRoot" type="Node2D"]
@@ -6,3 +9,17 @@
offset_right = 1152.0
offset_bottom = 648.0
color = Color(0.133196, 0.133196, 0.133196, 1)
[node name="Sliding Box" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="EmptySpaceThing" parent="Sliding Box" instance=ExtResource("1_is8xv")]
layout_mode = 1
offset_left = 455.0
offset_top = 299.0
offset_right = 455.0
offset_bottom = 299.0
script = ExtResource("2_mej84")