Fix clipping controls for ThreeCanvas

This commit is contained in:
Alexander Nozik 2023-12-31 20:12:40 +03:00
parent da0f4c0ff0
commit 15ac3545b5
2 changed files with 6 additions and 7 deletions

View File

@ -116,7 +116,7 @@ public fun PropertyEditor(
}
}
CloseButton(editorPropertyState != EditorPropertyState.Defined){
CloseButton(editorPropertyState != EditorPropertyState.Defined) {
rootMeta.remove(name)
update()
}
@ -163,7 +163,7 @@ public fun PropertyEditor(
}
}
awaitClose { properties.removeListener(scope) }
awaitClose { properties.removeListener(scope) }
},
name = Name.EMPTY,
rootDescriptor = descriptor,

View File

@ -155,9 +155,10 @@ public class ThreeCanvas(
}
//Clipping planes
options.useProperty(Canvas3DOptions::clipping) { clipping ->
if (!clipping.meta.isEmpty()) {
renderer.localClippingEnabled = true
options.useProperty(Canvas3DOptions::clipping) { clipping: PointScheme ->
if (clipping.meta.isEmpty()) {
renderer.clippingPlanes = emptyArray()
} else {
boundingBox?.let { boundingBox ->
val xClippingPlane = clipping.x?.let {
val absoluteValue = boundingBox.min.x + (boundingBox.max.x - boundingBox.min.x) * it
@ -175,8 +176,6 @@ public class ThreeCanvas(
renderer.clippingPlanes =
listOfNotNull(xClippingPlane, yClippingPlane, zClippingPlane).toTypedArray()
}
} else {
renderer.localClippingEnabled = false
}
}