mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
feat: add mutual radar overlay arrows
This commit is contained in:
1 parent
1813e1bfa4
commit
2298d8eea4
1 file changed
+9
-4
@@ -112,9 +112,10 @@ fun RadarViewCompose(
|
|||||||
var cachedSweepColor by remember { mutableStateOf(Color.Unspecified) }
|
var cachedSweepColor by remember { mutableStateOf(Color.Unspecified) }
|
||||||
var trackPath by remember { mutableStateOf(Path()) }
|
var trackPath by remember { mutableStateOf(Path()) }
|
||||||
var trackEffect by remember { mutableStateOf(PathEffect.cornerPathEffect(0f)) }
|
var trackEffect by remember { mutableStateOf(PathEffect.cornerPathEffect(0f)) }
|
||||||
// Station-B overlay track (dashed)
|
// Station-B overlay track (dashed, with the same directional arrow stamp as station A)
|
||||||
var cachedTrackBRef by remember { mutableStateOf<List<OrbitalPos>?>(null) }
|
var cachedTrackBRef by remember { mutableStateOf<List<OrbitalPos>?>(null) }
|
||||||
var trackBPath by remember { mutableStateOf(Path()) }
|
var trackBPath by remember { mutableStateOf(Path()) }
|
||||||
|
var trackBEffect by remember { mutableStateOf(PathEffect.cornerPathEffect(0f)) }
|
||||||
// ShaderBrush is cached to avoid allocating a new GPU shader object every frame
|
// ShaderBrush is cached to avoid allocating a new GPU shader object every frame
|
||||||
var cachedSweepBrush by remember { mutableStateOf<ShaderBrush?>(null) }
|
var cachedSweepBrush by remember { mutableStateOf<ShaderBrush?>(null) }
|
||||||
|
|
||||||
@@ -124,7 +125,10 @@ fun RadarViewCompose(
|
|||||||
if (radius != cachedRadius || items !== cachedItemsRef || trackB !== cachedTrackBRef) {
|
if (radius != cachedRadius || items !== cachedItemsRef || trackB !== cachedTrackBRef) {
|
||||||
trackPath = createTrackPath(items, radius)
|
trackPath = createTrackPath(items, radius)
|
||||||
trackEffect = createTrackEffect(trackPath)
|
trackEffect = createTrackEffect(trackPath)
|
||||||
trackBPath = trackB?.let { createTrackPath(it, radius) } ?: Path()
|
val newTrackBPath = trackB?.let { createTrackPath(it, radius) } ?: Path()
|
||||||
|
trackBPath = newTrackBPath
|
||||||
|
trackBEffect = if (!newTrackBPath.isEmpty) createTrackEffect(newTrackBPath)
|
||||||
|
else PathEffect.cornerPathEffect(0f)
|
||||||
cachedSweepBrush = makeSweepBrush(center, primaryColor)
|
cachedSweepBrush = makeSweepBrush(center, primaryColor)
|
||||||
cachedRadius = radius
|
cachedRadius = radius
|
||||||
cachedItemsRef = items
|
cachedItemsRef = items
|
||||||
@@ -141,13 +145,14 @@ fun RadarViewCompose(
|
|||||||
drawElevationLabels(radius, primaryColor, measurer)
|
drawElevationLabels(radius, primaryColor, measurer)
|
||||||
translate(center.x, center.y) {
|
translate(center.x, center.y) {
|
||||||
drawTrack(trackPath, trackEffect, aimColor, primaryColor)
|
drawTrack(trackPath, trackEffect, aimColor, primaryColor)
|
||||||
// Station-B overlay: full dashed track + live position dot
|
// Station-B overlay: full dashed track + directional arrows + live position dot
|
||||||
// (same display mode as the local station: track line + pulsing dot)
|
// (same display mode as the local station: track line/arrow + pulsing dot)
|
||||||
if (trackB != null && trackB.isNotEmpty() && !trackBPath.isEmpty) {
|
if (trackB != null && trackB.isNotEmpty() && !trackBPath.isEmpty) {
|
||||||
drawPath(
|
drawPath(
|
||||||
trackBPath, trackBColor,
|
trackBPath, trackBColor,
|
||||||
style = Stroke(STROKE_WIDTH, pathEffect = PathEffect.dashPathEffect(floatArrayOf(18f, 12f)))
|
style = Stroke(STROKE_WIDTH, pathEffect = PathEffect.dashPathEffect(floatArrayOf(18f, 12f)))
|
||||||
)
|
)
|
||||||
|
drawPath(trackBPath, trackBColor, style = Stroke(pathEffect = trackBEffect))
|
||||||
}
|
}
|
||||||
trackBPosition?.let { posB ->
|
trackBPosition?.let { posB ->
|
||||||
if (posB.elevation > 0) {
|
if (posB.elevation > 0) {
|
||||||
|
|||||||
Reference in new issue
Block a user