fix: refine connector visibility logic for avatar in ProfileMetaballOverlay
This commit is contained in:
@@ -257,8 +257,17 @@ fun ProfileMetaballOverlay(
|
||||
val c = (distance / maxDist).coerceIn(-1f, 1f)
|
||||
val v = ((1f - c / 1.3f) / 2f).coerceIn(0f, 0.8f)
|
||||
|
||||
// Should we draw the connector? (when avatar gets close enough)
|
||||
val showConnector = collapseProgress > 0.3f && avatarState.showBlob && distance < maxDist * 2f
|
||||
// Like Telegram: isDrawing = vr <= dp(40), isNear = vr <= dp(32)
|
||||
// Avatar radius thresholds (in px)
|
||||
val dp40 = with(density) { 40.dp.toPx() }
|
||||
val dp32 = with(density) { 32.dp.toPx() }
|
||||
|
||||
// Should we draw the metaball effect? (when avatar is small enough)
|
||||
val isDrawing = avatarState.radius <= dp40
|
||||
val isNear = avatarState.radius <= dp32
|
||||
|
||||
// Show connector only when avatar is close enough AND small enough
|
||||
val showConnector = isDrawing && avatarState.showBlob && distance < maxDist * 1.5f
|
||||
|
||||
// Calculate blur intensity for avatar based on distance to notch (like Telegram)
|
||||
// When avatar is far - no blur, when close - more blur
|
||||
|
||||
Reference in New Issue
Block a user