Skip to content

Commit

Permalink
Fix flickering when resizing JS canvas (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedrickcooke authored Oct 20, 2022
1 parent 1787058 commit b9b1491
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion element-view/src/jsMain/kotlin/ElementViewAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public class ElementViewAdapter<T>(
if (state.width == 0 || state.height == 0) return@collectLatest
dataSource.collect { data ->
updater.update(state.root, state.width.toFloat(), state.height.toFloat(), data)
window.awaitAnimationFrame()
val canvas = HtmlKanvas(state.view, state.scale)
canvas.context.clearRect(0.0, 0.0, state.width.toDouble(), state.height.toDouble())
state.root.draw(canvas)
canvas.context.resetTransform()
window.awaitAnimationFrame()
}
}
}
Expand Down

0 comments on commit b9b1491

Please sign in to comment.