@@ -10,7 +10,15 @@ function diffProps(instance: NgtAnyRecord, props: NgtAnyRecord) {
1010 const changes : [ key : string , value : unknown ] [ ] = [ ] ;
1111
1212 for ( const [ propKey , propValue ] of propsEntries ) {
13- if ( is . equ ( propValue , instance [ propKey ] ) ) continue ;
13+ let key = propKey ;
14+ if ( is . colorSpaceExist ( instance ) ) {
15+ if ( propKey === 'encoding' ) {
16+ key = 'colorSpace' ;
17+ } else if ( propKey === 'outputEncoding' ) {
18+ key = 'outputColorSpace' ;
19+ }
20+ }
21+ if ( is . equ ( propValue , instance [ key ] ) ) continue ;
1422 changes . push ( [ propKey , propValue ] ) ;
1523 }
1624
@@ -27,9 +35,8 @@ export function applyProps(instance: NgtInstanceNode, props: NgtAnyRecord): NgtI
2735 const changes = diffProps ( instance , props ) ;
2836
2937 for ( let i = 0 ; i < changes . length ; i ++ ) {
30- let key = changes [ i ] [ 0 ] ;
3138 const currentInstance = instance ;
32- const targetProp = currentInstance [ key ] as NgtAnyRecord ;
39+ let key = changes [ i ] [ 0 ] ;
3340 let value = changes [ i ] [ 1 ] ;
3441
3542 if ( is . colorSpaceExist ( currentInstance ) ) {
@@ -46,6 +53,8 @@ export function applyProps(instance: NgtInstanceNode, props: NgtAnyRecord): NgtI
4653 }
4754 }
4855
56+ const targetProp = currentInstance [ key ] as NgtAnyRecord ;
57+
4958 // special treatmen for objects with support for set/copy, and layers
5059 if ( targetProp && targetProp [ 'set' ] && ( targetProp [ 'copy' ] || targetProp instanceof THREE . Layers ) ) {
5160 const isColor = targetProp instanceof THREE . Color ;
0 commit comments