@spatial-elements/core 1.0.0-beta.5 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/CarouselDeviceCamera.d.ts +12 -0
- package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
- package/dist/catalog/CarouselDeviceCamera.js +44 -0
- package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +7 -2
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
- package/dist/catalog/CarouselGlassCompositor.js +85 -24
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
- package/dist/catalog/CarouselGround.d.ts +21 -0
- package/dist/catalog/CarouselGround.d.ts.map +1 -0
- package/dist/catalog/CarouselGround.js +107 -0
- package/dist/catalog/CarouselGround.js.map +1 -0
- package/dist/catalog/CatalogDepthBlur.d.ts +26 -0
- package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -0
- package/dist/catalog/CatalogDepthBlur.js +87 -0
- package/dist/catalog/CatalogDepthBlur.js.map +1 -0
- package/dist/catalog/CatalogModelOutline.d.ts +31 -0
- package/dist/catalog/CatalogModelOutline.d.ts.map +1 -0
- package/dist/catalog/CatalogModelOutline.js +127 -0
- package/dist/catalog/CatalogModelOutline.js.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +44 -2
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +293 -88
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +62 -4
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/SpatialGeometryCapture.d.ts +9 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -1
- package/dist/catalog/SpatialGeometryCapture.js +11 -1
- package/dist/catalog/SpatialGeometryCapture.js.map +1 -1
- package/dist/catalog/cardModelFit.d.ts +7 -0
- package/dist/catalog/cardModelFit.d.ts.map +1 -0
- package/dist/catalog/cardModelFit.js +16 -0
- package/dist/catalog/cardModelFit.js.map +1 -0
- package/dist/catalog/cardProjection.d.ts +8 -0
- package/dist/catalog/cardProjection.d.ts.map +1 -0
- package/dist/catalog/cardProjection.js +51 -0
- package/dist/catalog/cardProjection.js.map +1 -0
- package/dist/catalog/carouselMotion.d.ts +35 -0
- package/dist/catalog/carouselMotion.d.ts.map +1 -1
- package/dist/catalog/carouselMotion.js +85 -4
- package/dist/catalog/carouselMotion.js.map +1 -1
- package/dist/catalog/carouselProximity.d.ts +11 -0
- package/dist/catalog/carouselProximity.d.ts.map +1 -0
- package/dist/catalog/carouselProximity.js +13 -0
- package/dist/catalog/carouselProximity.js.map +1 -0
- package/dist/catalog/carouselSupport.d.ts +4 -0
- package/dist/catalog/carouselSupport.d.ts.map +1 -0
- package/dist/catalog/carouselSupport.js +30 -0
- package/dist/catalog/carouselSupport.js.map +1 -0
- package/dist/catalog/catalogPose.d.ts +36 -6
- package/dist/catalog/catalogPose.d.ts.map +1 -1
- package/dist/catalog/catalogPose.js +79 -23
- package/dist/catalog/catalogPose.js.map +1 -1
- package/dist/catalog/deviceYaw.d.ts +21 -0
- package/dist/catalog/deviceYaw.d.ts.map +1 -0
- package/dist/catalog/deviceYaw.js +87 -0
- package/dist/catalog/deviceYaw.js.map +1 -0
- package/dist/catalog/listDeviceOrientation.d.ts +15 -0
- package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
- package/dist/catalog/listDeviceOrientation.js +245 -0
- package/dist/catalog/listDeviceOrientation.js.map +1 -0
- package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
- package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
- package/dist/stage/DeviceGeometryMotion.js +37 -0
- package/dist/stage/DeviceGeometryMotion.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +2 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
- package/dist/stage/LiquidGlassPanel.js +8 -1
- package/dist/stage/LiquidGlassPanel.js.map +1 -1
- package/dist/stage/MinimapController.d.ts +1 -0
- package/dist/stage/MinimapController.d.ts.map +1 -1
- package/dist/stage/MinimapController.js +7 -0
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +19 -7
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +56 -0
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +53 -17
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +14 -63
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/interactionOutline.d.ts +14 -0
- package/dist/stage/interactionOutline.d.ts.map +1 -0
- package/dist/stage/interactionOutline.js +81 -0
- package/dist/stage/interactionOutline.js.map +1 -0
- package/dist/stage/panelContext.d.ts +2 -0
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +1 -0
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { CatalogGeometryFade } from './CatalogGeometryFade.js';
|
|
2
|
+
import { CarouselDeviceCamera } from './CarouselDeviceCamera.js';
|
|
3
|
+
import { isDeviceOrientationPaused, getListDeviceYaw, getListDevicePitch, getListDeviceRoll, subscribeListDeviceYaw } from './listDeviceOrientation.js';
|
|
4
|
+
import { cardModelFit } from './cardModelFit.js';
|
|
5
|
+
import { CatalogDepthBlur } from './CatalogDepthBlur.js';
|
|
6
|
+
import { CatalogModelOutline } from './CatalogModelOutline.js';
|
|
7
|
+
import { DEFAULT_INTERACTION_THEME } from '../stage/stageConstants.js';
|
|
2
8
|
import { recordCarouselPanel } from './carouselPanelProjection.js';
|
|
3
9
|
import { prepareSpatialElementFrame } from '../stage/spatialElementFrame.js';
|
|
4
10
|
import { resolveSpatialElementLodPair } from './spatialElementLodPair.js';
|
|
@@ -13,6 +19,9 @@ import { applyCatalogMaterialOpacity, captureCatalogMaterialOpacity } from './ca
|
|
|
13
19
|
import { CATALOG_POSE_CHANGED } from './catalogPose.js';
|
|
14
20
|
import { getProjectiveCssMatrix3d } from '../stage/cssProjection.js';
|
|
15
21
|
import { CarouselGlassCompositor } from './CarouselGlassCompositor.js';
|
|
22
|
+
import { CarouselGround } from './CarouselGround.js';
|
|
23
|
+
import { carouselProximity } from './carouselProximity.js';
|
|
24
|
+
import { carouselSupport } from './carouselSupport.js';
|
|
16
25
|
/** Removes irrelevant homogeneous scale so the reference point follows a continuous screen path. */
|
|
17
26
|
export function normalizeSpatialElementClipMatrix(matrix, point) {
|
|
18
27
|
const clip = new THREE.Vector4(point.x, point.y, point.z, 1).applyMatrix4(matrix);
|
|
@@ -55,9 +64,13 @@ export function getSpatialElementHandoffProjection(sourceClip, targetClip, progr
|
|
|
55
64
|
export class CatalogSpatialElementLayer {
|
|
56
65
|
assets;
|
|
57
66
|
invalidate;
|
|
67
|
+
interactionTheme;
|
|
58
68
|
getRenderTargets() {
|
|
59
69
|
return [
|
|
70
|
+
...this.outline.getRenderTargets(),
|
|
71
|
+
...this.depthBlur.getRenderTargets(),
|
|
60
72
|
...this.glass.getRenderTargets(),
|
|
73
|
+
...this.ground.getRenderTargets(),
|
|
61
74
|
...this.geometryFade.getRenderTargets(),
|
|
62
75
|
...(this.handoff?.blend?.getRenderTargets() ?? [])
|
|
63
76
|
];
|
|
@@ -67,28 +80,43 @@ export class CatalogSpatialElementLayer {
|
|
|
67
80
|
getStats() {
|
|
68
81
|
return {
|
|
69
82
|
instances: this.actors.size,
|
|
83
|
+
deviceCamera: { pitch: this.carouselDeviceCamera.angles.x, yaw: this.carouselDeviceCamera.angles.y, roll: this.carouselDeviceCamera.angles.z },
|
|
70
84
|
detachedInstances: this.detachedInstances,
|
|
71
85
|
visible: [...this.actors.values()].filter((actor) => actor.root.visible).length,
|
|
72
86
|
passes: this.passes,
|
|
73
87
|
glass: this.glass.getStats(),
|
|
88
|
+
ground: this.ground.getStats(),
|
|
89
|
+
depthBlur: this.depthBlur.getStats(),
|
|
90
|
+
outline: this.outline.getStats(),
|
|
74
91
|
actors: [...this.actors.values()].map((actor) => ({
|
|
75
92
|
spatialElementId: actor.spatialElementId,
|
|
93
|
+
projectedCenter: actor.view.getWorldPosition(new THREE.Vector3()).project(actor.pose ? this.carouselCamera : this.camera).toArray(),
|
|
76
94
|
band: actor.band,
|
|
77
95
|
clip: actor.clip ? { ...actor.clip } : undefined,
|
|
78
96
|
opacity: this.exitOpacity * (actor.materials[0]?.material.opacity ?? 0),
|
|
79
97
|
materialOpacity: actor.materials[0]?.material.opacity ?? 0,
|
|
80
|
-
depthWrite: actor.materials[0]?.material.depthWrite
|
|
98
|
+
depthWrite: actor.materials[0]?.material.depthWrite,
|
|
99
|
+
modelScale: actor.view.scale.x, modelDepth: actor.view.position.z,
|
|
100
|
+
blur: actor.blur ?? 0,
|
|
101
|
+
hover: actor.hover,
|
|
102
|
+
proximityTilt: { x: actor.rotationX, y: actor.rotationY },
|
|
103
|
+
deviceTilt: { yaw: actor.deviceYaw, pitch: actor.devicePitch, roll: actor.deviceRoll }
|
|
81
104
|
}))
|
|
82
105
|
};
|
|
83
106
|
}
|
|
84
|
-
|
|
107
|
+
depthBlur = new CatalogDepthBlur();
|
|
108
|
+
outline = new CatalogModelOutline();
|
|
109
|
+
glass = new CarouselGlassCompositor(this.depthBlur);
|
|
110
|
+
ground = new CarouselGround();
|
|
85
111
|
geometryFade = new CatalogGeometryFade();
|
|
86
112
|
handoffScene = new THREE.Scene();
|
|
87
113
|
camera = new THREE.PerspectiveCamera(45, 1, 1, 4000);
|
|
88
114
|
// The carousel sits ~2500 units from the lens. A near plane of 1 wastes depth
|
|
89
115
|
// precision and makes closely spaced CAD surfaces fight after the longer-lens change.
|
|
90
116
|
carouselCamera = new THREE.PerspectiveCamera(45, 1, 250, 6000);
|
|
91
|
-
|
|
117
|
+
carouselUiCamera = new THREE.PerspectiveCamera();
|
|
118
|
+
carouselDeviceCamera = new CarouselDeviceCamera();
|
|
119
|
+
carouselSelection;
|
|
92
120
|
handoffCamera = new THREE.PerspectiveCamera();
|
|
93
121
|
actors = new Map();
|
|
94
122
|
requests = new Set();
|
|
@@ -97,7 +125,8 @@ export class CatalogSpatialElementLayer {
|
|
|
97
125
|
loadingKeys = new Set();
|
|
98
126
|
failedKeys = new Set();
|
|
99
127
|
motion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
100
|
-
|
|
128
|
+
unsubscribeDeviceYaw;
|
|
129
|
+
pointer = { x: 0, y: 0, active: false, pressed: false };
|
|
101
130
|
handoff;
|
|
102
131
|
handoffPoint;
|
|
103
132
|
generation = 0;
|
|
@@ -128,11 +157,18 @@ export class CatalogSpatialElementLayer {
|
|
|
128
157
|
pointerDown = (event) => {
|
|
129
158
|
if (event.pointerType !== 'mouse')
|
|
130
159
|
this.pointerLeave();
|
|
160
|
+
this.pointer.pressed = true;
|
|
161
|
+
this.invalidate();
|
|
162
|
+
};
|
|
163
|
+
pointerUp = () => {
|
|
164
|
+
this.pointer.pressed = false;
|
|
165
|
+
this.invalidate();
|
|
131
166
|
};
|
|
132
167
|
pointerLeave = () => {
|
|
133
168
|
if (!this.pointer.active)
|
|
134
169
|
return;
|
|
135
170
|
this.pointer.active = false;
|
|
171
|
+
this.pointer.pressed = false;
|
|
136
172
|
this.invalidate();
|
|
137
173
|
};
|
|
138
174
|
resize = () => {
|
|
@@ -143,12 +179,16 @@ export class CatalogSpatialElementLayer {
|
|
|
143
179
|
motionChange = () => this.invalidate();
|
|
144
180
|
setPageBackground(value) {
|
|
145
181
|
this.scene.fog.color.set(value);
|
|
146
|
-
this.carouselFog.color.set(value);
|
|
147
182
|
this.invalidate();
|
|
148
183
|
}
|
|
149
|
-
constructor(assets, invalidate) {
|
|
184
|
+
constructor(assets, invalidate, interactionTheme = () => DEFAULT_INTERACTION_THEME) {
|
|
150
185
|
this.assets = assets;
|
|
151
186
|
this.invalidate = invalidate;
|
|
187
|
+
this.interactionTheme = interactionTheme;
|
|
188
|
+
this.unsubscribeDeviceYaw = subscribeListDeviceYaw(() => {
|
|
189
|
+
if (!this.transitionActive && [...this.actors.values()].some(actor => actor.root.visible && actor.card?.closest('[data-device-orientation]')))
|
|
190
|
+
this.invalidate();
|
|
191
|
+
});
|
|
152
192
|
this.scene.environmentIntensity = 0.5;
|
|
153
193
|
this.scene.fog = new THREE.Fog(0xffffff, 1200, 2500);
|
|
154
194
|
this.handoffScene.fog = this.scene.fog;
|
|
@@ -159,6 +199,10 @@ export class CatalogSpatialElementLayer {
|
|
|
159
199
|
this.camera.updateMatrixWorld();
|
|
160
200
|
window.addEventListener('pointermove', this.pointerMove, { passive: true });
|
|
161
201
|
window.addEventListener('pointerdown', this.pointerDown, { capture: true, passive: true });
|
|
202
|
+
window.addEventListener('pointerup', this.pointerUp, { passive: true });
|
|
203
|
+
window.addEventListener('pointercancel', this.pointerUp, { passive: true });
|
|
204
|
+
window.addEventListener('focusin', this.motionChange);
|
|
205
|
+
window.addEventListener('focusout', this.motionChange);
|
|
162
206
|
window.addEventListener('pointerleave', this.pointerLeave);
|
|
163
207
|
window.addEventListener('blur', this.pointerLeave);
|
|
164
208
|
window.addEventListener('resize', this.resize);
|
|
@@ -222,9 +266,10 @@ export class CatalogSpatialElementLayer {
|
|
|
222
266
|
const list = document.querySelector(`[data-catalog-list][data-brand-id="${CSS.escape(brandId)}"]`);
|
|
223
267
|
const slot = list?.querySelector(`[data-catalog-geometry][data-spatial-element-id="${CSS.escape(spatialElement.id)}"]${spatialElement.occurrence ? `[data-catalog-occurrence="${CSS.escape(spatialElement.occurrence)}"]` : ''}`);
|
|
224
268
|
const rect = slot?.getBoundingClientRect();
|
|
269
|
+
const margin = spatialElement.pose ? 700 : 300;
|
|
225
270
|
return (rect &&
|
|
226
|
-
rect.top < window.innerHeight +
|
|
227
|
-
rect.bottom > -
|
|
271
|
+
rect.top < window.innerHeight + margin &&
|
|
272
|
+
rect.bottom > -margin &&
|
|
228
273
|
rect.left < window.innerWidth &&
|
|
229
274
|
rect.right > 0);
|
|
230
275
|
})
|
|
@@ -283,6 +328,10 @@ export class CatalogSpatialElementLayer {
|
|
|
283
328
|
this.carouselCamera.aspect = width / height;
|
|
284
329
|
this.carouselCamera.fov = THREE.MathUtils.radToDeg(2 * Math.atan(height / 5000));
|
|
285
330
|
this.carouselCamera.updateProjectionMatrix();
|
|
331
|
+
this.carouselUiCamera.copy(this.carouselCamera);
|
|
332
|
+
this.carouselUiCamera.position.set(0, 0, 2500);
|
|
333
|
+
this.carouselUiCamera.quaternion.identity();
|
|
334
|
+
this.carouselUiCamera.updateMatrixWorld(true);
|
|
286
335
|
this.scene.environment = environment;
|
|
287
336
|
this.handoffScene.environment = this.handoff?.sourceEnvironment ?? environment;
|
|
288
337
|
const scroll = getStageVisualScrollPosition();
|
|
@@ -296,7 +345,11 @@ export class CatalogSpatialElementLayer {
|
|
|
296
345
|
const delta = Math.min(this.lastTime ? (now - this.lastTime) / 1000 : 1 / 60, 0.05);
|
|
297
346
|
this.lastTime = now;
|
|
298
347
|
let animating = false;
|
|
348
|
+
const projectCarousels = [];
|
|
349
|
+
let selected;
|
|
299
350
|
this.glass.beginFrame();
|
|
351
|
+
if (!this.handoff)
|
|
352
|
+
this.ground.beginFrame();
|
|
300
353
|
for (const actor of this.actors.values()) {
|
|
301
354
|
if (this.handoff?.actor === actor)
|
|
302
355
|
continue;
|
|
@@ -321,88 +374,168 @@ export class CatalogSpatialElementLayer {
|
|
|
321
374
|
this.queueDirty = true;
|
|
322
375
|
continue;
|
|
323
376
|
}
|
|
377
|
+
// Free-standing carousel geometry may still be on screen after its
|
|
378
|
+
// semantic section has left it. Keep the same margin as asset residency.
|
|
379
|
+
const margin = actor.pose ? 700 : 96;
|
|
324
380
|
actor.root.visible =
|
|
325
381
|
this.exitOpacity > 0.001 &&
|
|
326
|
-
slot.top + dy < height +
|
|
327
|
-
slot.top + dy + slot.height > -
|
|
382
|
+
slot.top + dy < height + margin &&
|
|
383
|
+
slot.top + dy + slot.height > -margin &&
|
|
328
384
|
slot.left + dx < width &&
|
|
329
385
|
slot.left + dx + slot.width > 0;
|
|
330
386
|
if (!actor.root.visible)
|
|
331
387
|
continue;
|
|
332
388
|
if (actor.pose) {
|
|
389
|
+
actor.view.quaternion.copy(actor.viewOrientation);
|
|
333
390
|
const pose = actor.pose.read();
|
|
391
|
+
const approach = this.pointer.active && !this.pointer.pressed && !this.transitionActive &&
|
|
392
|
+
!this.motion.matches && actor.renderRect && pose.visible
|
|
393
|
+
? carouselProximity(this.pointer.x, this.pointer.y, actor.renderRect) : { x: 0, y: 0 };
|
|
394
|
+
for (const [property, target] of [['rotationX', approach.x], ['rotationY', approach.y]]) {
|
|
395
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 12, delta);
|
|
396
|
+
if (Math.abs(actor[property] - target) < 0.0001)
|
|
397
|
+
actor[property] = target;
|
|
398
|
+
animating ||= actor[property] !== target;
|
|
399
|
+
}
|
|
400
|
+
// Add the remaining sensor response only to the focus model. The camera keeps 25%.
|
|
401
|
+
const sensorEnabled = pose.front && !this.motion.matches && !this.transitionActive &&
|
|
402
|
+
actor.card.closest('[data-device-orientation]');
|
|
403
|
+
for (const [property, target] of [
|
|
404
|
+
['deviceYaw', sensorEnabled ? -getListDeviceYaw() * 0.75 : 0],
|
|
405
|
+
['devicePitch', sensorEnabled ? -getListDevicePitch() * 0.75 : 0],
|
|
406
|
+
['deviceRoll', sensorEnabled ? -getListDeviceRoll() * 0.75 : 0]
|
|
407
|
+
]) {
|
|
408
|
+
if (!this.motion.matches && isDeviceOrientationPaused())
|
|
409
|
+
continue;
|
|
410
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
|
|
411
|
+
if (Math.abs(actor[property] - target) < 0.01)
|
|
412
|
+
actor[property] = target;
|
|
413
|
+
animating ||= actor[property] !== target;
|
|
414
|
+
}
|
|
415
|
+
const hoverTarget = !this.transitionActive && !this.pointer.pressed &&
|
|
416
|
+
((this.pointer.active && actor.hitTarget?.hasAttribute('data-mouse-hover')) ||
|
|
417
|
+
actor.hitTarget?.matches(':focus-visible')) ? 1 : 0;
|
|
418
|
+
actor.hover = this.motion.matches ? hoverTarget : THREE.MathUtils.damp(actor.hover, hoverTarget, 18, delta);
|
|
419
|
+
if (Math.abs(actor.hover - hoverTarget) < 0.01)
|
|
420
|
+
actor.hover = hoverTarget;
|
|
421
|
+
animating ||= actor.hover !== hoverTarget;
|
|
422
|
+
// Reuse the outline's settled hover state: inspecting a neighbour brings it
|
|
423
|
+
// into focus without changing selection or allocating another render target.
|
|
424
|
+
actor.blur = (pose.blur ?? 0) * (1 - actor.hover);
|
|
334
425
|
actor.band = pose.front ? 'front' : 'rear';
|
|
335
426
|
actor.root.visible &&= pose.visible;
|
|
336
427
|
applyCatalogMaterialOpacity(actor.materials, pose.opacity);
|
|
337
428
|
const compact = slot.width < 700;
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
|
|
429
|
+
// Every seat shares one scene origin. Depth now determines projected size
|
|
430
|
+
// and spacing naturally, including scroll parallax and the foreground advance.
|
|
431
|
+
const x = slot.left + dx + slot.width * (pose.orbit ? (compact ? 0.5 : 0.31) : pose.x - (compact ? 0 : 0.19));
|
|
432
|
+
const y = slot.top + dy + (pose.orbit ? (compact ? 180 : slot.height * 0.54) : slot.height * pose.y);
|
|
433
|
+
const perspective = pose.orbit ? 1 : 1 - pose.depth / 2500;
|
|
434
|
+
actor.root.matrix.makeTranslation((x - width / 2) * perspective + (pose.orbit?.x ?? 0), (height / 2 - y) * perspective + (pose.orbit?.y ?? 0), pose.depth);
|
|
343
435
|
actor.root.matrixWorldNeedsUpdate = true;
|
|
344
|
-
//
|
|
345
|
-
actor.tilt.scale.setScalar(perspective * (pose.size / 0.82));
|
|
346
|
-
actor.tilt.rotation.set(0, pose.yaw, 0);
|
|
436
|
+
// Geometry follows the seat and pointer; panel projection below excludes pointer tilt.
|
|
437
|
+
actor.tilt.scale.setScalar(pose.orbit ? 1 : perspective * (pose.size / 0.82));
|
|
438
|
+
actor.tilt.rotation.set((pose.orbit?.pitch ?? 0) + actor.rotationX, pose.yaw + actor.rotationY, 0);
|
|
347
439
|
actor.tilt.position.set(0, 0, 0);
|
|
348
|
-
|
|
440
|
+
// Keep compact models in the 360px visual area even as their parent shrinks.
|
|
441
|
+
// Scaling the old offset pulled side previews down into the summary panel.
|
|
442
|
+
actor.view.position.set(0, compact && !pose.orbit
|
|
443
|
+
? (slot.height - 360) * pose.y / (pose.size / 0.82)
|
|
444
|
+
: 0, 0);
|
|
349
445
|
actor.view.scale.setScalar((Math.min(slot.width, compact ? 360 : slot.height) * 0.82) / (actor.radius * 2));
|
|
446
|
+
let groundMatrix;
|
|
447
|
+
if (pose.orbit && actor.root.visible) {
|
|
448
|
+
const frame = Math.min(slot.width, compact ? 360 : slot.height);
|
|
449
|
+
const floor = frame * 0.32;
|
|
450
|
+
const pitch = pose.orbit.pitch;
|
|
451
|
+
// Stand every model on the same plane, including wide or short assets.
|
|
452
|
+
actor.tilt.updateMatrix();
|
|
453
|
+
actor.view.updateMatrix();
|
|
454
|
+
const upright = new THREE.Matrix4().makeRotationX(-pitch).multiply(actor.tilt.matrix);
|
|
455
|
+
const bottom = Math.min(...actor.supportPoints.map(point => point.clone().applyMatrix4(actor.view.matrix).applyMatrix4(upright).y));
|
|
456
|
+
actor.view.position.y += (-floor - bottom) / upright.elements[5];
|
|
457
|
+
actor.view.updateMatrix();
|
|
458
|
+
groundMatrix = new THREE.Matrix4().makeTranslation(x - width / 2, height / 2 - y, 0)
|
|
459
|
+
.multiply(new THREE.Matrix4().makeRotationX(pitch))
|
|
460
|
+
.multiply(new THREE.Matrix4().makeTranslation(0, -floor, 0));
|
|
461
|
+
}
|
|
462
|
+
// Apply after floor fitting so the model centre and UI anchors remain fixed.
|
|
463
|
+
actor.view.quaternion.setFromEuler(new THREE.Euler(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY'))
|
|
464
|
+
.multiply(actor.viewOrientation);
|
|
350
465
|
actor.root.updateMatrixWorld(true);
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
466
|
+
if (groundMatrix)
|
|
467
|
+
this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity);
|
|
468
|
+
if (pose.front && actor.root.visible && (!selected || pose.panelOpacity > (selected.pose?.read().panelOpacity ?? 0)))
|
|
469
|
+
selected = actor;
|
|
470
|
+
projectCarousels.push(() => {
|
|
471
|
+
const hitTarget = actor.hitTarget;
|
|
472
|
+
if (hitTarget) {
|
|
473
|
+
// Project cached model bounds, not the framing sphere: empty foreground
|
|
474
|
+
// margins must not intercept clicks on visible neighbouring spatialElements.
|
|
475
|
+
let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
|
|
476
|
+
const point = new THREE.Vector3();
|
|
477
|
+
for (const corner of actor.hitCorners) {
|
|
478
|
+
point.copy(corner).applyMatrix4(actor.view.matrixWorld).project(this.carouselCamera);
|
|
479
|
+
const px = ((point.x + 1) * width) / 2 - slot.left - dx;
|
|
480
|
+
const py = ((1 - point.y) * height) / 2 - slot.top - dy;
|
|
481
|
+
left = Math.min(left, px);
|
|
482
|
+
right = Math.max(right, px);
|
|
483
|
+
top = Math.min(top, py);
|
|
484
|
+
bottom = Math.max(bottom, py);
|
|
485
|
+
}
|
|
486
|
+
hitTarget.style.left = `${(left + right) / 2}px`;
|
|
487
|
+
hitTarget.style.top = `${(top + bottom) / 2}px`;
|
|
488
|
+
hitTarget.style.width = `${right - left}px`;
|
|
489
|
+
hitTarget.style.height = `${bottom - top}px`;
|
|
490
|
+
hitTarget.style.maxWidth = 'none';
|
|
491
|
+
actor.renderRect = { left: left + slot.left + dx, top: top + slot.top + dy,
|
|
492
|
+
width: right - left, height: bottom - top };
|
|
365
493
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
[
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
494
|
+
const panel = actor.summaryPanel;
|
|
495
|
+
if (panel && actor.summarySize) {
|
|
496
|
+
const { width: pw, height: ph } = actor.summarySize;
|
|
497
|
+
// The panel follows the seat and its yaw, but not the elevated
|
|
498
|
+
// product view. At rest it is parallel to the screen, also on mobile.
|
|
499
|
+
const panelFrame = pose.orbit
|
|
500
|
+
? actor.root.matrixWorld.clone().multiply(new THREE.Matrix4().makeRotationY(pose.yaw))
|
|
501
|
+
: actor.tilt.matrixWorld.clone();
|
|
502
|
+
const matrix = panelFrame
|
|
503
|
+
.multiply(new THREE.Matrix4().makeTranslation(compact ? 0 : slot.width * 0.39, compact ? (pose.orbit ? 180 : slot.height / 2) - 360 - ph / 2 : 0, 0));
|
|
504
|
+
const corners = [
|
|
505
|
+
[-pw / 2, ph / 2],
|
|
506
|
+
[pw / 2, ph / 2],
|
|
507
|
+
[pw / 2, -ph / 2],
|
|
508
|
+
[-pw / 2, -ph / 2]
|
|
509
|
+
].map(([x, y]) => {
|
|
510
|
+
const point = new THREE.Vector3(x, y, 0)
|
|
511
|
+
.applyMatrix4(matrix)
|
|
512
|
+
.project(this.carouselUiCamera);
|
|
513
|
+
return {
|
|
514
|
+
x: ((point.x + 1) * width) / 2 - slot.left - dx,
|
|
515
|
+
y: ((1 - point.y) * height) / 2 - slot.top - dy
|
|
516
|
+
};
|
|
517
|
+
});
|
|
518
|
+
// The semantic summary keeps its intrinsic layout slot before and after
|
|
519
|
+
// enhancement. Project relative to that slot instead of moving it to (0, 0).
|
|
520
|
+
const origin = actor.summaryOrigin ?? { x: 0, y: 0 };
|
|
521
|
+
const localCorners = corners.map(({ x, y }) => ({
|
|
522
|
+
x: x - origin.x, y: y - origin.y
|
|
523
|
+
}));
|
|
524
|
+
panel.style.transform = getProjectiveCssMatrix3d(localCorners, pw, ph) ?? '';
|
|
525
|
+
recordCarouselPanel(panel, corners.map((point) => ({
|
|
526
|
+
x: point.x + slot.left + dx,
|
|
527
|
+
y: point.y + slot.top + dy
|
|
528
|
+
})), pw, ph);
|
|
529
|
+
const hidden = actor.card.style.visibility === 'hidden' || panel.style.visibility === 'hidden';
|
|
530
|
+
this.glass.panel(actor.card, matrix, pw, ph, hidden ? 0 : pose.panelOpacity * this.exitOpacity, (1 - pose.panelOpacity) * 6);
|
|
531
|
+
}
|
|
532
|
+
actor.clip = {
|
|
533
|
+
left: 0,
|
|
534
|
+
top: 0,
|
|
535
|
+
width,
|
|
536
|
+
height
|
|
537
|
+
};
|
|
538
|
+
});
|
|
406
539
|
if (this.isDestinationActor(actor))
|
|
407
540
|
actor.root.visible = false;
|
|
408
541
|
continue;
|
|
@@ -421,16 +554,18 @@ export class CatalogSpatialElementLayer {
|
|
|
421
554
|
const targets = [
|
|
422
555
|
-THREE.MathUtils.radToDeg(rotation.x),
|
|
423
556
|
THREE.MathUtils.radToDeg(rotation.y),
|
|
424
|
-
-influence * 8
|
|
557
|
+
-influence * 8,
|
|
558
|
+
!this.motion.matches && !this.transitionActive &&
|
|
559
|
+
((this.pointer.active && distance === 0) || actor.card.matches?.(':focus-visible')) ? 1 : 0
|
|
425
560
|
];
|
|
426
|
-
const previous = [actor.rotationX, actor.rotationY, actor.lift];
|
|
561
|
+
const previous = [actor.rotationX, actor.rotationY, actor.lift, actor.hover];
|
|
427
562
|
const values = previous.map((value, index) => {
|
|
428
563
|
const next = this.motion.matches
|
|
429
564
|
? targets[index]
|
|
430
565
|
: THREE.MathUtils.damp(value, targets[index], 14, delta);
|
|
431
566
|
return Math.abs(next - targets[index]) < 0.01 ? targets[index] : next;
|
|
432
567
|
});
|
|
433
|
-
[actor.rotationX, actor.rotationY, actor.lift] = values;
|
|
568
|
+
[actor.rotationX, actor.rotationY, actor.lift, actor.hover] = values;
|
|
434
569
|
animating ||= values.some((value, index) => value !== targets[index]);
|
|
435
570
|
actor.card.style.setProperty('--catalog-rotate-x', `${actor.rotationX}deg`);
|
|
436
571
|
actor.card.style.setProperty('--catalog-rotate-y', `${actor.rotationY}deg`);
|
|
@@ -439,16 +574,46 @@ export class CatalogSpatialElementLayer {
|
|
|
439
574
|
actor.root.matrixWorldNeedsUpdate = true;
|
|
440
575
|
actor.tilt.rotation.set(-THREE.MathUtils.degToRad(actor.rotationX), THREE.MathUtils.degToRad(actor.rotationY), 0);
|
|
441
576
|
actor.tilt.position.y = -actor.lift;
|
|
442
|
-
actor.view.position.set(slot.left + slot.width / 2 - card.left - card.width / 2, card.top + card.height / 2 - slot.top - slot.height / 2,
|
|
443
|
-
actor.view.scale.setScalar(
|
|
577
|
+
actor.view.position.set(slot.left + slot.width / 2 - card.left - card.width / 2, card.top + card.height / 2 - slot.top - slot.height / 2, 96 * actor.hover);
|
|
578
|
+
actor.view.scale.setScalar(actor.cardScale * (1 + 0.12 * actor.hover));
|
|
579
|
+
const deviceEnabled = !this.motion.matches && !this.transitionActive &&
|
|
580
|
+
actor.card.closest('[data-device-orientation]');
|
|
581
|
+
// Sensor motion remains available on hybrids even with a stationary mouse cursor.
|
|
582
|
+
for (const [property, target] of [
|
|
583
|
+
['deviceYaw', deviceEnabled ? -getListDeviceYaw() : 0],
|
|
584
|
+
['devicePitch', deviceEnabled ? -getListDevicePitch() : 0],
|
|
585
|
+
['deviceRoll', deviceEnabled ? -getListDeviceRoll() : 0]
|
|
586
|
+
]) {
|
|
587
|
+
if (!this.motion.matches && isDeviceOrientationPaused())
|
|
588
|
+
continue;
|
|
589
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
|
|
590
|
+
if (Math.abs(actor[property] - target) < 0.01)
|
|
591
|
+
actor[property] = target;
|
|
592
|
+
animating ||= actor[property] !== target;
|
|
593
|
+
}
|
|
594
|
+
// Rotate around the model's own centre, leaving the panel and copy still.
|
|
595
|
+
actor.view.rotation.set(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY');
|
|
596
|
+
actor.view.quaternion.multiply(actor.viewOrientation);
|
|
444
597
|
if (this.isDestinationActor(actor))
|
|
445
598
|
actor.root.visible = false;
|
|
446
599
|
}
|
|
600
|
+
if (!this.transitionActive && !this.handoff) {
|
|
601
|
+
const pivot = selected?.view.getWorldPosition(new THREE.Vector3()) ?? new THREE.Vector3();
|
|
602
|
+
const enabled = selected?.card?.closest('[data-device-orientation]');
|
|
603
|
+
if (this.motion.matches || !isDeviceOrientationPaused())
|
|
604
|
+
animating = this.carouselDeviceCamera.update(this.carouselCamera, enabled ? getListDeviceYaw() : 0, enabled ? getListDevicePitch() : 0, enabled ? getListDeviceRoll() : 0, delta, this.motion.matches) || animating;
|
|
605
|
+
animating = this.carouselDeviceCamera.orbit(this.carouselCamera, pivot, delta, !this.motion.matches && (this.pointer.pressed || this.carouselSelection !== selected)) || animating;
|
|
606
|
+
this.carouselSelection = selected;
|
|
607
|
+
}
|
|
608
|
+
for (const project of projectCarousels)
|
|
609
|
+
project();
|
|
447
610
|
if (this.queueDirty) {
|
|
448
611
|
this.queueDirty = false;
|
|
449
612
|
void this.loadVisibleSpatialElements(this.generation);
|
|
450
613
|
}
|
|
451
614
|
this.glass.endFrame();
|
|
615
|
+
if (!this.handoff)
|
|
616
|
+
this.ground.endFrame();
|
|
452
617
|
return animating;
|
|
453
618
|
}
|
|
454
619
|
draw(renderer, band) {
|
|
@@ -489,12 +654,25 @@ export class CatalogSpatialElementLayer {
|
|
|
489
654
|
continue;
|
|
490
655
|
renderer.setScissor(left, top, right - left, bottom - top);
|
|
491
656
|
renderer.setScissorTest(true);
|
|
492
|
-
for (const actor of group)
|
|
493
|
-
actor.root.visible = true;
|
|
494
657
|
const fog = this.scene.fog;
|
|
495
|
-
this.scene.fog =
|
|
658
|
+
this.scene.fog = null;
|
|
496
659
|
try {
|
|
497
|
-
|
|
660
|
+
if (group.some((actor) => ((actor.blur ?? 0) >= 0.05 || actor.hover > 0) && actor.renderRect)) {
|
|
661
|
+
// Resolve far-to-near into the same output; scratch buffers are shared by every seat.
|
|
662
|
+
group.sort((a, b) => a.root.matrix.elements[14] - b.root.matrix.elements[14]);
|
|
663
|
+
for (const actor of group) {
|
|
664
|
+
actor.root.visible = true;
|
|
665
|
+
this.depthBlur.render(renderer, this.carouselCamera, actor.renderRect ?? rect, actor.blur ?? 0, (camera) => renderer.render(this.scene, camera), rect);
|
|
666
|
+
if (actor.hover > 0 && actor.renderRect)
|
|
667
|
+
this.outline.render(renderer, this.carouselCamera, actor.model, actor.renderRect, rect, actor.hover * (actor.materials[0]?.material.opacity ?? 1), this.interactionTheme());
|
|
668
|
+
actor.root.visible = false;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
for (const actor of group)
|
|
673
|
+
actor.root.visible = true;
|
|
674
|
+
renderer.render(this.scene, this.carouselCamera);
|
|
675
|
+
}
|
|
498
676
|
}
|
|
499
677
|
finally {
|
|
500
678
|
this.scene.fog = fog;
|
|
@@ -524,7 +702,10 @@ export class CatalogSpatialElementLayer {
|
|
|
524
702
|
return [...this.actors.values()].some((actor) => Boolean(actor.pose));
|
|
525
703
|
}
|
|
526
704
|
renderRear(renderer) {
|
|
527
|
-
this.glass.render(renderer, this.
|
|
705
|
+
this.glass.render(renderer, this.carouselUiCamera, () => {
|
|
706
|
+
this.ground.draw(renderer, this.carouselCamera, this.exitOpacity);
|
|
707
|
+
this.draw(renderer, 'rear');
|
|
708
|
+
});
|
|
528
709
|
}
|
|
529
710
|
/** Warm the existing Low material passes in an offscreen preparation target. */
|
|
530
711
|
renderForPreparation(renderer) {
|
|
@@ -548,7 +729,7 @@ export class CatalogSpatialElementLayer {
|
|
|
548
729
|
this.handoffPoint = undefined;
|
|
549
730
|
actor.model.updateWorldMatrix(true, true);
|
|
550
731
|
const camera = actor.pose ? this.carouselCamera : this.camera;
|
|
551
|
-
this.handoffScene.fog = actor.pose ?
|
|
732
|
+
this.handoffScene.fog = actor.pose ? null : this.scene.fog;
|
|
552
733
|
camera.updateMatrixWorld();
|
|
553
734
|
const sourceModel = actor.model.matrixWorld.clone();
|
|
554
735
|
const sourceClip = normalizeSpatialElementClipMatrix(new THREE.Matrix4()
|
|
@@ -594,17 +775,19 @@ export class CatalogSpatialElementLayer {
|
|
|
594
775
|
if (!actor?.slot?.isConnected)
|
|
595
776
|
return;
|
|
596
777
|
const rect = actor.slot.getBoundingClientRect();
|
|
778
|
+
const visibleRect = actor.pose && actor.renderRect ? actor.renderRect : rect;
|
|
597
779
|
if (rect.width <= 0 ||
|
|
598
780
|
rect.height <= 0 ||
|
|
599
781
|
(actor.pose
|
|
600
|
-
?
|
|
782
|
+
? visibleRect.left + visibleRect.width <= 0 || visibleRect.top + visibleRect.height <= 0 ||
|
|
783
|
+
visibleRect.left >= innerWidth || visibleRect.top >= innerHeight
|
|
601
784
|
: rect.left < 0 || rect.top < 0 || rect.right > innerWidth || rect.bottom > innerHeight))
|
|
602
785
|
return;
|
|
603
786
|
actor.model.updateWorldMatrix(true, true);
|
|
604
787
|
const camera = actor.pose ? this.carouselCamera : this.camera;
|
|
605
788
|
return {
|
|
606
789
|
environmentIntensity: this.scene.environmentIntensity,
|
|
607
|
-
fog: actor.pose ?
|
|
790
|
+
fog: actor.pose ? null : this.scene.fog,
|
|
608
791
|
viewportClip: actor.clip ? { ...actor.clip } : undefined,
|
|
609
792
|
model: actor.model.matrixWorld.clone(),
|
|
610
793
|
camera: camera.matrixWorld.clone(),
|
|
@@ -631,7 +814,7 @@ export class CatalogSpatialElementLayer {
|
|
|
631
814
|
: this.camera;
|
|
632
815
|
camera.updateMatrixWorld();
|
|
633
816
|
const projection = {
|
|
634
|
-
fog: actor.pose ?
|
|
817
|
+
fog: actor.pose ? null : this.scene.fog,
|
|
635
818
|
viewportClip: actor.clip ? { ...actor.clip } : undefined,
|
|
636
819
|
model: model.matrixWorld.clone(),
|
|
637
820
|
camera: camera.matrixWorld.clone(),
|
|
@@ -706,11 +889,15 @@ export class CatalogSpatialElementLayer {
|
|
|
706
889
|
applyCatalogMaterialOpacity(this.handoff.actor.materials, opacity);
|
|
707
890
|
}
|
|
708
891
|
dispose() {
|
|
892
|
+
this.ground.dispose();
|
|
709
893
|
this.glass.dispose();
|
|
894
|
+
this.depthBlur.dispose();
|
|
710
895
|
this.geometryFade.dispose();
|
|
896
|
+
this.outline.dispose();
|
|
711
897
|
if (this.disposed)
|
|
712
898
|
return;
|
|
713
899
|
this.disposed = true;
|
|
900
|
+
this.unsubscribeDeviceYaw();
|
|
714
901
|
this.generation += 1;
|
|
715
902
|
for (const request of this.requests)
|
|
716
903
|
request.abort();
|
|
@@ -720,6 +907,10 @@ export class CatalogSpatialElementLayer {
|
|
|
720
907
|
this.disposeActor(actor);
|
|
721
908
|
window.removeEventListener('pointermove', this.pointerMove);
|
|
722
909
|
window.removeEventListener('pointerdown', this.pointerDown, true);
|
|
910
|
+
window.removeEventListener('pointerup', this.pointerUp);
|
|
911
|
+
window.removeEventListener('pointercancel', this.pointerUp);
|
|
912
|
+
window.removeEventListener('focusin', this.motionChange);
|
|
913
|
+
window.removeEventListener('focusout', this.motionChange);
|
|
723
914
|
window.removeEventListener('pointerleave', this.pointerLeave);
|
|
724
915
|
window.removeEventListener('blur', this.pointerLeave);
|
|
725
916
|
window.removeEventListener('resize', this.resize);
|
|
@@ -772,11 +963,13 @@ export class CatalogSpatialElementLayer {
|
|
|
772
963
|
const tilt = new THREE.Group();
|
|
773
964
|
const view = new THREE.Group();
|
|
774
965
|
view.quaternion.copy(getCameraOrbitQuaternion(stage.camera?.azimuth, stage.camera?.elevation).invert());
|
|
966
|
+
const supportPoints = carouselSupport(model, view.quaternion);
|
|
775
967
|
root.add(tilt);
|
|
776
968
|
tilt.add(view);
|
|
777
969
|
view.add(model);
|
|
778
970
|
const materials = captureCatalogMaterialOpacity(model);
|
|
779
971
|
applyCatalogMaterialOpacity(materials, 1);
|
|
972
|
+
const hitCorners = [bounds.min.x, bounds.max.x].flatMap((x) => [bounds.min.y, bounds.max.y].flatMap((y) => [bounds.min.z, bounds.max.z].map((z) => new THREE.Vector3(x, y, z))));
|
|
780
973
|
return {
|
|
781
974
|
key,
|
|
782
975
|
brandId,
|
|
@@ -787,8 +980,13 @@ export class CatalogSpatialElementLayer {
|
|
|
787
980
|
root,
|
|
788
981
|
tilt,
|
|
789
982
|
view,
|
|
983
|
+
viewOrientation: view.quaternion.clone(),
|
|
790
984
|
radius,
|
|
791
|
-
hitCorners
|
|
985
|
+
hitCorners,
|
|
986
|
+
fitCorners: hitCorners.map((corner) => corner.clone().applyQuaternion(view.quaternion)),
|
|
987
|
+
supportPoints,
|
|
988
|
+
cardScale: 1,
|
|
989
|
+
hover: 0,
|
|
792
990
|
referencePoint,
|
|
793
991
|
overrides,
|
|
794
992
|
materials,
|
|
@@ -796,6 +994,9 @@ export class CatalogSpatialElementLayer {
|
|
|
796
994
|
scrollY: 0,
|
|
797
995
|
rotationX: 0,
|
|
798
996
|
rotationY: 0,
|
|
997
|
+
deviceYaw: 0,
|
|
998
|
+
devicePitch: 0,
|
|
999
|
+
deviceRoll: 0,
|
|
799
1000
|
lift: 0,
|
|
800
1001
|
rendered: false
|
|
801
1002
|
};
|
|
@@ -820,6 +1021,8 @@ export class CatalogSpatialElementLayer {
|
|
|
820
1021
|
for (const { actor } of measured) {
|
|
821
1022
|
actor.cardRect = actor.card.getBoundingClientRect();
|
|
822
1023
|
actor.slotRect = actor.slot.getBoundingClientRect();
|
|
1024
|
+
if (!actor.pose)
|
|
1025
|
+
actor.cardScale = cardModelFit(actor.fitCorners, actor.slotRect.width, actor.slotRect.height);
|
|
823
1026
|
if (actor.pose) {
|
|
824
1027
|
actor.hitTarget = actor.card.querySelector('.spatial-element-target') ?? undefined;
|
|
825
1028
|
const panel = actor.card.querySelector('.summary') ?? undefined;
|
|
@@ -827,6 +1030,7 @@ export class CatalogSpatialElementLayer {
|
|
|
827
1030
|
this.layoutObserver.unobserve(actor.summaryPanel);
|
|
828
1031
|
actor.summaryPanel = panel;
|
|
829
1032
|
actor.summarySize = panel ? { width: panel.offsetWidth, height: panel.offsetHeight } : undefined;
|
|
1033
|
+
actor.summaryOrigin = panel ? { x: panel.offsetLeft ?? 0, y: panel.offsetTop ?? 0 } : undefined;
|
|
830
1034
|
// Summary content can resize without changing its section's fixed height.
|
|
831
1035
|
if (panel)
|
|
832
1036
|
this.layoutObserver.observe(panel);
|
|
@@ -915,6 +1119,7 @@ export class CatalogSpatialElementLayer {
|
|
|
915
1119
|
};
|
|
916
1120
|
}
|
|
917
1121
|
disposeActor(actor) {
|
|
1122
|
+
this.outline.release(actor.model);
|
|
918
1123
|
if (actor.summaryPanel)
|
|
919
1124
|
this.layoutObserver.unobserve(actor.summaryPanel);
|
|
920
1125
|
actor.root.removeFromParent();
|