Skip to content

Commit fd76d68

Browse files
committed
fix(mcap): use activeMarker as key for persistent markers
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent aebd23f commit fd76d68

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/TokenInfoScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ private fun BottomBar(
217217
Row(
218218
modifier = Modifier
219219
.fillMaxWidth()
220+
.navigationBarsPadding()
220221
.hazeEffect(
221222
state = hazeState,
222223
style = HazeMaterials.ultraThin(
@@ -225,12 +226,11 @@ private fun BottomBar(
225226
) {
226227
this.blurRadius = 20.dp
227228
this.progressive = HazeProgressive.LinearGradient(
228-
startIntensity = 0.5f,
229+
startIntensity = 1f,
229230
endIntensity = 1f
230231
)
231232
}
232233
.padding(horizontal = CodeTheme.dimens.inset)
233-
.navigationBarsPadding()
234234
.padding(vertical = CodeTheme.dimens.grid.x3),
235235
verticalAlignment = Alignment.CenterVertically,
236236
horizontalArrangement = Arrangement.spacedBy(CodeTheme.dimens.grid.x2),

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/components/marketcap/MarketCapChart.kt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import com.patrykandpatrick.vico.compose.cartesian.marker.rememberDefaultCartesi
5050
import com.patrykandpatrick.vico.compose.cartesian.rememberCartesianChart
5151
import com.patrykandpatrick.vico.compose.cartesian.rememberVicoScrollState
5252
import com.patrykandpatrick.vico.compose.common.component.rememberTextComponent
53+
import com.patrykandpatrick.vico.compose.common.component.shapeComponent
5354
import com.patrykandpatrick.vico.compose.common.fill
5455
import com.patrykandpatrick.vico.core.cartesian.data.CartesianChartModelProducer
5556
import com.patrykandpatrick.vico.core.cartesian.data.lineSeries
@@ -271,7 +272,7 @@ private fun MarketCapChartContent(
271272
),
272273
),
273274
),
274-
persistentMarkers = remember(isDragging, persistentMarker) {
275+
persistentMarkers = remember(isDragging, persistentMarker, activeMarker) {
275276
if (isDragging) {
276277
{ persistentMarker at 99.0 }
277278
} else {
@@ -296,10 +297,10 @@ private fun MarketCapChartContent(
296297

297298
@Composable
298299
private fun rememberChartMarker(
299-
strokeFill: Color = Color.Unspecified,
300-
outerFill: Color = strokeFill.takeIf { it.isSpecified }?.copy(0.20f) ?: Color.Transparent,
300+
strokeFill: Color? = null,
301301
): CartesianMarker {
302302
val markerFill = CodeTheme.colors.background
303+
val outerFill: Color = strokeFill?.copy(0.20f) ?: Color.Transparent
303304

304305
return rememberDefaultCartesianMarker(
305306
label = rememberTextComponent(
@@ -308,14 +309,16 @@ private fun rememberChartMarker(
308309
valueFormatter = remember {
309310
DefaultCartesianMarker.ValueFormatter.default(colorCode = false)
310311
},
311-
indicator = { color ->
312-
outerFillShapeComponent(
313-
outerFill = fill(outerFill),
314-
margins = Insets(6f),
315-
innerFill = fill(markerFill),
316-
strokeFill = fill(strokeFill.takeIf { it.isSpecified } ?: color),
317-
strokeThickness = 2.dp,
318-
)
312+
indicator = remember(strokeFill) {
313+
{ color ->
314+
outerFillShapeComponent(
315+
outerFill = fill(outerFill),
316+
margins = Insets(6f),
317+
innerFill = fill(markerFill),
318+
strokeFill = fill(strokeFill ?: color),
319+
strokeThickness = 2.dp,
320+
)
321+
}
319322
},
320323
indicatorSize = CodeTheme.dimens.grid.x3,
321324
guideline = null,

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/components/marketcap/ShowOnLongPress.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import androidx.compose.runtime.remember
55
import com.patrykandpatrick.vico.core.cartesian.marker.CartesianMarker
66
import com.patrykandpatrick.vico.core.cartesian.marker.CartesianMarkerController
77
import com.patrykandpatrick.vico.core.cartesian.marker.Interaction
8-
import kotlin.concurrent.atomics.ExperimentalAtomicApi
98

10-
@OptIn(ExperimentalAtomicApi::class)
119
private class ShowOnLongPress : CartesianMarkerController {
1210

1311
private var isPressed = false

0 commit comments

Comments
 (0)