@@ -10,7 +10,15 @@ function diffProps(instance: NgtAnyRecord, props: NgtAnyRecord) {
10
10
const changes : [ key : string , value : unknown ] [ ] = [ ] ;
11
11
12
12
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 ;
14
22
changes . push ( [ propKey , propValue ] ) ;
15
23
}
16
24
@@ -27,9 +35,8 @@ export function applyProps(instance: NgtInstanceNode, props: NgtAnyRecord): NgtI
27
35
const changes = diffProps ( instance , props ) ;
28
36
29
37
for ( let i = 0 ; i < changes . length ; i ++ ) {
30
- let key = changes [ i ] [ 0 ] ;
31
38
const currentInstance = instance ;
32
- const targetProp = currentInstance [ key ] as NgtAnyRecord ;
39
+ let key = changes [ i ] [ 0 ] ;
33
40
let value = changes [ i ] [ 1 ] ;
34
41
35
42
if ( is . colorSpaceExist ( currentInstance ) ) {
@@ -46,6 +53,8 @@ export function applyProps(instance: NgtInstanceNode, props: NgtAnyRecord): NgtI
46
53
}
47
54
}
48
55
56
+ const targetProp = currentInstance [ key ] as NgtAnyRecord ;
57
+
49
58
// special treatmen for objects with support for set/copy, and layers
50
59
if ( targetProp && targetProp [ 'set' ] && ( targetProp [ 'copy' ] || targetProp instanceof THREE . Layers ) ) {
51
60
const isColor = targetProp instanceof THREE . Color ;
0 commit comments