mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 21:45:52 +00:00
comment more
This commit is contained in:
+20
-20
@@ -1143,26 +1143,26 @@ fun ChatLayout(
|
||||
val draggingDown = range.startIndex > range.endIndex || (range.startIndex == range.endIndex && range.startOffset < range.endOffset)
|
||||
val gap = with(LocalDensity.current) { 4.dp.toPx() }
|
||||
var buttonSize by remember { mutableStateOf(IntSize.Zero) }
|
||||
val ls = manager.listState?.value
|
||||
val itemInfo = ls?.layoutInfo?.visibleItemsInfo?.find { it.index == range.endIndex }
|
||||
if (ls != null && itemInfo != null && manager.focusCharRect != Rect.Zero) {
|
||||
val itemWindowY = (ls.layoutInfo.viewportEndOffset - itemInfo.offset - itemInfo.size).toFloat()
|
||||
val cr = manager.focusCharRect
|
||||
val vp = manager.viewportPosition
|
||||
val charX = (if (draggingDown) cr.right else cr.left) - vp.x
|
||||
val charY = itemWindowY + (if (draggingDown) cr.bottom else cr.top) - vp.y
|
||||
val x = if (draggingDown) charX
|
||||
else (charX - buttonSize.width).coerceAtLeast(0f)
|
||||
val y = if (draggingDown) charY + gap
|
||||
else (charY - buttonSize.height - gap)
|
||||
val clampedX = x.coerceIn(0f, (manager.viewportWidth - buttonSize.width).coerceAtLeast(0f))
|
||||
// SelectionCopyButton(
|
||||
// modifier = Modifier
|
||||
// .offset { IntOffset(clampedX.toInt(), y.toInt()) }
|
||||
// .onSizeChanged { buttonSize = it },
|
||||
// onCopy = { manager.onCopySelection?.invoke() }
|
||||
// )
|
||||
}
|
||||
// val ls = manager.listState?.value
|
||||
// val itemInfo = ls?.layoutInfo?.visibleItemsInfo?.find { it.index == range.endIndex }
|
||||
// if (ls != null && itemInfo != null && manager.focusCharRect != Rect.Zero) {
|
||||
// val itemWindowY = (ls.layoutInfo.viewportEndOffset - itemInfo.offset - itemInfo.size).toFloat()
|
||||
// val cr = manager.focusCharRect
|
||||
// val vp = manager.viewportPosition
|
||||
// val charX = (if (draggingDown) cr.right else cr.left) - vp.x
|
||||
// val charY = itemWindowY + (if (draggingDown) cr.bottom else cr.top) - vp.y
|
||||
// val x = if (draggingDown) charX
|
||||
// else (charX - buttonSize.width).coerceAtLeast(0f)
|
||||
// val y = if (draggingDown) charY + gap
|
||||
// else (charY - buttonSize.height - gap)
|
||||
// val clampedX = x.coerceIn(0f, (manager.viewportWidth - buttonSize.width).coerceAtLeast(0f))
|
||||
// SelectionCopyButton(
|
||||
// modifier = Modifier
|
||||
// .offset { IntOffset(clampedX.toInt(), y.toInt()) }
|
||||
// .onSizeChanged { buttonSize = it },
|
||||
// onCopy = { manager.onCopySelection?.invoke() }
|
||||
// )
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user