From 7e4efe5ab13ad3e4885ef433b3c16f5f1cc670da Mon Sep 17 00:00:00 2001 From: sasha80 Date: Fri, 21 Apr 2023 16:35:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0.=20=D0=9D=D0=B0=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=BD=D1=82=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=B4=D0=B0=D1=91=D1=82=D1=81=D1=8F=20=D0=B4?= =?UTF-8?q?=D0=B2=D0=B8=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BE=D0=B9=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BC=D1=8B=D1=88=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/wnd_stc.tscn | 1 - scenes/работа.gd | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scenes/wnd_stc.tscn b/scenes/wnd_stc.tscn index c650632d..10d00bf5 100644 --- a/scenes/wnd_stc.tscn +++ b/scenes/wnd_stc.tscn @@ -7,6 +7,5 @@ initial_position = 3 size = Vector2i(1600, 1200) mode = 3 current_screen = 1 -borderless = true [node name="TabContainer" parent="." instance=ExtResource("1_c76qk")] diff --git a/scenes/работа.gd b/scenes/работа.gd index e7b851e6..893be023 100644 --- a/scenes/работа.gd +++ b/scenes/работа.gd @@ -30,11 +30,11 @@ const RADIO_GROUPE_NAMES = \ enum DRAG_FSM { IDLE, DRAG } var radio_groupe: Array var drag_pos_begin: Vector2 -var drag_pos_end: Vector2 var drag_fsm: DRAG_FSM var drag_button: MouseButton var pc0: Vector2 var ant_dir_width_begin: float +var ant_dir_begin: float # Called when the node enters the scene tree for the first time. func _ready(): @@ -68,14 +68,12 @@ func map_xy_ang(pos0: Vector2, pos: Vector2) -> Vector2: return Vector2(ang, radius) -func set_ant_width(position: Vector2): +func get_ant_width(position: Vector2, prev: float) -> float: var radp: Vector2 = map_xy_ang(pc0, position) - var ant_dir_width: float = ant_dir_width_begin + (drag_pos_begin.y - position.y) / 5.0 - if ant_dir_width < 5.0: - ant_dir_width = 5.0 - if ant_dir_width > 90.0: - ant_dir_width = 90.0 - $canvas.material.set('shader_parameter/ap_ant_w', ant_dir_width) + var ap_ant_w: float = prev + (drag_pos_begin.y - position.y) / 5.0 + if ap_ant_w < 5.0: ap_ant_w = 5.0 + if ap_ant_w > 90.0: ap_ant_w = 90.0 + return ap_ant_w func set_ant_dir(position: Vector2): @@ -88,7 +86,8 @@ func _input(event): if event is InputEventMouseMotion: if drag_fsm == DRAG_FSM.DRAG: if drag_button == MOUSE_BUTTON_RIGHT: - set_ant_width(event.position) + var ap_ant_w: float = get_ant_width(event.position, ant_dir_width_begin) + $canvas.material.set('shader_parameter/ap_ant_w', ap_ant_w) elif drag_button == MOUSE_BUTTON_LEFT: set_ant_dir(event.position) if event is InputEventMouseButton: @@ -100,6 +99,6 @@ func _input(event): if drag_button == MOUSE_BUTTON_LEFT: set_ant_dir(event.position) elif drag_button == MOUSE_BUTTON_RIGHT: - set_ant_width(event.position) + ant_dir_width_begin = $canvas.material.get('shader_parameter/ap_ant_w') else: drag_fsm = DRAG_FSM.IDLE