mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
feat: default pager to SSTV, remove radar plot drag, filter B track by elevation>0
This commit is contained in:
1 parent
81ae8772d2
commit
fb28283679
3 files changed
+11
-24
No files matched your search
@@ -18,8 +18,6 @@
|
|||||||
package com.rtbishop.look4sat.feature.mutual
|
package com.rtbishop.look4sat.feature.mutual
|
||||||
|
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.foundation.gestures.detectDragGestures
|
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -36,7 +34,6 @@ import androidx.compose.ui.graphics.Path
|
|||||||
import androidx.compose.ui.graphics.PathEffect
|
import androidx.compose.ui.graphics.PathEffect
|
||||||
import androidx.compose.ui.graphics.drawscope.DrawScope
|
import androidx.compose.ui.graphics.drawscope.DrawScope
|
||||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
|
||||||
import androidx.compose.ui.text.TextMeasurer
|
import androidx.compose.ui.text.TextMeasurer
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.drawText
|
import androidx.compose.ui.text.drawText
|
||||||
@@ -60,7 +57,6 @@ private const val STROKE_WIDTH = 2.5f
|
|||||||
fun MutualRadarView(
|
fun MutualRadarView(
|
||||||
trackSamples: List<TrackSample>,
|
trackSamples: List<TrackSample>,
|
||||||
progress: Float = 0.5f,
|
progress: Float = 0.5f,
|
||||||
onProgressChange: (Float) -> Unit = {},
|
|
||||||
labelA: String = "站点A",
|
labelA: String = "站点A",
|
||||||
labelB: String = "站点B",
|
labelB: String = "站点B",
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
@@ -86,16 +82,6 @@ fun MutualRadarView(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.padding(4.dp)
|
.padding(4.dp)
|
||||||
.pointerInput(Unit) {
|
|
||||||
detectTapGestures { offset ->
|
|
||||||
onProgressChange((offset.x / size.width.toFloat()).coerceIn(0f, 1f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pointerInput(Unit) {
|
|
||||||
detectDragGestures { change, _ ->
|
|
||||||
onProgressChange((change.position.x / size.width.toFloat()).coerceIn(0f, 1f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
val radius = size.minDimension / 2f * 0.92f
|
val radius = size.minDimension / 2f * 0.92f
|
||||||
val center = Offset(size.width / 2f, size.height / 2f)
|
val center = Offset(size.width / 2f, size.height / 2f)
|
||||||
|
|||||||
@@ -433,7 +433,6 @@ private fun MutualPassCard(
|
|||||||
MutualRadarView(
|
MutualRadarView(
|
||||||
trackSamples = pass.trackSamples,
|
trackSamples = pass.trackSamples,
|
||||||
progress = dragProgress,
|
progress = dragProgress,
|
||||||
onProgressChange = { dragProgress = it },
|
|
||||||
labelA = "你",
|
labelA = "你",
|
||||||
labelB = "友台"
|
labelB = "友台"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -118,16 +118,18 @@ private fun RadarScreen(
|
|||||||
val addToCalendar: () -> Unit = {
|
val addToCalendar: () -> Unit = {
|
||||||
uiState.currentPass?.let { onAction(RadarAction.AddToCalendar(it.name, it.aosTime, it.losTime)) }
|
uiState.currentPass?.let { onAction(RadarAction.AddToCalendar(it.name, it.aosTime, it.losTime)) }
|
||||||
}
|
}
|
||||||
// Station-B overlay: full track line (not time-limited) + live position dot
|
// Station-B overlay: full track line (only where B's elevation > 0) + live position dot
|
||||||
// at the current moment, same display mode as the local station.
|
// at the current moment, same display mode as the local station.
|
||||||
val trackB = remember(mutualData.trackSamples) {
|
val trackB = remember(mutualData.trackSamples) {
|
||||||
mutualData.trackSamples.map {
|
mutualData.trackSamples
|
||||||
OrbitalPos(
|
.filter { it.elevationB > 0.0 }
|
||||||
azimuth = it.azimuthB * PI / 180.0,
|
.map {
|
||||||
elevation = it.elevationB * PI / 180.0,
|
OrbitalPos(
|
||||||
time = it.time
|
azimuth = it.azimuthB * PI / 180.0,
|
||||||
)
|
elevation = it.elevationB * PI / 180.0,
|
||||||
}
|
time = it.time
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val timeNow = System.currentTimeMillis()
|
val timeNow = System.currentTimeMillis()
|
||||||
val trackBPosition = mutualData.trackSamples
|
val trackBPosition = mutualData.trackSamples
|
||||||
@@ -182,7 +184,7 @@ private fun PagerCard(
|
|||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val pages = RadarPage.entries
|
val pages = RadarPage.entries
|
||||||
val pagerState = rememberPagerState(pageCount = { pages.size })
|
val pagerState = rememberPagerState(initialPage = 1, pageCount = { pages.size })
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
||||||
ElevatedCard(modifier = modifier) {
|
ElevatedCard(modifier = modifier) {
|
||||||
|
|||||||
Reference in new issue
Block a user