Move stuff into base

This commit is contained in:
2024-08-09 19:55:15 +02:00
parent 8df6a4fff6
commit 1eed613b2a
21 changed files with 40 additions and 902 deletions

View File

@@ -40,9 +40,7 @@ class PhysicalStringView(
}
private fun onAnimationFrame(time: Double) {
if (MainView.started) {
draw()
}
draw()
window.requestAnimationFrame(::onAnimationFrame)
}
@@ -89,7 +87,7 @@ class PhysicalStringView(
private fun draw() {
val ctx = context
if (ctx != null) {
if (ctx != null && ctx.canvas.isConnected) {
val width = ctx.canvas.width.toDouble()
val height = ctx.canvas.height.toDouble()
val halfHeight = height / 2.0