forked from kscience/visionforge
Fix Three color change problem
This commit is contained in:
parent
c2e396328f
commit
8932c8dfd1
@ -48,10 +48,12 @@ abstract class AbstractVisualObject : VisualObject {
|
||||
private val listeners = HashSet<PropertyListener>()
|
||||
|
||||
override fun propertyChanged(name: Name, before: MetaItem<*>?, after: MetaItem<*>?) {
|
||||
if (before != after) {
|
||||
for (l in listeners) {
|
||||
l.action(name, before, after)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPropertyChange(owner: Any?, action: (Name, before: MetaItem<*>?, after: MetaItem<*>?) -> Unit) {
|
||||
listeners.add(PropertyListener(owner, action))
|
||||
|
@ -93,7 +93,7 @@ fun MetaItem<*>.color(): Color {
|
||||
|
||||
fun Mesh.updateMaterial(obj: VisualObject) {
|
||||
val meta = obj.getProperty(Material3D.MATERIAL_KEY).node?:EmptyMeta
|
||||
material = (material as? MeshBasicMaterial ?: MeshBasicMaterial()).apply {
|
||||
material = MeshBasicMaterial().apply {
|
||||
color = meta[Material3D.COLOR_KEY]?.color() ?: ThreeMaterials.DEFAULT_COLOR
|
||||
opacity = meta[Material3D.OPACITY_KEY]?.double ?: 1.0
|
||||
transparent = opacity < 1.0
|
||||
|
@ -15,7 +15,7 @@ kotlin {
|
||||
js {
|
||||
browser {
|
||||
webpackTask {
|
||||
sourceMaps = false
|
||||
//sourceMaps = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user