2024-01-22 17:54:15 +02:00
|
|
|
extends Node3D
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
const Miniature = preload ("res://content/system/miniature/miniature.gd")
|
2024-04-10 14:23:17 +03:00
|
|
|
|
|
|
|
@onready var mini_view_button = $Content/MiniView
|
|
|
|
@onready var heat_map_button = $Content/HeatMap
|
|
|
|
@onready var humudity_map_button = $Content/HumidityMap
|
2024-04-10 16:59:27 +03:00
|
|
|
@onready var min_slider = $Content/MinSlider
|
|
|
|
@onready var max_slider = $Content/MaxSlider
|
|
|
|
@onready var opacity_slider = $Content/OpacitySlider
|
2024-01-22 17:54:15 +02:00
|
|
|
@onready var background = $Background
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
background.visible = false
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
if App.miniature.is_node_ready() == false:
|
|
|
|
await App.miniature.ready
|
2024-04-10 14:23:17 +03:00
|
|
|
|
|
|
|
mini_view_button.on_toggled.connect(func(active):
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.small.value=active
|
2024-04-10 14:23:17 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
heat_map_button.on_toggled.connect(func(active):
|
|
|
|
if active == false:
|
2024-05-22 19:38:28 +03:00
|
|
|
if App.miniature.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE:
|
|
|
|
App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE
|
2024-04-10 14:23:17 +03:00
|
|
|
return
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.heatmap_type.value=Miniature.HeatmapType.TEMPERATURE
|
2024-04-10 14:23:17 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
humudity_map_button.on_toggled.connect(func(active):
|
|
|
|
if active == false:
|
2024-05-22 19:38:28 +03:00
|
|
|
if App.miniature.heatmap_type.value == Miniature.HeatmapType.HUMIDITY:
|
|
|
|
App.miniature.heatmap_type.value=Miniature.HeatmapType.NONE
|
2024-04-10 14:23:17 +03:00
|
|
|
return
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.heatmap_type.value=Miniature.HeatmapType.HUMIDITY
|
2024-04-10 14:23:17 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
R.effect(func(_arg):
|
2024-05-22 19:38:28 +03:00
|
|
|
heat_map_button.active=App.miniature.heatmap_type.value == Miniature.HeatmapType.TEMPERATURE
|
|
|
|
humudity_map_button.active=App.miniature.heatmap_type.value == Miniature.HeatmapType.HUMIDITY
|
2024-04-10 16:59:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
min_slider.on_value_changed.connect(func(value):
|
2024-05-22 19:38:28 +03:00
|
|
|
if value >= App.miniature.selected_scale.value.y:
|
|
|
|
min_slider.value=App.miniature.selected_scale.value.y
|
2024-04-10 16:59:27 +03:00
|
|
|
return
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.selected_scale.value.x=value
|
2024-04-10 16:59:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
max_slider.on_value_changed.connect(func(value):
|
2024-05-22 19:38:28 +03:00
|
|
|
if value <= App.miniature.selected_scale.value.x:
|
|
|
|
max_slider.value=App.miniature.selected_scale.value.x
|
2024-04-10 16:59:27 +03:00
|
|
|
return
|
2024-04-10 14:23:17 +03:00
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.selected_scale.value.y=value
|
2024-04-10 16:59:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
R.effect(func(_arg):
|
2024-05-22 19:38:28 +03:00
|
|
|
min_slider.value=App.miniature.selected_scale.value.x
|
|
|
|
max_slider.value=App.miniature.selected_scale.value.y
|
2024-01-22 17:54:15 +02:00
|
|
|
)
|
2024-04-10 16:59:27 +03:00
|
|
|
|
|
|
|
# Update Slider
|
|
|
|
R.effect(func(_arg):
|
2024-05-22 19:38:28 +03:00
|
|
|
var minmax=App.miniature.get_base_scale()
|
2024-04-10 16:59:27 +03:00
|
|
|
min_slider.min=minmax.x
|
|
|
|
min_slider.max=minmax.y
|
|
|
|
|
|
|
|
max_slider.min=minmax.x
|
|
|
|
max_slider.max=minmax.y
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
var sensor_minmax=App.miniature.get_sensor_scale()
|
2024-04-10 16:59:27 +03:00
|
|
|
|
|
|
|
sensor_minmax.x=floor(sensor_minmax.x)
|
|
|
|
sensor_minmax.y=ceil(sensor_minmax.y)
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
App.miniature.selected_scale.value=sensor_minmax
|
2024-04-10 16:59:27 +03:00
|
|
|
min_slider.value=sensor_minmax.x
|
|
|
|
max_slider.value=sensor_minmax.y
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
var unit=App.miniature.get_sensor_unit()
|
2024-04-10 16:59:27 +03:00
|
|
|
|
|
|
|
min_slider.label_unit=unit
|
|
|
|
max_slider.label_unit=unit
|
|
|
|
)
|
|
|
|
|
2024-05-22 19:38:28 +03:00
|
|
|
R.bind(opacity_slider, "value", App.miniature.opacity, opacity_slider.on_value_changed)
|