@neurodyn/react-room-viewer 0.0.8 → 0.0.9
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/index.js +52 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9405,7 +9405,18 @@ function useRoomViewerTenant() {
|
|
|
9405
9405
|
const language = i18n.resolvedLanguage ?? i18n.language;
|
|
9406
9406
|
return 'ru' === language ? 'arizo' : 'vizbl';
|
|
9407
9407
|
}
|
|
9408
|
-
function
|
|
9408
|
+
function isAbsoluteUrl(value) {
|
|
9409
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(value) || value.startsWith('//');
|
|
9410
|
+
}
|
|
9411
|
+
function resolveTextureSrc(src, pageUrl) {
|
|
9412
|
+
if (!pageUrl || isAbsoluteUrl(src)) return src;
|
|
9413
|
+
try {
|
|
9414
|
+
return new URL(src, pageUrl).href;
|
|
9415
|
+
} catch {
|
|
9416
|
+
return src;
|
|
9417
|
+
}
|
|
9418
|
+
}
|
|
9419
|
+
function buildRoomViewerArUrl({ height, language, name, src, tenantConfig, tinuuid, placement, type, width, widgetSessionToken, pageUrl }) {
|
|
9409
9420
|
if ('floor' === placement && tinuuid) {
|
|
9410
9421
|
const url = new URL(tenantConfig.ROOM_URL);
|
|
9411
9422
|
url.searchParams.set('type', type);
|
|
@@ -9416,7 +9427,7 @@ function buildRoomViewerArUrl({ height, language, name, src, tenantConfig, tinuu
|
|
|
9416
9427
|
return url.toString();
|
|
9417
9428
|
}
|
|
9418
9429
|
const url = new URL(tenantConfig.POSTER_URL);
|
|
9419
|
-
if (src) url.searchParams.set('texture', src);
|
|
9430
|
+
if (src) url.searchParams.set('texture', resolveTextureSrc(src, pageUrl));
|
|
9420
9431
|
url.searchParams.set('texture_width', (100 * width).toString());
|
|
9421
9432
|
url.searchParams.set('texture_height', (100 * height).toString());
|
|
9422
9433
|
if (widgetSessionToken) url.searchParams.set('widgetSessionToken', widgetSessionToken);
|
|
@@ -9447,7 +9458,8 @@ function AR({ className, buttonClassName, buttonLeadingIcon, buttonLabel, button
|
|
|
9447
9458
|
placement,
|
|
9448
9459
|
type,
|
|
9449
9460
|
width,
|
|
9450
|
-
widgetSessionToken: handoffWidgetSessionToken
|
|
9461
|
+
widgetSessionToken: handoffWidgetSessionToken,
|
|
9462
|
+
pageUrl: "u" < typeof window ? void 0 : window.location.href
|
|
9451
9463
|
}), [
|
|
9452
9464
|
src,
|
|
9453
9465
|
tinuuid,
|
|
@@ -10131,21 +10143,27 @@ function patchShader(shader, patch) {
|
|
|
10131
10143
|
return 1.0 - step(0.5, abs(id - uActiveId));
|
|
10132
10144
|
}
|
|
10133
10145
|
|
|
10146
|
+
// uPlaneIds is a low-res nearest-filtered id map, so its edges are blocky.
|
|
10147
|
+
// A single-texel tent filter isn't wide enough to hide that — it just
|
|
10148
|
+
// softens each block's corner, which reads as a staircase. Supersample
|
|
10149
|
+
// a wider neighbourhood (5x5 taps, 2-texel radius) with Gaussian-like
|
|
10150
|
+
// falloff so the boundary is both denser-sampled and properly blurred.
|
|
10134
10151
|
float neurodynRoomScenePlaneCoverage(vec2 uv) {
|
|
10135
10152
|
vec2 texel = 1.0 / uPlaneIdsSize;
|
|
10136
|
-
float coverage =
|
|
10153
|
+
float coverage = 0.0;
|
|
10154
|
+
float totalWeight = 0.0;
|
|
10137
10155
|
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10156
|
+
for (int y = -2; y <= 2; y++) {
|
|
10157
|
+
for (int x = -2; x <= 2; x++) {
|
|
10158
|
+
vec2 offset = vec2(float(x), float(y));
|
|
10159
|
+
float weight = 1.0 / (1.0 + dot(offset, offset));
|
|
10142
10160
|
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10161
|
+
coverage += neurodynRoomScenePlaneMatch(uv + offset * texel) * weight;
|
|
10162
|
+
totalWeight += weight;
|
|
10163
|
+
}
|
|
10164
|
+
}
|
|
10147
10165
|
|
|
10148
|
-
return coverage /
|
|
10166
|
+
return coverage / totalWeight;
|
|
10149
10167
|
}
|
|
10150
10168
|
#endif
|
|
10151
10169
|
`);
|
|
@@ -10247,6 +10265,7 @@ function RugRotationControl({ resourceBounds }) {
|
|
|
10247
10265
|
const resource = resourceRef.current;
|
|
10248
10266
|
if (!resource || !isRugRotationControlPrimaryHit(event.object, event.intersections.map((intersection)=>intersection.object))) return;
|
|
10249
10267
|
event.stopPropagation();
|
|
10268
|
+
event.nativeEvent.stopPropagation();
|
|
10250
10269
|
const pointerTarget = event.target;
|
|
10251
10270
|
pointerTarget.setPointerCapture(event.pointerId);
|
|
10252
10271
|
resource.updateWorldMatrix(true, false);
|
|
@@ -10309,6 +10328,10 @@ function RugRotationControl({ resourceBounds }) {
|
|
|
10309
10328
|
});
|
|
10310
10329
|
}
|
|
10311
10330
|
const FLOOR_RESOURCE_ROTATION_X = Math.PI / 2;
|
|
10331
|
+
function releaseDragCapture(event) {
|
|
10332
|
+
const pointerTarget = event.target;
|
|
10333
|
+
if (pointerTarget.hasPointerCapture(event.pointerId)) pointerTarget.releasePointerCapture(event.pointerId);
|
|
10334
|
+
}
|
|
10312
10335
|
function FloorResource({ glbUrl, position, quaternion, materialPatch }) {
|
|
10313
10336
|
const { type } = useRoomViewerMetadata();
|
|
10314
10337
|
const { resourceRef, rotation, setIsDragging } = useRoomViewerSceneState();
|
|
@@ -10341,9 +10364,19 @@ function FloorResource({ glbUrl, position, quaternion, materialPatch }) {
|
|
|
10341
10364
|
ref: resourceRef,
|
|
10342
10365
|
position: position,
|
|
10343
10366
|
quaternion: quaternion,
|
|
10344
|
-
onPointerDown: ()=>
|
|
10345
|
-
|
|
10346
|
-
|
|
10367
|
+
onPointerDown: (event)=>{
|
|
10368
|
+
event.nativeEvent.stopPropagation();
|
|
10369
|
+
event.target.setPointerCapture(event.pointerId);
|
|
10370
|
+
setIsDragging(true);
|
|
10371
|
+
},
|
|
10372
|
+
onPointerUp: (event)=>{
|
|
10373
|
+
releaseDragCapture(event);
|
|
10374
|
+
setIsDragging(false);
|
|
10375
|
+
},
|
|
10376
|
+
onPointerCancel: (event)=>{
|
|
10377
|
+
releaseDragCapture(event);
|
|
10378
|
+
setIsDragging(false);
|
|
10379
|
+
},
|
|
10347
10380
|
children: /*#__PURE__*/ jsxs("group", {
|
|
10348
10381
|
"rotation-z": rotationRadians,
|
|
10349
10382
|
children: [
|
|
@@ -10966,7 +10999,7 @@ function CanvasWrapper({ className, ref, captureRef, onSizeChange, ...props }) {
|
|
|
10966
10999
|
className: utils_cn('size-full flex items-center justify-center sm:pt-21 sm:pb-12', className),
|
|
10967
11000
|
...props,
|
|
10968
11001
|
children: size && /*#__PURE__*/ jsx_runtime_jsx(Canvas, {
|
|
10969
|
-
className: "bg-transparent",
|
|
11002
|
+
className: "touch-none bg-transparent",
|
|
10970
11003
|
frameloop: "demand",
|
|
10971
11004
|
camera: ROOM_CAMERA_CONFIG,
|
|
10972
11005
|
gl: {
|
|
@@ -14375,6 +14408,7 @@ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, di
|
|
|
14375
14408
|
themeRoot && /*#__PURE__*/ jsx_runtime_jsx(ThemeProvider, {
|
|
14376
14409
|
root: themeRoot,
|
|
14377
14410
|
storageKey: "neurodyn-theme",
|
|
14411
|
+
defaultTheme: "light",
|
|
14378
14412
|
children: /*#__PURE__*/ jsx_runtime_jsx(I18nextProvider, {
|
|
14379
14413
|
i18n: roomViewerI18n,
|
|
14380
14414
|
children: 'floor' === placement ? shouldRenderRoomViewerRoot && roomViewerRoot : /*#__PURE__*/ jsx_runtime_jsx(Dialog, {
|
|
@@ -14439,6 +14473,7 @@ function RoomViewer({ type, src, tinuuid, name, language, width, height, dimensi
|
|
|
14439
14473
|
children: themeRoot && /*#__PURE__*/ jsx_runtime_jsx(ThemeProvider, {
|
|
14440
14474
|
root: themeRoot,
|
|
14441
14475
|
storageKey: "neurodyn-theme",
|
|
14476
|
+
defaultTheme: "light",
|
|
14442
14477
|
children: /*#__PURE__*/ jsx_runtime_jsx(I18nextProvider, {
|
|
14443
14478
|
i18n: roomViewerI18n,
|
|
14444
14479
|
children: /*#__PURE__*/ jsx_runtime_jsx(RoomViewerRoot, {
|