Skip to content

Commit 56cca83

Browse files
committed
docs: adjust portal shapes a bit
1 parent 366e103 commit 56cca83

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

apps/kitchen-sink/src/app/soba/portal-shapes/letter.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
CUSTOM_ELEMENTS_SCHEMA,
66
ElementRef,
77
input,
8+
signal,
89
TemplateRef,
910
viewChild,
1011
} from '@angular/core';
@@ -54,7 +55,6 @@ import boldFont from './bold.blob';
5455
bevelOffset: 0,
5556
}"
5657
(dblclick)="onDblClick($any($event))"
57-
(pointermissed)="onPointerMissed($any($event))"
5858
>
5959
<ngts-mesh-transmission-material
6060
[options]="$any({ clearcoat: 1, samples: 3, thickness: 40, chromaticAberration: 0.25, anisotropy: 0.4 })"
@@ -109,6 +109,8 @@ export class Letter {
109109
private controls = this.store.select('controls');
110110
protected eventsCompute = this.store.select('events', 'compute');
111111

112+
private focused = signal(false);
113+
112114
constructor() {
113115
injectBeforeRender(() => {
114116
const contents = this.contentsRef()?.nativeElement;
@@ -123,15 +125,13 @@ export class Letter {
123125
const controls = this.controls() as CameraControls;
124126
if (!controls) return;
125127

126-
// NOTE: if any of the render-texture scene has other controls, it messes this up
127-
void controls.fitToBox(this.centerRef().groupRef().nativeElement, true);
128-
}
129-
130-
onPointerMissed(event: NgtThreeEvent<MouseEvent>) {
131-
event.stopPropagation();
132-
const controls = this.controls() as CameraControls;
133-
if (!controls) return;
128+
if (this.focused()) {
129+
void controls.reset(true);
130+
} else {
131+
// NOTE: if any of the render-texture scene has other controls, it messes this up
132+
void controls.fitToBox(this.centerRef().groupRef().nativeElement, true);
133+
}
134134

135-
void controls.reset(true);
135+
this.focused.update((v) => !v);
136136
}
137137
}

apps/kitchen-sink/src/app/soba/portal-shapes/portal-shapes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Experience } from './experience';
55
@Component({
66
template: `
77
<ngt-canvas [sceneGraph]="sceneGraph" shadows [camera]="{ fov: 45, position: [-20, 40, 30], near: 1, far: 300 }" />
8+
<code class="absolute top-2 left-2 text-black">double click to zoom in/out</code>
89
`,
910
changeDetection: ChangeDetectionStrategy.OnPush,
1011
imports: [NgtCanvas],

0 commit comments

Comments
 (0)