Repository is now a Control, and fix two regressions

This commit is contained in:
Sebastian Morr 2020-09-21 20:28:43 +02:00
parent 4f3c279b5e
commit eabf41a2d7
8 changed files with 58 additions and 51 deletions

View file

@ -2,7 +2,7 @@ extends Node2D
var label = "label" setget label_set
var target: String setget target_set
var repository: Container
var repository: Control
func _ready():
pass

View file

@ -73,8 +73,6 @@ __meta__ = {
[node name="GoalRepository" parent="HBoxContainer/Repositories" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 0.0
margin_right = 633.0
margin_bottom = 1070.0
size_flags_horizontal = 3
@ -85,7 +83,6 @@ label = "Goal"
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 633.0
margin_top = 0.0
margin_right = 1267.0
margin_bottom = 1070.0
size_flags_horizontal = 3

15
node.gd
View file

@ -3,7 +3,7 @@ extends Node2D
var id setget id_set
var content setget content_set
var type setget type_set
var repository: Container
var repository: Control
var children = {} setget children_set
var id_always_visible = false
@ -106,16 +106,9 @@ func _input(event):
if hovered:
if event.is_action_pressed("click"):
held = true
if event.is_action_released("click"):
held = false
func _input_event(_viewport, event, _shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT:
held = event.pressed
if event.button_index == BUTTON_RIGHT:
if event.pressed:
elif event.is_action_pressed("right_click"):
var input = get_tree().get_current_scene().find_node("Terminal").find_node("Control").find_node("Input")
input.text += id
input.caret_position = input.text.length()
if event.is_action_released("click"):
held = false

View file

@ -75,6 +75,11 @@ zoom_out={
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":5,"pressed":false,"doubleclick":false,"script":null)
]
}
right_click={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
}
[network]

View file

@ -1,4 +1,4 @@
extends Container
extends Control
export var label: String setget set_label
export var path: String setget set_path, get_path

View file

@ -4,25 +4,29 @@
[ext_resource path="res://styles/theme.tres" type="Theme" id=2]
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=3]
[node name="Repository" type="Container"]
[node name="Repository" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 2.0
margin_top = 3.0
margin_right = -6.0
margin_bottom = -4.0
mouse_filter = 1
theme = ExtResource( 2 )
script = ExtResource( 1 )
[node name="Label" type="Label" parent="."]
margin_left = 5.60091
margin_top = -0.518692
margin_right = 204.601
margin_bottom = 48.4813
custom_fonts/font = ExtResource( 3 )
text = "Repo name"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Index" type="Label" parent="."]
margin_left = 24.0
margin_top = 80.0
margin_right = 375.079
margin_bottom = 1044.0
margin_left = 8.64569
margin_top = 63.8375
margin_right = 359.725
margin_bottom = 1027.84
text = "entry1
entry2"
__meta__ = {
@ -51,17 +55,13 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
margin_left = 20.0
margin_top = 20.0
custom_fonts/font = ExtResource( 3 )
text = "Repo name"
[node name="SimplifyCheckbox" type="CheckBox" parent="."]
anchor_top = 0.968
anchor_bottom = 0.968
margin_right = 24.0
margin_bottom = 24.0
anchor_top = 1.0
anchor_bottom = 1.0
margin_left = 2.87984
margin_top = -23.2002
margin_right = 195.88
margin_bottom = 1.7998
focus_mode = 0
enabled_focus_mode = 0
text = "Hide trees and blobs"

View file

@ -95,9 +95,21 @@ corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id=15]
bg_color = Color( 0.294118, 0.294118, 0.294118, 1 )
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id=16]
content_margin_left = 10.0
content_margin_right = 10.0
content_margin_top = 10.0
content_margin_bottom = 10.0
bg_color = Color( 0.172549, 0.172549, 0.172549, 1 )
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id=17]
content_margin_left = 5.0

View file

@ -27,21 +27,21 @@ func _ready():
$TextEditor.connect("hide", self, "editor_closed")
#func _input(event):
# if history.size() > 0:
# if event.is_action_pressed("ui_up"):
# if history_position > 0:
# history_position -= 1
# input.text = history[history_position]
# input.caret_position = input.text.length()
# # This prevents the Input taking the arrow as a "skip to beginning" command.
# get_tree().set_input_as_handled()
# if event.is_action_pressed("ui_down"):
# if history_position < history.size()-1:
# history_position += 1
# input.text = history[history_position]
# input.caret_position = input.text.length()
# get_tree().set_input_as_handled()
func _input(event):
if history.size() > 0:
if event.is_action_pressed("ui_up"):
if history_position > 0:
history_position -= 1
input.text = history[history_position]
input.caret_position = input.text.length()
# This prevents the Input taking the arrow as a "skip to beginning" command.
get_tree().set_input_as_handled()
if event.is_action_pressed("ui_down"):
if history_position < history.size()-1:
history_position += 1
input.text = history[history_position]
input.caret_position = input.text.length()
get_tree().set_input_as_handled()
func load_command(id):
input.text = premade_commands[id]