@terraware/web-components 5.0.27-rc.0 → 5.0.27
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/components/AntSwitch/index.js +22 -19
- package/components/Autocomplete/Autocomplete.js +130 -106
- package/components/Badge/index.js +29 -28
- package/components/BusySpinner/index.js +45 -40
- package/components/Button/Button.js +47 -41
- package/components/Checkbox.js +63 -64
- package/components/Confirm/index.js +83 -74
- package/components/DatePicker/DatePicker.js +141 -138
- package/components/DialogBox/DialogBox.js +118 -111
- package/components/Divisor.js +18 -18
- package/components/Dropdown.js +94 -66
- package/components/EditableTable/index.js +271 -211
- package/components/ErrorBox/ErrorBox.js +49 -47
- package/components/FileChooser/index.js +135 -117
- package/components/FormBottomBar/index.js +84 -75
- package/components/Icon/Icon.js +20 -12
- package/components/Icon/icons/index.js +256 -256
- package/components/IconTooltip/index.js +60 -49
- package/components/Map/MapBox.js +452 -545
- package/components/Map/MapContainer.js +29 -25
- package/components/Map/MapDateSliderControl.js +64 -64
- package/components/Map/MapDrawer.js +47 -41
- package/components/Map/MapLegend.js +172 -176
- package/components/Map/MapViewStyleControl.js +63 -59
- package/components/Map/ReactMapboxWrapper.js +2 -3
- package/components/Map/index.js +180 -161
- package/components/Map/types.js +17 -12
- package/components/Map/useMaintainLayerOrder.js +26 -16
- package/components/Markdown/index.js +26 -25
- package/components/Message/Message.js +76 -73
- package/components/MultiSelect/index.js +124 -112
- package/components/Navbar/NavFooter.js +13 -9
- package/components/Navbar/NavItem.js +76 -70
- package/components/Navbar/NavSection.js +19 -17
- package/components/Navbar/Navbar.js +46 -39
- package/components/Navbar/SubNavbar.js +13 -9
- package/components/Note.js +22 -18
- package/components/OverlayModal/OverlayModal.js +63 -56
- package/components/PageForm/index.js +41 -33
- package/components/PhotoChooser/index.js +173 -165
- package/components/PhotosCarousel/PhotoSlide.js +35 -32
- package/components/PhotosCarousel/index.js +85 -80
- package/components/PhotosCarousel/usePhotosCarousel.js +76 -69
- package/components/Pill/index.js +45 -41
- package/components/PillList/index.js +24 -17
- package/components/PlacementWrapper/index.js +59 -38
- package/components/PopoverMenu/Popover.js +85 -68
- package/components/PopoverMenu/index.js +56 -51
- package/components/PopoverMultiSelect/index.js +59 -52
- package/components/ProgressCircle/ProgressCircle.js +32 -28
- package/components/RadioButton.js +19 -17
- package/components/Select/Select.js +15 -13
- package/components/Select/SelectT.js +250 -235
- package/components/Separator/index.js +17 -14
- package/components/Size.js +1 -0
- package/components/Slider/index.js +56 -43
- package/components/SummaryBox.js +72 -70
- package/components/Tabs/index.js +135 -133
- package/components/TextTruncated/index.js +130 -117
- package/components/Textfield/Textfield.js +190 -158
- package/components/Textfield/TruncatedTextArea.js +84 -70
- package/components/TimelineSlider/TimelineMarker.js +30 -25
- package/components/TimelineSlider/TimelineRail.js +11 -8
- package/components/TimelineSlider/index.js +66 -64
- package/components/TimelineSliderV2/ClusterBadge.js +29 -25
- package/components/TimelineSliderV2/TimelineDot.js +35 -31
- package/components/TimelineSliderV2/TimelineRail.js +11 -8
- package/components/TimelineSliderV2/index.js +103 -121
- package/components/TimelineSliderV2/layout.js +147 -124
- package/components/TimelineSliderV2/types.js +1 -0
- package/components/Tooltip/Tooltip.js +56 -47
- package/components/ViewPhotosDialog/index.js +35 -28
- package/components/VirtualWalkthrough/Annotation.js +207 -163
- package/components/VirtualWalkthrough/AnnotationEditPane.js +184 -198
- package/components/VirtualWalkthrough/AnnotationPanel.js +199 -187
- package/components/VirtualWalkthrough/Application.js +34 -31
- package/components/VirtualWalkthrough/AutoRotator.js +223 -85
- package/components/VirtualWalkthrough/BlockingSpinner.js +28 -26
- package/components/VirtualWalkthrough/BoundaryRing.js +34 -30
- package/components/VirtualWalkthrough/BoundaryWall.js +36 -32
- package/components/VirtualWalkthrough/CameraInfo.js +89 -100
- package/components/VirtualWalkthrough/ControlsInfoPane.js +195 -254
- package/components/VirtualWalkthrough/GradientSky.js +73 -72
- package/components/VirtualWalkthrough/SplatControls.js +221 -209
- package/components/VirtualWalkthrough/SplatCrop.js +20 -21
- package/components/VirtualWalkthrough/SplatFadeCrop.js +20 -21
- package/components/VirtualWalkthrough/SplatModel.js +85 -65
- package/components/VirtualWalkthrough/SplatRevealRain.js +46 -41
- package/components/VirtualWalkthrough/TfAnnotationManager.js +379 -197
- package/components/VirtualWalkthrough/TfXrNavigation.js +162 -73
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.js +431 -438
- package/components/VirtualWalkthrough/VrAnnotationPanel.js +22 -18
- package/components/VirtualWalkthrough/XrAnnotationInteraction.js +17 -14
- package/components/VirtualWalkthrough/XrExitButton.js +17 -14
- package/components/VirtualWalkthrough/XrGazeDwell.js +17 -14
- package/components/VirtualWalkthrough/XrPointerRay.js +17 -14
- package/components/VirtualWalkthrough/XrStartPose.js +121 -67
- package/components/VirtualWalkthrough/boundary-ring.js +117 -87
- package/components/VirtualWalkthrough/boundary-wall.js +258 -175
- package/components/VirtualWalkthrough/camera-adoption.js +64 -18
- package/components/VirtualWalkthrough/groundPlane.js +47 -32
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +35 -35
- package/components/VirtualWalkthrough/splatFormat.js +47 -13
- package/components/VirtualWalkthrough/useAdoptedCamera.js +44 -23
- package/components/VirtualWalkthrough/useRestartOnVr.js +37 -26
- package/components/VirtualWalkthrough/useXrRenderTuning.js +54 -33
- package/components/VirtualWalkthrough/vr-annotation-panel-layout.js +99 -67
- package/components/VirtualWalkthrough/vr-annotation-panel.js +433 -403
- package/components/VirtualWalkthrough/vr-annotation-scroll.js +28 -10
- package/components/VirtualWalkthrough/walkthrough-camera.js +329 -204
- package/components/VirtualWalkthrough/xr-annotation-candidate-buffer.js +80 -39
- package/components/VirtualWalkthrough/xr-annotation-candidates.js +18 -6
- package/components/VirtualWalkthrough/xr-annotation-interaction.js +56 -31
- package/components/VirtualWalkthrough/xr-annotation-targeting.js +38 -22
- package/components/VirtualWalkthrough/xr-button-arming.js +17 -7
- package/components/VirtualWalkthrough/xr-button-hold.js +36 -22
- package/components/VirtualWalkthrough/xr-exit-button-mask.js +36 -22
- package/components/VirtualWalkthrough/xr-exit-button.js +207 -148
- package/components/VirtualWalkthrough/xr-face-buttons.js +29 -19
- package/components/VirtualWalkthrough/xr-gaze-dwell-state.js +34 -23
- package/components/VirtualWalkthrough/xr-gaze-dwell.js +144 -107
- package/components/VirtualWalkthrough/xr-interactive-ui.js +24 -12
- package/components/VirtualWalkthrough/xr-pointer-ray.js +20 -13
- package/components/VirtualWalkthrough/xr-progress-pie-material.js +88 -117
- package/components/VirtualWalkthrough/xr-progress-pie.js +10 -1
- package/components/VirtualWalkthrough/xr-ray-quad.js +30 -16
- package/components/VirtualWalkthrough/xr-render-tuning.js +48 -17
- package/components/VirtualWalkthrough/xr-scene-bounds.js +37 -21
- package/components/VirtualWalkthrough/xr-start-pose.js +73 -27
- package/components/VirtualWalkthrough/xr-teleport-gesture.js +42 -16
- package/components/svg/BlobbyGrayIconImage.js +39 -41
- package/components/svg/BlobbyGrayIconImport.js +39 -41
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +39 -41
- package/components/svg/BlobbyIconCloudChecked.js +164 -202
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +164 -202
- package/components/svg/BlobbyIconFolder.js +164 -202
- package/components/svg/BlobbyIconGraphReport.js +164 -202
- package/components/svg/BlobbyIconHappy.js +164 -202
- package/components/svg/BlobbyIconHeartMonitor.js +164 -202
- package/components/svg/BlobbyIconLeaf.js +164 -202
- package/components/svg/BlobbyIconLibrary.js +164 -202
- package/components/svg/BlobbyIconNursery.js +166 -204
- package/components/svg/BlobbyIconOrganization.js +164 -202
- package/components/svg/BlobbyIconParchment.js +164 -202
- package/components/svg/BlobbyIconPeople.js +164 -202
- package/components/svg/BlobbyIconSeedBank.js +164 -202
- package/components/svg/BlobbyIconSeedling.js +164 -202
- package/components/svg/BlobbyIconSeeds.js +164 -202
- package/components/svg/BlobbyIconSite.js +167 -206
- package/components/svg/BlobbyIconSparkles.js +164 -202
- package/components/svg/BlobbyIconWrench.js +164 -202
- package/components/svg/Bug.js +21 -19
- package/components/svg/Calendar.js +21 -19
- package/components/svg/CaretDown.js +21 -19
- package/components/svg/CaretLeft.js +21 -19
- package/components/svg/CaretRight.js +21 -19
- package/components/svg/CaretUp.js +21 -19
- package/components/svg/ChevronDown.js +21 -19
- package/components/svg/ChevronUp.js +21 -19
- package/components/svg/Close.js +21 -19
- package/components/svg/Critical.js +21 -19
- package/components/svg/Edit.js +164 -202
- package/components/svg/Error.js +21 -19
- package/components/svg/Filter.js +21 -19
- package/components/svg/Folder.js +21 -19
- package/components/svg/Help.js +21 -19
- package/components/svg/Home.js +21 -19
- package/components/svg/IconAdd.js +21 -19
- package/components/svg/IconArrowRight.js +23 -21
- package/components/svg/IconBusinessNetwork.js +21 -19
- package/components/svg/IconCalendar.js +21 -19
- package/components/svg/IconCancel.js +21 -19
- package/components/svg/IconChargingBattery.js +21 -19
- package/components/svg/IconChecklist.js +23 -21
- package/components/svg/IconCheckmark.js +21 -19
- package/components/svg/IconCoinInHand.js +21 -19
- package/components/svg/IconColumns.js +21 -19
- package/components/svg/IconComment.js +22 -20
- package/components/svg/IconDashboard.js +21 -19
- package/components/svg/IconDataMigration.js +21 -19
- package/components/svg/IconDocument.js +23 -21
- package/components/svg/IconDownloadFromTheCloud.js +23 -21
- package/components/svg/IconEdit.js +23 -21
- package/components/svg/IconExpand.js +23 -21
- package/components/svg/IconExport.js +21 -19
- package/components/svg/IconExternalLink.js +21 -19
- package/components/svg/IconEye.js +21 -19
- package/components/svg/IconEyeOff.js +21 -19
- package/components/svg/IconFile.js +21 -19
- package/components/svg/IconFolder.js +21 -19
- package/components/svg/IconFullScreen.js +22 -20
- package/components/svg/IconFutures.js +21 -19
- package/components/svg/IconGraphReport.js +21 -19
- package/components/svg/IconGrid.js +21 -19
- package/components/svg/IconHeartMonitor.js +21 -19
- package/components/svg/IconHelp.js +23 -21
- package/components/svg/IconHistory.js +21 -19
- package/components/svg/IconImport.js +21 -19
- package/components/svg/IconIndex.js +21 -19
- package/components/svg/IconLayers.js +21 -19
- package/components/svg/IconLibrary.js +22 -20
- package/components/svg/IconList.js +21 -19
- package/components/svg/IconLivePlant.js +21 -19
- package/components/svg/IconLocations.js +21 -19
- package/components/svg/IconMail.js +21 -19
- package/components/svg/IconManager.js +21 -19
- package/components/svg/IconMap.js +21 -19
- package/components/svg/IconMarker.js +21 -19
- package/components/svg/IconMenu.js +21 -19
- package/components/svg/IconMenuHorizontal.js +21 -19
- package/components/svg/IconModule.js +21 -19
- package/components/svg/IconMyLocation.js +21 -19
- package/components/svg/IconNote.js +23 -21
- package/components/svg/IconNursery.js +23 -21
- package/components/svg/IconOrg.js +21 -19
- package/components/svg/IconParchment.js +21 -19
- package/components/svg/IconPhoto.js +21 -19
- package/components/svg/IconPlantsFilled.js +21 -19
- package/components/svg/IconRedo.js +21 -19
- package/components/svg/IconRestorationSite.js +21 -19
- package/components/svg/IconSeedBank.js +21 -19
- package/components/svg/IconSeedling.js +21 -19
- package/components/svg/IconSettings.js +21 -19
- package/components/svg/IconSlice.js +21 -19
- package/components/svg/IconSubmit.js +21 -19
- package/components/svg/IconSubtract.js +23 -21
- package/components/svg/IconSynced.js +21 -19
- package/components/svg/IconTrashCan.js +21 -19
- package/components/svg/IconTreasureMap.js +21 -19
- package/components/svg/IconUnavailable.js +21 -19
- package/components/svg/IconUndo.js +21 -19
- package/components/svg/IconVariable.js +21 -19
- package/components/svg/IconVideo.js +31 -30
- package/components/svg/IconWifi.js +21 -19
- package/components/svg/Info.js +21 -19
- package/components/svg/Key.js +21 -19
- package/components/svg/Leaf.js +21 -19
- package/components/svg/Lock.js +21 -19
- package/components/svg/Logo.js +43 -48
- package/components/svg/MenuVertical.js +21 -19
- package/components/svg/Notification.js +21 -19
- package/components/svg/Person.js +21 -19
- package/components/svg/Plus.js +21 -19
- package/components/svg/RestorationSite.js +21 -19
- package/components/svg/Search.js +21 -19
- package/components/svg/Seeds.js +21 -19
- package/components/svg/Site.js +21 -19
- package/components/svg/Sparkles.js +21 -19
- package/components/svg/Species.js +21 -19
- package/components/svg/Species2.js +164 -202
- package/components/svg/Spinner.js +48 -54
- package/components/svg/Star.js +21 -19
- package/components/svg/Success.js +21 -19
- package/components/svg/SuccessFilled.js +21 -19
- package/components/svg/TerrawareLogoDesktop.js +49 -55
- package/components/svg/TerrawareLogoMobile.js +26 -25
- package/components/svg/Touchscreen.js +21 -19
- package/components/svg/UploadCloud.js +164 -202
- package/components/svg/Warning.js +21 -19
- package/components/svg/WelcomeClipboard.js +133 -156
- package/components/svg/index.js +129 -129
- package/components/table/EnhancedTableToolbar.js +74 -68
- package/components/table/EnhancedTableToolbarV2.js +41 -31
- package/components/table/TableCellRenderer.js +231 -196
- package/components/table/TableHeader.js +73 -71
- package/components/table/TableHeaderItem.js +102 -97
- package/components/table/density.js +19 -18
- package/components/table/index.js +369 -350
- package/components/table/sort.js +52 -27
- package/components/table/types.js +1 -0
- package/components/types/index.js +1 -0
- package/hooks/cameraEntityContext.js +13 -2
- package/hooks/useBoolean.js +13 -17
- package/hooks/useCameraPosition.js +56 -56
- package/hooks/useDevicePerformance.js +17 -17
- package/hooks/useXr.js +87 -85
- package/index.js +58 -58
- package/package.json +1 -1
- package/setupTests.js +4 -0
- package/strings/export.js +170 -111
- package/strings/index.js +54 -25
- package/strings/locales.js +41 -21
- package/strings/strings-en.js +51 -49
- package/strings/strings-es.js +51 -49
- package/strings/strings-fr.js +51 -49
- package/strings/strings-gx.js +51 -49
- package/style-dictionary-dist/TerrawareTheme.js +186 -186
- package/theme.js +76 -74
- package/utils/color.js +15 -8
- package/utils/date.js +108 -42
- package/utils/index.js +4 -4
- package/utils/preventDefaultEvent.js +3 -3
- package/utils/text.js +11 -11
- package/utils/useDeviceInfo.js +79 -42
- package/virtualWalkthrough.js +23 -23
|
@@ -1,23 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render settings applied for the duration of an XR session. Splats rasterize as alpha-blended
|
|
3
|
+
* quads with no early-z rejection, which makes a headset's stereo pixel throughput the binding
|
|
4
|
+
* constraint on framerate long before splat count is.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Peripheral back-buffer resolution reduction, 0 (off) to 1 (strongest). Ineffective while MSAA is
|
|
9
|
+
* on, which is one reason the application requests `antialias: false`.
|
|
10
|
+
*/
|
|
1
11
|
const XR_FIXED_FOVEATION = 1;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The subset of `GSplatParams` this module writes. Structural rather than the PlayCanvas type so
|
|
15
|
+
* the logic can be exercised against a plain object.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `radialSorting` orders splats by distance from the camera rather than by depth along its forward
|
|
20
|
+
* axis, which is the more accurate ordering when the camera rotates rather than translates. Sorting
|
|
21
|
+
* runs on a worker and so lags the view by at least a frame; head rotation dominates in a headset,
|
|
22
|
+
* where that lag is what reads as swimming.
|
|
23
|
+
*
|
|
24
|
+
* The other two trade fidelity for fill rate: `alphaClipForward` drops near-transparent splats from
|
|
25
|
+
* the forward pass, and `minPixelSize` drops splats that project to less than a few pixels.
|
|
26
|
+
*/
|
|
2
27
|
const XR_GSPLAT_TUNING = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
28
|
+
radialSorting: true,
|
|
29
|
+
alphaClipForward: 0.1,
|
|
30
|
+
minPixelSize: 1
|
|
6
31
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
params.
|
|
15
|
-
params.
|
|
16
|
-
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Applies the XR settings, returning the values that were replaced so they can be restored when the
|
|
35
|
+
* session ends. These live on the scene, so leaving them tuned would degrade desktop rendering.
|
|
36
|
+
*/
|
|
37
|
+
const applyGsplatTuning = params => {
|
|
38
|
+
const previous = {
|
|
39
|
+
radialSorting: params.radialSorting,
|
|
40
|
+
alphaClipForward: params.alphaClipForward,
|
|
41
|
+
minPixelSize: params.minPixelSize
|
|
42
|
+
};
|
|
43
|
+
params.radialSorting = XR_GSPLAT_TUNING.radialSorting;
|
|
44
|
+
params.alphaClipForward = XR_GSPLAT_TUNING.alphaClipForward;
|
|
45
|
+
params.minPixelSize = XR_GSPLAT_TUNING.minPixelSize;
|
|
46
|
+
return previous;
|
|
17
47
|
};
|
|
18
|
-
const restoreGsplatTuning = (params, previous)=>{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
48
|
+
const restoreGsplatTuning = (params, previous) => {
|
|
49
|
+
params.radialSorting = previous.radialSorting;
|
|
50
|
+
params.alphaClipForward = previous.alphaClipForward;
|
|
51
|
+
params.minPixelSize = previous.minPixelSize;
|
|
22
52
|
};
|
|
53
|
+
|
|
23
54
|
export { XR_FIXED_FOVEATION, XR_GSPLAT_TUNING, applyGsplatTuning, restoreGsplatTuning };
|
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/** A world-space XZ point clamped into the bounds circle, and how far it had to move to get there. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Clamp a world-space XZ point into the circle of `radius` about (centerX, centerZ).
|
|
5
|
+
*
|
|
6
|
+
* `distance` is how far the point was moved and is 0 whenever the point was already inside, which
|
|
7
|
+
* callers use as the "was this clamped?" signal. A non-positive radius means "no bounds" and leaves
|
|
8
|
+
* the point untouched; so does a point at the exact center, which has no direction to project along.
|
|
9
|
+
*/
|
|
10
|
+
const clampToCircle = (x, z, centerX, centerZ, radius) => {
|
|
11
|
+
if (radius <= 0) {
|
|
12
|
+
return {
|
|
13
|
+
x,
|
|
14
|
+
z,
|
|
15
|
+
distance: 0
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
}
|
|
18
|
+
const dx = x - centerX;
|
|
19
|
+
const dz = z - centerZ;
|
|
20
|
+
const dist = Math.sqrt(dx * dx + dz * dz);
|
|
21
|
+
if (dist <= radius) {
|
|
16
22
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
x,
|
|
24
|
+
z,
|
|
25
|
+
distance: 0
|
|
20
26
|
};
|
|
27
|
+
}
|
|
28
|
+
const scale = radius / dist;
|
|
29
|
+
return {
|
|
30
|
+
x: centerX + dx * scale,
|
|
31
|
+
z: centerZ + dz * scale,
|
|
32
|
+
distance: dist - radius
|
|
33
|
+
};
|
|
21
34
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
|
|
36
|
+
/** Horizontal distance from a world-space XZ point to the circle's edge: negative inside, positive outside. */
|
|
37
|
+
const distanceToCircleEdge = (x, z, centerX, centerZ, radius) => {
|
|
38
|
+
const dx = x - centerX;
|
|
39
|
+
const dz = z - centerZ;
|
|
40
|
+
return Math.sqrt(dx * dx + dz * dz) - radius;
|
|
26
41
|
};
|
|
42
|
+
|
|
27
43
|
export { clampToCircle, distanceToCircleEdge };
|
|
@@ -1,34 +1,80 @@
|
|
|
1
|
-
import { clampToCircle } from
|
|
1
|
+
import { clampToCircle } from './xr-scene-bounds.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where to put the XR rig so the head starts at a chosen spot facing a chosen point.
|
|
5
|
+
*
|
|
6
|
+
* PlayCanvas writes the head pose into the camera entity's *local* transform every frame, so the
|
|
7
|
+
* only thing a scene can move is the rig the camera hangs off. The head sits at an arbitrary offset
|
|
8
|
+
* within the rig — the reference space is pinned to wherever the user physically stood when the
|
|
9
|
+
* session began — so the rig pose has to be solved backwards from the head pose rather than set to
|
|
10
|
+
* the target outright.
|
|
11
|
+
*
|
|
12
|
+
* All angles are degrees and all coordinates world-space XZ; Y is left to the caller, since the
|
|
13
|
+
* user stands on the rig floor rather than on the scene's ground plane.
|
|
14
|
+
*/
|
|
2
15
|
const RAD_TO_DEG = 180 / Math.PI;
|
|
3
16
|
const DEG_TO_RAD = Math.PI / 180;
|
|
17
|
+
|
|
18
|
+
/** Below this length a direction vector carries no usable heading. */
|
|
4
19
|
const DIRECTION_EPSILON = 1e-6;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
|
|
21
|
+
/** Wraps to (-180, 180] so the rig always turns the short way round. */
|
|
22
|
+
const normalizeAngle = degrees => {
|
|
23
|
+
const wrapped = ((degrees + 180) % 360 + 360) % 360 - 180;
|
|
24
|
+
return wrapped === -180 ? 180 : wrapped;
|
|
8
25
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Yaw of a heading on the XZ plane, matching PlayCanvas' right-handed CCW Y rotation:
|
|
29
|
+
* forward = (-sin(yaw), 0, -cos(yaw)).
|
|
30
|
+
*/
|
|
31
|
+
const yawFromDirection = (dx, dz) => Math.abs(dx) < DIRECTION_EPSILON && Math.abs(dz) < DIRECTION_EPSILON ? null : Math.atan2(-dx, -dz) * RAD_TO_DEG;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Yaw an entity is facing, from its world basis vectors. Falls back to the right vector when the
|
|
35
|
+
* forward vector is vertical — a head tipped fully up or down still has a heading, but its forward
|
|
36
|
+
* vector has no horizontal component to read it from.
|
|
37
|
+
*/
|
|
38
|
+
const yawFromBasis = (forward, right) => yawFromDirection(forward.x, forward.z) ?? Math.atan2(-right.z, right.x) * RAD_TO_DEG;
|
|
39
|
+
|
|
40
|
+
/** Rotates a point about the origin by `degrees` of PlayCanvas yaw. */
|
|
41
|
+
const rotateXz = (point, degrees) => {
|
|
42
|
+
const radians = degrees * DEG_TO_RAD;
|
|
43
|
+
const cos = Math.cos(radians);
|
|
44
|
+
const sin = Math.sin(radians);
|
|
45
|
+
return {
|
|
46
|
+
x: point.x * cos + point.z * sin,
|
|
47
|
+
z: -point.x * sin + point.z * cos
|
|
48
|
+
};
|
|
19
49
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Solves for the rig pose that lands the head on `target` facing `focus`.
|
|
53
|
+
*
|
|
54
|
+
* Turning the rig swings the head around the rig's origin, so the turn is applied to the head's
|
|
55
|
+
* offset within the rig first and the rig is then placed so that swung offset lands on the target.
|
|
56
|
+
* A focus point on top of the target gives no heading, so the rig is only moved, not turned.
|
|
57
|
+
*/
|
|
58
|
+
const xrStartRigPose = ({
|
|
59
|
+
head,
|
|
60
|
+
headYaw,
|
|
61
|
+
rig,
|
|
62
|
+
target,
|
|
63
|
+
focus,
|
|
64
|
+
bounds
|
|
65
|
+
}) => {
|
|
66
|
+
const landing = bounds ? clampToCircle(target.x, target.z, bounds.x, bounds.z, bounds.radius) : target;
|
|
67
|
+
const facingYaw = yawFromDirection(focus.x - landing.x, focus.z - landing.z);
|
|
68
|
+
const yawDelta = facingYaw === null ? 0 : normalizeAngle(facingYaw - headYaw);
|
|
69
|
+
const offset = rotateXz({
|
|
70
|
+
x: head.x - rig.x,
|
|
71
|
+
z: head.z - rig.z
|
|
72
|
+
}, yawDelta);
|
|
73
|
+
return {
|
|
74
|
+
yawDelta,
|
|
75
|
+
x: landing.x - offset.x,
|
|
76
|
+
z: landing.z - offset.z
|
|
77
|
+
};
|
|
33
78
|
};
|
|
79
|
+
|
|
34
80
|
export { xrStartRigPose, yawFromBasis, yawFromDirection };
|
|
@@ -1,21 +1,47 @@
|
|
|
1
|
+
/** Per-frame aim state for one input source, sampled while its select gesture is in progress. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decides whether the select gesture that just ended is allowed to teleport. The two reasons to
|
|
5
|
+
* refuse have deliberately different lifetimes:
|
|
6
|
+
*
|
|
7
|
+
* - `teleportDisabled` latches for the rest of the press. The React flag behind it re-enables as
|
|
8
|
+
* soon as the select dismisses the panel, which can land before the selectend that ends the press.
|
|
9
|
+
* - `uiBlocked` keeps only the newest frame, because that frame is the one whose arc hit the base
|
|
10
|
+
* script has cached and would commit on release. Re-deciding from the release-time ray instead
|
|
11
|
+
* would let a flick off the UI commit a target that was aimed while over it, and latching the
|
|
12
|
+
* whole press would refuse an aim that merely swept across UI before coming to rest on floor.
|
|
13
|
+
*
|
|
14
|
+
* Callers must poll every frame for every source they care about; a press and release between polls
|
|
15
|
+
* is missed.
|
|
16
|
+
*/
|
|
1
17
|
class TeleportGestureLatch {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (frame.uiBlocked) this._uiBlocked.add(inputSource);
|
|
12
|
-
else this._uiBlocked.delete(inputSource);
|
|
18
|
+
_teleportDisabled = new WeakSet();
|
|
19
|
+
_uiBlocked = new WeakSet();
|
|
20
|
+
|
|
21
|
+
/** Records a frame of an in-progress press. A source that isn't pressed drops both latches. */
|
|
22
|
+
track(inputSource, frame) {
|
|
23
|
+
if (!frame.pressed) {
|
|
24
|
+
this._teleportDisabled.delete(inputSource);
|
|
25
|
+
this._uiBlocked.delete(inputSource);
|
|
26
|
+
return;
|
|
13
27
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this._teleportDisabled.delete(inputSource);
|
|
17
|
-
this._uiBlocked.delete(inputSource);
|
|
18
|
-
return blocked;
|
|
28
|
+
if (frame.teleportDisabled) {
|
|
29
|
+
this._teleportDisabled.add(inputSource);
|
|
19
30
|
}
|
|
31
|
+
if (frame.uiBlocked) {
|
|
32
|
+
this._uiBlocked.add(inputSource);
|
|
33
|
+
} else {
|
|
34
|
+
this._uiBlocked.delete(inputSource);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** True when the press may not teleport. Clears both latches so they never outlive the press. */
|
|
39
|
+
consumeBlocked(inputSource) {
|
|
40
|
+
const blocked = this._teleportDisabled.has(inputSource) || this._uiBlocked.has(inputSource);
|
|
41
|
+
this._teleportDisabled.delete(inputSource);
|
|
42
|
+
this._uiBlocked.delete(inputSource);
|
|
43
|
+
return blocked;
|
|
44
|
+
}
|
|
20
45
|
}
|
|
46
|
+
|
|
21
47
|
export { TeleportGestureLatch };
|
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const BlobbyGrayIconImage = SvgBlobbyGrayIconImage;
|
|
41
|
-
export default BlobbyGrayIconImage;
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const SvgBlobbyGrayIconImage = ({
|
|
5
|
+
title,
|
|
6
|
+
titleId,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxs("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 200 128",
|
|
12
|
+
"aria-labelledby": titleId,
|
|
13
|
+
...props,
|
|
14
|
+
children: [title ? /*#__PURE__*/jsx("title", {
|
|
15
|
+
id: titleId,
|
|
16
|
+
children: title
|
|
17
|
+
}) : null, /*#__PURE__*/jsxs("g", {
|
|
18
|
+
clipPath: "url(#blobby-gray-icon-image_svg__a)",
|
|
19
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
20
|
+
fill: "#F1F0EC",
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M113.962 6.222c26.535 2.074 38.447 30.862 44.693 56.735 4.621 19.146-2.901 38.537-18.932 49.978-15.595 11.131-35.55 10.486-51.986.639C63.732 99.19 34.311 80.943 40.954 53.757c7.619-31.19 41-50.037 73.009-47.535",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
fill: "#7F775B",
|
|
26
|
+
d: "M83.333 40C79.307 40 76 43.307 76 47.333v33.334C76 84.693 79.307 88 83.333 88h33.334c4.026 0 7.333-3.307 7.333-7.333V47.333c0-4.026-3.307-7.333-7.333-7.333zm0 4h33.334A3.304 3.304 0 0 1 120 47.333v27.274l-8.016-7.755-.002-.003a5.4 5.4 0 0 0-3.75-1.516 5.4 5.4 0 0 0-3.75 1.519l-2.732 2.643-8.24-7.972A5.4 5.4 0 0 0 89.758 60a5.4 5.4 0 0 0-3.75 1.52l-.003.003L80 67.333v-20A3.304 3.304 0 0 1 83.333 44m25.334 5.333c-1.834 0-3.462.76-4.495 1.922-1.033 1.163-1.505 2.634-1.505 4.078s.472 2.916 1.505 4.078 2.661 1.922 4.495 1.922c1.833 0 3.461-.76 4.494-1.922 1.034-1.162 1.506-2.633 1.506-4.078 0-1.444-.472-2.915-1.506-4.078-1.033-1.162-2.661-1.922-4.494-1.922m0 4c.833 0 1.205.24 1.505.578s.495.867.495 1.422c0 .556-.195 1.085-.495 1.422-.3.338-.672.578-1.505.578-.834 0-1.205-.24-1.506-.578s-.494-.866-.494-1.422.194-1.084.494-1.422c.301-.337.672-.578 1.506-.578M89.757 64a1.37 1.37 0 0 1 .972.398l8.143 7.878L86.752 84h-3.419A3.304 3.304 0 0 1 80 80.667v-7.769l8.787-8.5c.283-.274.626-.398.97-.398m18.475 5.333c.353 0 .691.123.971.394L120 80.172v.495A3.304 3.304 0 0 1 116.667 84h-24.16l14.756-14.273c.277-.268.618-.394.969-.394"
|
|
27
|
+
})]
|
|
28
|
+
}), /*#__PURE__*/jsx("defs", {
|
|
29
|
+
children: /*#__PURE__*/jsx("clipPath", {
|
|
30
|
+
id: "blobby-gray-icon-image_svg__a",
|
|
31
|
+
children: /*#__PURE__*/jsx("path", {
|
|
32
|
+
fill: "#fff",
|
|
33
|
+
d: "M0 0h200v128H0z"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { SvgBlobbyGrayIconImage as default };
|
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const BlobbyGrayIconImport = SvgBlobbyGrayIconImport;
|
|
41
|
-
export default BlobbyGrayIconImport;
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const SvgBlobbyGrayIconImport = ({
|
|
5
|
+
title,
|
|
6
|
+
titleId,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxs("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 200 128",
|
|
12
|
+
"aria-labelledby": titleId,
|
|
13
|
+
...props,
|
|
14
|
+
children: [title ? /*#__PURE__*/jsx("title", {
|
|
15
|
+
id: titleId,
|
|
16
|
+
children: title
|
|
17
|
+
}) : null, /*#__PURE__*/jsxs("g", {
|
|
18
|
+
clipPath: "url(#blobby-gray-icon-import_svg__a)",
|
|
19
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
20
|
+
fill: "#F1F0EC",
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M97.492 4.026c24.033-.76 45.335 14.966 53.284 37.66 8.572 24.47 4.488 52.73-16.101 68.491-22.132 16.943-53.93 19.23-75.615 1.718C39.75 96.3 45.34 68.141 53.67 44.76c7.4-20.77 21.784-40.036 43.822-40.734",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
fill: "#7F775B",
|
|
26
|
+
d: "M84.667 37.333c-3.29 0-6 2.71-6 6v41.334c0 3.29 2.71 6 6 6h30.666c3.29 0 6-2.71 6-6v-28c0-.53-.21-1.04-.586-1.414l-.02-.021-17.313-17.313a2 2 0 0 0-1.414-.586zm0 4H100v11.334c0 3.29 2.71 6 6 6h11.333v26c0 1.128-.871 2-2 2H84.667c-1.129 0-2-.872-2-2V43.333c0-1.128.871-2 2-2M104 44.161l10.505 10.506H106c-1.129 0-2-.872-2-2zM99.971 60a2 2 0 0 0-1.385.586l-5.333 5.333a2 2 0 1 0 2.828 2.828L98 66.828V74A2 2 0 1 0 102 74v-7.172l1.919 1.92a2.002 2.002 0 0 0 3.295-.63 1.99 1.99 0 0 0-.016-1.55 2 2 0 0 0-.451-.649l-5.333-5.333A2 2 0 0 0 99.971 60m-8.638 18.667a2.002 2.002 0 0 0-1.873 2.772 2 2 0 0 0 1.873 1.228h17.334a2 2 0 1 0 0-4z"
|
|
27
|
+
})]
|
|
28
|
+
}), /*#__PURE__*/jsx("defs", {
|
|
29
|
+
children: /*#__PURE__*/jsx("clipPath", {
|
|
30
|
+
id: "blobby-gray-icon-import_svg__a",
|
|
31
|
+
children: /*#__PURE__*/jsx("path", {
|
|
32
|
+
fill: "#fff",
|
|
33
|
+
d: "M0 0h200v128H0z"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { SvgBlobbyGrayIconImport as default };
|
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const BlobbyGrayIconUploadToTheCloud = SvgBlobbyGrayIconUploadToTheCloud;
|
|
41
|
-
export default BlobbyGrayIconUploadToTheCloud;
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const SvgBlobbyGrayIconUploadToTheCloud = ({
|
|
5
|
+
title,
|
|
6
|
+
titleId,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxs("svg", {
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 200 128",
|
|
12
|
+
"aria-labelledby": titleId,
|
|
13
|
+
...props,
|
|
14
|
+
children: [title ? /*#__PURE__*/jsx("title", {
|
|
15
|
+
id: titleId,
|
|
16
|
+
children: title
|
|
17
|
+
}) : null, /*#__PURE__*/jsxs("g", {
|
|
18
|
+
clipPath: "url(#blobby-gray-icon-upload-to-the-cloud_svg__a)",
|
|
19
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
20
|
+
fill: "#F1F0EC",
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M97.492 4.026c24.033-.76 45.335 14.966 53.284 37.66 8.572 24.47 4.488 52.73-16.101 68.491-22.132 16.943-53.93 19.23-75.615 1.718C39.75 96.3 45.34 68.141 53.67 44.76c7.4-20.77 21.784-40.036 43.822-40.734",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
fill: "#7F775B",
|
|
26
|
+
d: "M100 45.333c-8.373 0-15.264 6.467-15.943 14.667h-.724C77.084 60 72 65.084 72 71.333s5.084 11.334 11.333 11.334h12v-4h-12c-4.044 0-7.333-3.29-7.333-7.334S79.29 64 83.333 64H86a2 2 0 0 0 2-2v-.667c0-6.616 5.384-12 12-12s12 5.384 12 12V62a2 2 0 0 0 2 2h2.667c4.044 0 7.333 3.29 7.333 7.333s-3.289 7.334-7.333 7.334h-12v4h12c6.249 0 11.333-5.084 11.333-11.334C128 65.084 122.916 60 116.667 60h-.724c-.679-8.2-7.57-14.667-15.943-14.667m-.031 18.638a2 2 0 0 0-1.565.797l-5.818 5.818a2 2 0 1 0 2.828 2.828L98 70.828V86a2.002 2.002 0 0 0 2.772 1.874A2 2 0 0 0 102 86V70.828l2.586 2.586a1.998 1.998 0 0 0 3.295-.63 2.005 2.005 0 0 0-.467-2.198l-5.828-5.828a2 2 0 0 0-1.617-.787"
|
|
27
|
+
})]
|
|
28
|
+
}), /*#__PURE__*/jsx("defs", {
|
|
29
|
+
children: /*#__PURE__*/jsx("clipPath", {
|
|
30
|
+
id: "blobby-gray-icon-upload-to-the-cloud_svg__a",
|
|
31
|
+
children: /*#__PURE__*/jsx("path", {
|
|
32
|
+
fill: "#fff",
|
|
33
|
+
d: "M0 0h200v128H0z"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { SvgBlobbyGrayIconUploadToTheCloud as default };
|