Skip to content

Commit 10388e5

Browse files
committed
fix: set legacy mode with canvas inputs rather than state.legacy
1 parent 2266d69 commit 10388e5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

apps/demo/src/app/test/test.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2-
import { NgtBeforeRenderEvent, NgtCanvas } from 'angular-three';
2+
import { NgtArgs, NgtBeforeRenderEvent, NgtCanvas } from 'angular-three';
3+
import * as THREE from 'three';
34

45
@Component({
56
selector: 'demo-test-scene',
67
standalone: true,
78
template: `
9+
<ngt-color *args="['#BFD1E5']" attach="background" />
810
<ngt-mesh
911
(click)="active = !active"
1012
(pointerover)="hover = true"
@@ -16,6 +18,7 @@ import { NgtBeforeRenderEvent, NgtCanvas } from 'angular-three';
1618
<ngt-mesh-basic-material [color]="hover ? 'goldenrod' : 'darkred'" />
1719
</ngt-mesh>
1820
`,
21+
imports: [NgtArgs],
1922
schemas: [CUSTOM_ELEMENTS_SCHEMA],
2023
})
2124
export class Scene {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export class NgtStore extends NgtRxStore<NgtState> {
343343

344344
// Safely set color management if available.
345345
// Avoid accessing THREE.ColorManagement to play nice with older versions
346-
if (THREE.ColorManagement) THREE.ColorManagement.legacyMode = state.legacy;
346+
if (THREE.ColorManagement) THREE.ColorManagement.legacyMode = legacy ?? true;
347347
const outputEncoding = linear ? THREE.LinearEncoding : THREE.sRGBEncoding;
348348
const toneMapping = flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping;
349349

0 commit comments

Comments
 (0)