Add key to SchemeView

This commit is contained in:
Alexander Nozik 2022-09-17 12:44:44 +03:00
parent 9c5c4b5747
commit b68fa02fa4
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
kotlin.code.style=official
kotlin.version=1.6.10
compose.version=1.2.0-alpha01-dev774
compose.version=1.2.0-beta01
agp.version=4.2.2
android.useAndroidX=true

View File

@ -45,7 +45,8 @@ public fun SchemeView(
featuresState: SchemeFeaturesState,
config: SchemeViewConfig = SchemeViewConfig(),
modifier: Modifier = Modifier.fillMaxSize(),
) {
) = key(initialViewPoint) {
var canvasSize by remember { mutableStateOf(defaultCanvasSize) }
var viewPoint by remember { mutableStateOf(initialViewPoint) }
@ -133,7 +134,7 @@ public fun SchemeView(
setViewPoint(newViewPoint)
}.fillMaxSize()
val painterCache = key(featuresState){
val painterCache = key(featuresState) {
featuresState.features().values.filterIsInstance<PainterFeature>().associateWith { it.painter() }
}