Fix Three color change problem

This commit is contained in:
Alexander Nozik 2019-12-26 11:46:44 +03:00
parent c2e396328f
commit 8932c8dfd1
3 changed files with 6 additions and 4 deletions

View File

@ -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))

View File

@ -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

View File

@ -15,7 +15,7 @@ kotlin {
js {
browser {
webpackTask {
sourceMaps = false
//sourceMaps = false
}
}
}