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) rootMeta.remove(name)
update() update()
} }

View File

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