@neurodyn/react-room-viewer 0.0.8 → 0.0.10
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 +62 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2245,10 +2245,6 @@ var __webpack_modules__ = {
|
|
|
2245
2245
|
background-color: var(--v-button-dark);
|
|
2246
2246
|
}
|
|
2247
2247
|
|
|
2248
|
-
.bg-button-light {
|
|
2249
|
-
background-color: var(--v-button-light);
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
2248
|
.bg-button-white {
|
|
2253
2249
|
background-color: var(--v-button-white);
|
|
2254
2250
|
}
|
|
@@ -3741,14 +3737,6 @@ var __webpack_modules__ = {
|
|
|
3741
3737
|
background-color: var(--v-borders-dark);
|
|
3742
3738
|
}
|
|
3743
3739
|
|
|
3744
|
-
.hover\\:bg-button-dark-hover:hover {
|
|
3745
|
-
background-color: var(--v-button-dark-hover);
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3748
|
-
.hover\\:bg-button-light-hover:hover {
|
|
3749
|
-
background-color: var(--v-button-light-hover);
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
3740
|
.hover\\:bg-button-white:hover {
|
|
3753
3741
|
background-color: var(--v-button-white);
|
|
3754
3742
|
}
|
|
@@ -3985,14 +3973,6 @@ var __webpack_modules__ = {
|
|
|
3985
3973
|
background-color: var(--v-backgrounds-base-3);
|
|
3986
3974
|
}
|
|
3987
3975
|
|
|
3988
|
-
.active\\:bg-button-dark-pressed:active {
|
|
3989
|
-
background-color: var(--v-button-dark-pressed);
|
|
3990
|
-
}
|
|
3991
|
-
|
|
3992
|
-
.active\\:bg-button-light-pressed:active {
|
|
3993
|
-
background-color: var(--v-button-light-pressed);
|
|
3994
|
-
}
|
|
3995
|
-
|
|
3996
3976
|
.active\\:bg-button-outline-pressed:active {
|
|
3997
3977
|
background-color: var(--v-button-outline-pressed);
|
|
3998
3978
|
}
|
|
@@ -9405,7 +9385,18 @@ function useRoomViewerTenant() {
|
|
|
9405
9385
|
const language = i18n.resolvedLanguage ?? i18n.language;
|
|
9406
9386
|
return 'ru' === language ? 'arizo' : 'vizbl';
|
|
9407
9387
|
}
|
|
9408
|
-
function
|
|
9388
|
+
function isAbsoluteUrl(value) {
|
|
9389
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(value) || value.startsWith('//');
|
|
9390
|
+
}
|
|
9391
|
+
function resolveTextureSrc(src, pageUrl) {
|
|
9392
|
+
if (!pageUrl || isAbsoluteUrl(src)) return src;
|
|
9393
|
+
try {
|
|
9394
|
+
return new URL(src, pageUrl).href;
|
|
9395
|
+
} catch {
|
|
9396
|
+
return src;
|
|
9397
|
+
}
|
|
9398
|
+
}
|
|
9399
|
+
function buildRoomViewerArUrl({ height, language, name, src, tenantConfig, tinuuid, placement, type, width, widgetSessionToken, pageUrl }) {
|
|
9409
9400
|
if ('floor' === placement && tinuuid) {
|
|
9410
9401
|
const url = new URL(tenantConfig.ROOM_URL);
|
|
9411
9402
|
url.searchParams.set('type', type);
|
|
@@ -9416,7 +9407,7 @@ function buildRoomViewerArUrl({ height, language, name, src, tenantConfig, tinuu
|
|
|
9416
9407
|
return url.toString();
|
|
9417
9408
|
}
|
|
9418
9409
|
const url = new URL(tenantConfig.POSTER_URL);
|
|
9419
|
-
if (src) url.searchParams.set('texture', src);
|
|
9410
|
+
if (src) url.searchParams.set('texture', resolveTextureSrc(src, pageUrl));
|
|
9420
9411
|
url.searchParams.set('texture_width', (100 * width).toString());
|
|
9421
9412
|
url.searchParams.set('texture_height', (100 * height).toString());
|
|
9422
9413
|
if (widgetSessionToken) url.searchParams.set('widgetSessionToken', widgetSessionToken);
|
|
@@ -9447,7 +9438,8 @@ function AR({ className, buttonClassName, buttonLeadingIcon, buttonLabel, button
|
|
|
9447
9438
|
placement,
|
|
9448
9439
|
type,
|
|
9449
9440
|
width,
|
|
9450
|
-
widgetSessionToken: handoffWidgetSessionToken
|
|
9441
|
+
widgetSessionToken: handoffWidgetSessionToken,
|
|
9442
|
+
pageUrl: "u" < typeof window ? void 0 : window.location.href
|
|
9451
9443
|
}), [
|
|
9452
9444
|
src,
|
|
9453
9445
|
tinuuid,
|
|
@@ -10131,21 +10123,27 @@ function patchShader(shader, patch) {
|
|
|
10131
10123
|
return 1.0 - step(0.5, abs(id - uActiveId));
|
|
10132
10124
|
}
|
|
10133
10125
|
|
|
10126
|
+
// uPlaneIds is a low-res nearest-filtered id map, so its edges are blocky.
|
|
10127
|
+
// A single-texel tent filter isn't wide enough to hide that — it just
|
|
10128
|
+
// softens each block's corner, which reads as a staircase. Supersample
|
|
10129
|
+
// a wider neighbourhood (5x5 taps, 2-texel radius) with Gaussian-like
|
|
10130
|
+
// falloff so the boundary is both denser-sampled and properly blurred.
|
|
10134
10131
|
float neurodynRoomScenePlaneCoverage(vec2 uv) {
|
|
10135
10132
|
vec2 texel = 1.0 / uPlaneIdsSize;
|
|
10136
|
-
float coverage =
|
|
10133
|
+
float coverage = 0.0;
|
|
10134
|
+
float totalWeight = 0.0;
|
|
10137
10135
|
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10136
|
+
for (int y = -2; y <= 2; y++) {
|
|
10137
|
+
for (int x = -2; x <= 2; x++) {
|
|
10138
|
+
vec2 offset = vec2(float(x), float(y));
|
|
10139
|
+
float weight = 1.0 / (1.0 + dot(offset, offset));
|
|
10142
10140
|
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10141
|
+
coverage += neurodynRoomScenePlaneMatch(uv + offset * texel) * weight;
|
|
10142
|
+
totalWeight += weight;
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
10147
10145
|
|
|
10148
|
-
return coverage /
|
|
10146
|
+
return coverage / totalWeight;
|
|
10149
10147
|
}
|
|
10150
10148
|
#endif
|
|
10151
10149
|
`);
|
|
@@ -10247,6 +10245,7 @@ function RugRotationControl({ resourceBounds }) {
|
|
|
10247
10245
|
const resource = resourceRef.current;
|
|
10248
10246
|
if (!resource || !isRugRotationControlPrimaryHit(event.object, event.intersections.map((intersection)=>intersection.object))) return;
|
|
10249
10247
|
event.stopPropagation();
|
|
10248
|
+
event.nativeEvent.stopPropagation();
|
|
10250
10249
|
const pointerTarget = event.target;
|
|
10251
10250
|
pointerTarget.setPointerCapture(event.pointerId);
|
|
10252
10251
|
resource.updateWorldMatrix(true, false);
|
|
@@ -10309,6 +10308,10 @@ function RugRotationControl({ resourceBounds }) {
|
|
|
10309
10308
|
});
|
|
10310
10309
|
}
|
|
10311
10310
|
const FLOOR_RESOURCE_ROTATION_X = Math.PI / 2;
|
|
10311
|
+
function releaseDragCapture(event) {
|
|
10312
|
+
const pointerTarget = event.target;
|
|
10313
|
+
if (pointerTarget.hasPointerCapture(event.pointerId)) pointerTarget.releasePointerCapture(event.pointerId);
|
|
10314
|
+
}
|
|
10312
10315
|
function FloorResource({ glbUrl, position, quaternion, materialPatch }) {
|
|
10313
10316
|
const { type } = useRoomViewerMetadata();
|
|
10314
10317
|
const { resourceRef, rotation, setIsDragging } = useRoomViewerSceneState();
|
|
@@ -10341,9 +10344,19 @@ function FloorResource({ glbUrl, position, quaternion, materialPatch }) {
|
|
|
10341
10344
|
ref: resourceRef,
|
|
10342
10345
|
position: position,
|
|
10343
10346
|
quaternion: quaternion,
|
|
10344
|
-
onPointerDown: ()=>
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
+
onPointerDown: (event)=>{
|
|
10348
|
+
event.nativeEvent.stopPropagation();
|
|
10349
|
+
event.target.setPointerCapture(event.pointerId);
|
|
10350
|
+
setIsDragging(true);
|
|
10351
|
+
},
|
|
10352
|
+
onPointerUp: (event)=>{
|
|
10353
|
+
releaseDragCapture(event);
|
|
10354
|
+
setIsDragging(false);
|
|
10355
|
+
},
|
|
10356
|
+
onPointerCancel: (event)=>{
|
|
10357
|
+
releaseDragCapture(event);
|
|
10358
|
+
setIsDragging(false);
|
|
10359
|
+
},
|
|
10347
10360
|
children: /*#__PURE__*/ jsxs("group", {
|
|
10348
10361
|
"rotation-z": rotationRadians,
|
|
10349
10362
|
children: [
|
|
@@ -10966,7 +10979,7 @@ function CanvasWrapper({ className, ref, captureRef, onSizeChange, ...props }) {
|
|
|
10966
10979
|
className: utils_cn('size-full flex items-center justify-center sm:pt-21 sm:pb-12', className),
|
|
10967
10980
|
...props,
|
|
10968
10981
|
children: size && /*#__PURE__*/ jsx_runtime_jsx(Canvas, {
|
|
10969
|
-
className: "bg-transparent",
|
|
10982
|
+
className: "touch-none bg-transparent",
|
|
10970
10983
|
frameloop: "demand",
|
|
10971
10984
|
camera: ROOM_CAMERA_CONFIG,
|
|
10972
10985
|
gl: {
|
|
@@ -11577,7 +11590,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11577
11590
|
children: [
|
|
11578
11591
|
/*#__PURE__*/ jsxs(Button, {
|
|
11579
11592
|
type: "button",
|
|
11580
|
-
variant: "
|
|
11593
|
+
variant: "secondary",
|
|
11581
11594
|
"aria-label": t('floor.scene.share'),
|
|
11582
11595
|
disabled: !canShare || isSharing,
|
|
11583
11596
|
onClick: handleShare,
|
|
@@ -11594,7 +11607,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11594
11607
|
}),
|
|
11595
11608
|
/*#__PURE__*/ jsxs(Button, {
|
|
11596
11609
|
type: "button",
|
|
11597
|
-
variant: "
|
|
11610
|
+
variant: "secondary",
|
|
11598
11611
|
"aria-label": t('floor.scene.download'),
|
|
11599
11612
|
disabled: isDownloading,
|
|
11600
11613
|
onClick: handleDownload,
|
|
@@ -11613,7 +11626,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11613
11626
|
asChild: true,
|
|
11614
11627
|
children: /*#__PURE__*/ jsxs(Button, {
|
|
11615
11628
|
type: "button",
|
|
11616
|
-
variant: "
|
|
11629
|
+
variant: "secondary",
|
|
11617
11630
|
"aria-label": t('close'),
|
|
11618
11631
|
className: "size-10 rounded-full px-0 lg:h-9 lg:w-auto lg:rounded-xl lg:px-3.5",
|
|
11619
11632
|
children: [
|
|
@@ -11690,7 +11703,7 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11690
11703
|
]
|
|
11691
11704
|
}),
|
|
11692
11705
|
canShowAr && /*#__PURE__*/ jsxs("div", {
|
|
11693
|
-
className: "pointer-events-auto flex h-24 w-[280px] items-center gap-4 overflow-hidden rounded-2xl bg-
|
|
11706
|
+
className: "pointer-events-auto flex h-24 w-[280px] items-center gap-4 overflow-hidden rounded-2xl bg-background-containers p-4 text-text-dark shadow-[var(--shadow-login)]",
|
|
11694
11707
|
"data-testid": "floor-ar-card",
|
|
11695
11708
|
children: [
|
|
11696
11709
|
/*#__PURE__*/ jsx_runtime_jsx("img", {
|
|
@@ -11705,10 +11718,10 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11705
11718
|
buttonLabel: t('floor.scene.tryAtHome'),
|
|
11706
11719
|
buttonVariant: "secondary",
|
|
11707
11720
|
buttonSize: "sm",
|
|
11708
|
-
buttonClassName: "w-fit
|
|
11721
|
+
buttonClassName: "w-fit"
|
|
11709
11722
|
}),
|
|
11710
11723
|
/*#__PURE__*/ jsx_runtime_jsx("div", {
|
|
11711
|
-
className: "typo-base-12 truncate font-medium text-text-
|
|
11724
|
+
className: "typo-base-12 truncate font-medium text-text-light",
|
|
11712
11725
|
children: t('floor.scene.tryAtHomeBody')
|
|
11713
11726
|
})
|
|
11714
11727
|
]
|
|
@@ -11782,9 +11795,9 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11782
11795
|
buttonLeadingIcon: /*#__PURE__*/ jsx_runtime_jsx(Vizbl, {
|
|
11783
11796
|
className: "size-5"
|
|
11784
11797
|
}),
|
|
11785
|
-
buttonVariant: "
|
|
11798
|
+
buttonVariant: "secondary",
|
|
11786
11799
|
buttonSize: "default",
|
|
11787
|
-
buttonClassName: "h-9 w-full rounded-xl
|
|
11800
|
+
buttonClassName: "h-9 w-full rounded-xl"
|
|
11788
11801
|
})
|
|
11789
11802
|
]
|
|
11790
11803
|
})
|
|
@@ -11855,9 +11868,9 @@ function FloorSceneChrome({ actions, canShowAr, companyName, hasActiveError, mat
|
|
|
11855
11868
|
buttonLeadingIcon: /*#__PURE__*/ jsx_runtime_jsx(Vizbl, {
|
|
11856
11869
|
className: "size-6"
|
|
11857
11870
|
}),
|
|
11858
|
-
buttonVariant: "
|
|
11871
|
+
buttonVariant: "secondary",
|
|
11859
11872
|
buttonSize: "lg",
|
|
11860
|
-
buttonClassName: "h-11 w-full rounded-xl
|
|
11873
|
+
buttonClassName: "h-11 w-full rounded-xl"
|
|
11861
11874
|
})
|
|
11862
11875
|
]
|
|
11863
11876
|
})
|
|
@@ -14375,6 +14388,7 @@ function RoomViewerDialog({ type, src, tinuuid, width, height, dimensionUnit, di
|
|
|
14375
14388
|
themeRoot && /*#__PURE__*/ jsx_runtime_jsx(ThemeProvider, {
|
|
14376
14389
|
root: themeRoot,
|
|
14377
14390
|
storageKey: "neurodyn-theme",
|
|
14391
|
+
defaultTheme: "light",
|
|
14378
14392
|
children: /*#__PURE__*/ jsx_runtime_jsx(I18nextProvider, {
|
|
14379
14393
|
i18n: roomViewerI18n,
|
|
14380
14394
|
children: 'floor' === placement ? shouldRenderRoomViewerRoot && roomViewerRoot : /*#__PURE__*/ jsx_runtime_jsx(Dialog, {
|
|
@@ -14439,6 +14453,7 @@ function RoomViewer({ type, src, tinuuid, name, language, width, height, dimensi
|
|
|
14439
14453
|
children: themeRoot && /*#__PURE__*/ jsx_runtime_jsx(ThemeProvider, {
|
|
14440
14454
|
root: themeRoot,
|
|
14441
14455
|
storageKey: "neurodyn-theme",
|
|
14456
|
+
defaultTheme: "light",
|
|
14442
14457
|
children: /*#__PURE__*/ jsx_runtime_jsx(I18nextProvider, {
|
|
14443
14458
|
i18n: roomViewerI18n,
|
|
14444
14459
|
children: /*#__PURE__*/ jsx_runtime_jsx(RoomViewerRoot, {
|