Skip to content

Commit c00d4a1

Browse files
committed
fix: adjust ColorManagement automatic configuration to accomodate 150
1 parent 98e76c8 commit c00d4a1

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

libs/angular-three/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"peerDependencies": {
2424
"@angular/common": "^15.1.0",
2525
"@angular/core": "^15.1.0",
26-
"three": "^0.148.0 || ^0.149.0"
26+
"three": "^0.148.0 || ^0.149.0 || ^0.150.0"
2727
},
2828
"dependencies": {
2929
"ngx-resize": "^1.0.0",

libs/angular-three/src/lib/routed-scene.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export class NgtRoutedScene {
1919
filter((event) => event instanceof ActivationEnd),
2020
takeUntil(destroy$)
2121
)
22-
.subscribe(() => {
23-
cdr.detectChanges();
24-
});
22+
.subscribe(cdr.detectChanges.bind(cdr));
2523
}
2624
}

libs/angular-three/src/lib/stores/store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { selectSlice } from '@rx-angular/state';
44
import * as THREE from 'three';
55
import { createLoop } from '../loop';
66
import type {
7+
NgtAnyRecord,
78
NgtBeforeRenderRecord,
89
NgtCanvasInputs,
910
NgtDpr,
@@ -334,7 +335,11 @@ export class NgtStore extends NgtRxStore<NgtState> {
334335

335336
// Safely set color management if available.
336337
// Avoid accessing THREE.ColorManagement to play nice with older versions
337-
if (THREE.ColorManagement) THREE.ColorManagement.legacyMode = legacy ?? true;
338+
if (THREE.ColorManagement) {
339+
const ColorManagement = THREE.ColorManagement as NgtAnyRecord;
340+
if ('enabled' in ColorManagement) ColorManagement['enabled'] = !legacy ?? false;
341+
else if ('legacyMode' in ColorManagement) ColorManagement['legacyMode'] = legacy ?? true;
342+
}
338343
const outputEncoding = linear ? THREE.LinearEncoding : THREE.sRGBEncoding;
339344
const toneMapping = flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping;
340345

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"ngx-resize": "^1.0.6",
7373
"nice-color-palettes": "^3.0.0",
7474
"rxjs": "~7.8.0",
75-
"three": "^0.149.0",
75+
"three": "^0.150.1",
7676
"three-stdlib": "^2.21.8",
7777
"tslib": "^2.5.0",
7878
"zone.js": "0.12.0"

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)