Доработка. Плавное смещение карты на текущие координаты

This commit is contained in:
sasha80
2025-04-25 10:05:34 +03:00
parent abc638844f
commit 2e24683d26
3 changed files with 50 additions and 11 deletions

View File

@@ -21,11 +21,16 @@ class_name MercatorTileMap
@export_range(0, 25, 1) var max_zoom_level: int = 19
@export_range(0, 25, 1) var min_zoom_level: int = 0
@export_color_no_alpha() var back_color: = Color.BLACK
@export var animation_time: float = 1.0
const default_size: = 400.0
var is_centered: = false
@export var animation_time: float = 0.1:
set(val):
animation_time = val
$player.get_animation('goto').lenght = animation_time
@export var size: Vector2i = Vector2i(default_size, default_size):
set(v):
$canvas.size = v
@@ -652,17 +657,13 @@ func clear() -> void:
func set_coordinates(lon: float, lat: float):
var anim: Animation = $canvas/player.get_animation('goto')
var wrld_pos = lonlat_to_world(lon, lat)
var anim: Animation = $player.get_animation('goto')
var new_pos = lonlat_to_world(lon, lat)
anim.track_insert_key(0, 0, _xyz.x)
anim.track_insert_key(1, 0, _xyz.y)
anim.track_insert_key(0, animation_time, wrld_pos.x)
anim.track_insert_key(1, animation_time, wrld_pos.y)
anim.length = animation_time
$canvas/player.play('goto')
anim.track_insert_key(0, animation_time, new_pos.x)
anim.track_insert_key(1, animation_time, new_pos.y)
$player.play('goto')
func blend_mask(val: bool) -> void: