Somewhat working prototype
This commit is contained in:
3
is_dragging.gd
Normal file
3
is_dragging.gd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var is_dragging = false
|
||||||
1
is_dragging.gd.uid
Normal file
1
is_dragging.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://568n56xr8gm6
|
||||||
@@ -12,9 +12,22 @@ config_version=5
|
|||||||
|
|
||||||
config/name="tween-scroll-test"
|
config/name="tween-scroll-test"
|
||||||
config/tags=PackedStringArray("experiment", "project_elysium")
|
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"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
is_dragging="*res://is_dragging.gd"
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
project/assembly_name="tween-scroll-test"
|
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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
22
src/empty space thing.tscn
Normal file
22
src/empty space thing.tscn
Normal 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
31
src/empty_space_thing.gd
Normal 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
|
||||||
1
src/empty_space_thing.gd.uid
Normal file
1
src/empty_space_thing.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://vabpak15285q
|
||||||
@@ -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"]
|
[node name="ScrollRoot" type="Node2D"]
|
||||||
|
|
||||||
@@ -6,3 +9,17 @@
|
|||||||
offset_right = 1152.0
|
offset_right = 1152.0
|
||||||
offset_bottom = 648.0
|
offset_bottom = 648.0
|
||||||
color = Color(0.133196, 0.133196, 0.133196, 1)
|
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")
|
||||||
|
|||||||
Reference in New Issue
Block a user