Skip to content

Commit

Permalink
Wait for editorSize
Browse files Browse the repository at this point in the history
  • Loading branch information
badoualy committed Apr 17, 2023
1 parent 3be9303 commit 1d6aa8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ private fun StoryEditorContent(
StoryEditorScopeImpl(state, onDeleteElement)
}
with(scope) {
content()
// Wait for editorSize to be reported before actually adding elements to composition
val isEditorSizeReported by remember { derivedStateOf { state.editorSize.width > 0 } }
if (isEditorSizeReported) {
content()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ internal fun EditorDeleteButton(
exit = fadeOut(),
modifier = modifier
.onPlaced { deleteBounds = it.boundsInParent() }
.scale(if (isInDeleteRange) 1.5f else 1f)
.padding(24.dp)
) {
val color = if (isInDeleteRange) Color.Red else Color.Black
Surface(
shape = CircleShape,
color = color.copy(alpha = 0.5f),
contentColor = Color.White,
modifier = Modifier.scale(if (isInDeleteRange) 1.5f else 1f)
contentColor = Color.White
) {
Icon(
Icons.Default.Delete,
Expand Down

0 comments on commit 1d6aa8a

Please sign in to comment.