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>()
|
private val listeners = HashSet<PropertyListener>()
|
||||||
|
|
||||||
override fun propertyChanged(name: Name, before: MetaItem<*>?, after: MetaItem<*>?) {
|
override fun propertyChanged(name: Name, before: MetaItem<*>?, after: MetaItem<*>?) {
|
||||||
|
if (before != after) {
|
||||||
for (l in listeners) {
|
for (l in listeners) {
|
||||||
l.action(name, before, after)
|
l.action(name, before, after)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPropertyChange(owner: Any?, action: (Name, before: MetaItem<*>?, after: MetaItem<*>?) -> Unit) {
|
override fun onPropertyChange(owner: Any?, action: (Name, before: MetaItem<*>?, after: MetaItem<*>?) -> Unit) {
|
||||||
listeners.add(PropertyListener(owner, action))
|
listeners.add(PropertyListener(owner, action))
|
||||||
|
@ -93,7 +93,7 @@ fun MetaItem<*>.color(): Color {
|
|||||||
|
|
||||||
fun Mesh.updateMaterial(obj: VisualObject) {
|
fun Mesh.updateMaterial(obj: VisualObject) {
|
||||||
val meta = obj.getProperty(Material3D.MATERIAL_KEY).node?:EmptyMeta
|
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
|
color = meta[Material3D.COLOR_KEY]?.color() ?: ThreeMaterials.DEFAULT_COLOR
|
||||||
opacity = meta[Material3D.OPACITY_KEY]?.double ?: 1.0
|
opacity = meta[Material3D.OPACITY_KEY]?.double ?: 1.0
|
||||||
transparent = opacity < 1.0
|
transparent = opacity < 1.0
|
||||||
|
@ -15,7 +15,7 @@ kotlin {
|
|||||||
js {
|
js {
|
||||||
browser {
|
browser {
|
||||||
webpackTask {
|
webpackTask {
|
||||||
sourceMaps = false
|
//sourceMaps = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user