@terraware/web-components 4.2.26-rc.0 → 4.3.0
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/_vendor/react-multi-carousel/index.js +13 -0
- package/_vendor/react-multi-carousel/lib/Arrows.js +13 -0
- package/_vendor/react-multi-carousel/lib/Carousel.js +19 -0
- package/_vendor/react-multi-carousel/lib/CarouselItems.js +14 -0
- package/_vendor/react-multi-carousel/lib/Dots.js +16 -0
- package/_vendor/react-multi-carousel/lib/index.js +13 -0
- package/_vendor/react-multi-carousel/lib/types.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/clones.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/common.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/dots.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/elementWidth.js +12 -0
- package/_vendor/react-multi-carousel/lib/utils/index.js +20 -0
- package/_vendor/react-multi-carousel/lib/utils/mouseOrTouchMove.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/next.js +13 -0
- package/_vendor/react-multi-carousel/lib/utils/previous.js +14 -0
- package/_vendor/react-multi-carousel/lib/utils/throttle.js +12 -0
- package/_vendor/react-multi-carousel/lib/utils/throwError.js +14 -0
- package/_virtual/Arrows.js +3 -0
- package/_virtual/Carousel.js +3 -0
- package/_virtual/CarouselItems.js +3 -0
- package/_virtual/Dots.js +3 -0
- package/_virtual/_commonjsHelpers.js +5 -0
- package/_virtual/clones.js +3 -0
- package/_virtual/common.js +3 -0
- package/_virtual/dots2.js +3 -0
- package/_virtual/elementWidth.js +3 -0
- package/_virtual/index.js +7 -0
- package/_virtual/index2.js +3 -0
- package/_virtual/index3.js +3 -0
- package/_virtual/mouseOrTouchMove.js +3 -0
- package/_virtual/next.js +3 -0
- package/_virtual/previous.js +3 -0
- package/_virtual/throttle.js +3 -0
- package/_virtual/throwError.js +3 -0
- package/_virtual/types.js +3 -0
- package/components/AntSwitch/index.js +6 -4
- package/components/Autocomplete/Autocomplete.js +19 -16
- package/components/Badge/index.js +8 -6
- package/components/BusySpinner/index.js +11 -8
- package/components/Button/Button.js +12 -9
- package/components/Checkbox.js +11 -8
- package/components/Confirm/index.js +14 -17
- package/components/DatePicker/DatePicker.js +19 -23
- package/components/DialogBox/DialogBox.js +25 -20
- package/components/Divisor.js +11 -8
- package/components/Dropdown.js +18 -15
- package/components/EditableTable/index.js +17 -14
- package/components/ErrorBox/ErrorBox.js +18 -15
- package/components/FileChooser/index.js +20 -15
- package/components/FormBottomBar/index.js +15 -12
- package/components/Icon/Icon.js +9 -6
- package/components/Icon/icons/index.js +252 -251
- package/components/IconTooltip/index.js +14 -9
- package/components/Map/MapBox.js +35 -32
- package/components/Map/MapContainer.js +10 -6
- package/components/Map/MapDateSliderControl.js +14 -12
- package/components/Map/MapDrawer.js +16 -12
- package/components/Map/MapLegend.js +32 -28
- package/components/Map/MapViewStyleControl.js +11 -9
- package/components/Map/ReactMapboxWrapper.js +1 -1
- package/components/Map/index.js +13 -11
- package/components/Map/types.js +5 -3
- package/components/Map/useMaintainLayerOrder.js +5 -2
- package/components/Markdown/index.js +6 -4
- package/components/Message/Message.js +25 -20
- package/components/MultiSelect/index.js +26 -23
- package/components/Navbar/NavFooter.js +8 -5
- package/components/Navbar/NavItem.js +14 -11
- package/components/Navbar/NavSection.js +10 -7
- package/components/Navbar/Navbar.js +16 -11
- package/components/Navbar/SubNavbar.js +8 -5
- package/components/Note.js +10 -7
- package/components/OverlayModal/OverlayModal.js +13 -11
- package/components/PageForm/index.js +15 -12
- package/components/PhotoChooser/index.js +30 -25
- package/components/PhotosCarousel/index.js +15 -18
- package/components/Pill/index.js +14 -11
- package/components/PillList/index.js +10 -7
- package/components/PlacementWrapper/index.js +8 -6
- package/components/PopoverMenu/Popover.js +12 -9
- package/components/PopoverMenu/index.js +14 -11
- package/components/PopoverMultiSelect/index.js +14 -11
- package/components/ProgressCircle/ProgressCircle.js +12 -9
- package/components/RadioButton.js +9 -6
- package/components/Select/Select.js +9 -6
- package/components/Select/SelectT.js +30 -26
- package/components/Separator/index.js +7 -5
- package/components/Size.js +1 -1
- package/components/Slider/index.js +9 -6
- package/components/SummaryBox.js +13 -10
- package/components/Tabs/index.js +22 -18
- package/components/TextTruncated/index.js +13 -20
- package/components/Textfield/Textfield.js +34 -28
- package/components/Textfield/TruncatedTextArea.js +12 -10
- package/components/TimelineSlider/TimelineMarker.js +8 -6
- package/components/TimelineSlider/TimelineRail.js +6 -4
- package/components/TimelineSlider/index.js +14 -12
- package/components/Tooltip/Tooltip.js +12 -7
- package/components/ViewPhotosDialog/index.js +14 -11
- package/components/VirtualWalkthrough/Annotation.js +10 -8
- package/components/VirtualWalkthrough/AnnotationEditPane.js +23 -21
- package/components/VirtualWalkthrough/AnnotationPanel.js +16 -14
- package/components/VirtualWalkthrough/Application.js +9 -7
- package/components/VirtualWalkthrough/AutoRotator.js +5 -3
- package/components/VirtualWalkthrough/BlockingSpinner.js +10 -7
- package/components/VirtualWalkthrough/BoundaryRing.js +8 -6
- package/components/VirtualWalkthrough/BoundaryWall.js +8 -6
- package/components/VirtualWalkthrough/CameraInfo.js +15 -13
- package/components/VirtualWalkthrough/ControlsInfoPane.js +59 -57
- package/components/VirtualWalkthrough/GradientSky.js +8 -6
- package/components/VirtualWalkthrough/SplatControls.js +37 -35
- package/components/VirtualWalkthrough/SplatCrop.js +6 -4
- package/components/VirtualWalkthrough/SplatFadeCrop.js +7 -5
- package/components/VirtualWalkthrough/SplatModel.js +17 -14
- package/components/VirtualWalkthrough/SplatRevealRain.js +6 -4
- package/components/VirtualWalkthrough/TfAnnotationManager.js +8 -5
- package/components/VirtualWalkthrough/TfXrNavigation.js +7 -5
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.js +47 -45
- package/components/VirtualWalkthrough/VrAnnotationPanel.js +9 -7
- package/components/VirtualWalkthrough/XrAnnotationInteraction.js +9 -7
- package/components/VirtualWalkthrough/XrExitButton.js +9 -7
- package/components/VirtualWalkthrough/XrGazeDwell.js +9 -7
- package/components/VirtualWalkthrough/XrPointerRay.js +9 -7
- package/components/VirtualWalkthrough/boundary-ring.js +7 -5
- package/components/VirtualWalkthrough/boundary-wall.js +8 -6
- package/components/VirtualWalkthrough/groundPlane.js +6 -3
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +5 -2
- package/components/VirtualWalkthrough/splatFormat.js +6 -4
- package/components/VirtualWalkthrough/vr-annotation-panel-layout.js +4 -2
- package/components/VirtualWalkthrough/vr-annotation-panel.js +8 -5
- package/components/VirtualWalkthrough/walkthrough-camera.js +6 -4
- package/components/VirtualWalkthrough/xr-annotation-candidates.js +8 -6
- package/components/VirtualWalkthrough/xr-annotation-interaction.js +9 -6
- package/components/VirtualWalkthrough/xr-annotation-targeting.js +5 -2
- package/components/VirtualWalkthrough/xr-button-arming.js +4 -2
- package/components/VirtualWalkthrough/xr-button-hold.js +5 -3
- package/components/VirtualWalkthrough/xr-exit-button.js +10 -8
- package/components/VirtualWalkthrough/xr-face-buttons.js +6 -4
- package/components/VirtualWalkthrough/xr-gaze-dwell-state.js +5 -3
- package/components/VirtualWalkthrough/xr-gaze-dwell.js +9 -7
- package/components/VirtualWalkthrough/xr-interactive-ui.js +10 -8
- package/components/VirtualWalkthrough/xr-pointer-ray.js +5 -3
- package/components/VirtualWalkthrough/xr-progress-pie.js +4 -2
- package/components/VirtualWalkthrough/xr-ray-quad.js +5 -2
- package/components/VirtualWalkthrough/xr-scene-bounds.js +5 -3
- package/components/VirtualWalkthrough/xr-teleport-gesture.js +4 -2
- package/components/svg/BlobbyGrayIconImage.js +13 -11
- package/components/svg/BlobbyGrayIconImport.js +13 -11
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +13 -11
- package/components/svg/BlobbyIconCloudChecked.js +41 -39
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +41 -39
- package/components/svg/BlobbyIconFolder.js +41 -39
- package/components/svg/BlobbyIconGraphReport.js +41 -39
- package/components/svg/BlobbyIconHappy.js +41 -39
- package/components/svg/BlobbyIconHeartMonitor.js +41 -39
- package/components/svg/BlobbyIconLeaf.js +41 -39
- package/components/svg/BlobbyIconLibrary.js +41 -39
- package/components/svg/BlobbyIconNursery.js +41 -39
- package/components/svg/BlobbyIconOrganization.js +41 -39
- package/components/svg/BlobbyIconParchment.js +41 -39
- package/components/svg/BlobbyIconPeople.js +41 -39
- package/components/svg/BlobbyIconSeedBank.js +41 -39
- package/components/svg/BlobbyIconSeedling.js +41 -39
- package/components/svg/BlobbyIconSeeds.js +41 -39
- package/components/svg/BlobbyIconSite.js +42 -40
- package/components/svg/BlobbyIconSparkles.js +41 -39
- package/components/svg/BlobbyIconWrench.js +41 -39
- package/components/svg/Bug.js +8 -6
- package/components/svg/Calendar.js +8 -6
- package/components/svg/CaretDown.js +8 -6
- package/components/svg/CaretLeft.js +8 -6
- package/components/svg/CaretRight.js +8 -6
- package/components/svg/CaretUp.js +8 -6
- package/components/svg/ChevronDown.js +8 -6
- package/components/svg/ChevronUp.js +8 -6
- package/components/svg/Close.js +8 -6
- package/components/svg/Critical.js +8 -6
- package/components/svg/Edit.js +41 -39
- package/components/svg/Error.js +8 -6
- package/components/svg/Filter.js +8 -6
- package/components/svg/Folder.js +8 -6
- package/components/svg/Help.js +8 -6
- package/components/svg/Home.js +8 -6
- package/components/svg/IconAdd.js +8 -6
- package/components/svg/IconArrowRight.js +8 -6
- package/components/svg/IconBusinessNetwork.js +8 -6
- package/components/svg/IconCalendar.js +8 -6
- package/components/svg/IconCancel.js +8 -6
- package/components/svg/IconChargingBattery.js +8 -6
- package/components/svg/IconChecklist.js +8 -6
- package/components/svg/IconCheckmark.js +8 -6
- package/components/svg/IconCoinInHand.js +8 -6
- package/components/svg/IconColumns.js +8 -6
- package/components/svg/IconComment.js +8 -6
- package/components/svg/IconDashboard.js +8 -6
- package/components/svg/IconDataMigration.js +8 -6
- package/components/svg/IconDocument.js +8 -6
- package/components/svg/IconDownloadFromTheCloud.js +8 -6
- package/components/svg/IconEdit.js +8 -6
- package/components/svg/IconExpand.js +8 -6
- package/components/svg/IconExport.js +8 -6
- package/components/svg/IconExternalLink.js +8 -6
- package/components/svg/IconEye.js +8 -6
- package/components/svg/IconEyeOff.js +8 -6
- package/components/svg/IconFile.js +8 -6
- package/components/svg/IconFolder.js +8 -6
- package/components/svg/IconFullScreen.js +8 -6
- package/components/svg/IconFutures.js +8 -6
- package/components/svg/IconGraphReport.js +8 -6
- package/components/svg/IconHeartMonitor.js +8 -6
- package/components/svg/IconHelp.js +8 -6
- package/components/svg/IconHistory.js +8 -6
- package/components/svg/IconImport.js +8 -6
- package/components/svg/IconIndex.js +8 -6
- package/components/svg/IconLayers.js +8 -6
- package/components/svg/IconLibrary.js +8 -6
- package/components/svg/IconList.js +8 -6
- package/components/svg/IconLivePlant.js +8 -6
- package/components/svg/IconLocations.js +8 -6
- package/components/svg/IconMail.js +8 -6
- package/components/svg/IconManager.js +8 -6
- package/components/svg/IconMarker.js +8 -6
- package/components/svg/IconMenu.js +8 -6
- package/components/svg/IconMenuHorizontal.js +8 -6
- package/components/svg/IconModule.js +8 -6
- package/components/svg/IconMyLocation.js +8 -6
- package/components/svg/IconNote.js +8 -6
- package/components/svg/IconNursery.js +8 -6
- package/components/svg/IconOrg.js +8 -6
- package/components/svg/IconParchment.js +8 -6
- package/components/svg/IconPhoto.js +8 -6
- package/components/svg/IconPlantsFilled.js +8 -6
- package/components/svg/IconRedo.js +8 -6
- package/components/svg/IconRestorationSite.js +8 -6
- package/components/svg/IconSeedBank.js +8 -6
- package/components/svg/IconSeedling.js +8 -6
- package/components/svg/IconSettings.js +8 -6
- package/components/svg/IconSlice.js +8 -6
- package/components/svg/IconSubmit.js +8 -6
- package/components/svg/IconSubtract.js +8 -6
- package/components/svg/IconSynced.js +8 -6
- package/components/svg/IconTrashCan.js +8 -6
- package/components/svg/IconTreasureMap.js +8 -6
- package/components/svg/IconUnavailable.js +8 -6
- package/components/svg/IconUndo.js +8 -6
- package/components/svg/IconVariable.js +8 -6
- package/components/svg/IconVideo.js +9 -7
- package/components/svg/IconWifi.js +8 -6
- package/components/svg/Info.js +8 -6
- package/components/svg/Key.js +8 -6
- package/components/svg/Leaf.js +8 -6
- package/components/svg/Lock.js +8 -6
- package/components/svg/Logo.js +16 -14
- package/components/svg/MenuVertical.js +8 -6
- package/components/svg/Notification.js +8 -6
- package/components/svg/Person.js +8 -6
- package/components/svg/Plus.js +8 -6
- package/components/svg/RestorationSite.js +8 -6
- package/components/svg/Search.js +8 -6
- package/components/svg/Seeds.js +8 -6
- package/components/svg/Site.js +8 -6
- package/components/svg/Sparkles.js +8 -6
- package/components/svg/Species.js +8 -6
- package/components/svg/Species2.js +41 -39
- package/components/svg/Spinner.js +16 -14
- package/components/svg/Star.js +8 -6
- package/components/svg/Success.js +8 -6
- package/components/svg/SuccessFilled.js +8 -6
- package/components/svg/TerrawareLogoDesktop.js +17 -15
- package/components/svg/TerrawareLogoMobile.js +9 -7
- package/components/svg/Touchscreen.js +8 -6
- package/components/svg/UploadCloud.js +41 -39
- package/components/svg/Warning.js +8 -6
- package/components/svg/WelcomeClipboard.js +32 -30
- package/components/svg/index.js +127 -127
- package/components/table/EnhancedTableToolbar.js +18 -15
- package/components/table/EnhancedTableToolbarV2.js +8 -6
- package/components/table/TableCellRenderer.js +37 -32
- package/components/table/TableHeader.js +17 -14
- package/components/table/TableHeaderItem.js +18 -15
- package/components/table/density.js +5 -3
- package/components/table/index.js +40 -37
- package/components/table/sort.js +6 -4
- package/components/table/types.js +1 -1
- package/components/types/index.js +1 -1
- package/hooks/useBoolean.js +4 -2
- package/hooks/useCameraPosition.js +5 -2
- package/hooks/useDevicePerformance.js +6 -3
- package/hooks/useXr.js +6 -4
- package/index.js +55 -58
- package/package.json +6 -2
- package/style-dictionary-dist/TerrawareTheme.js +2 -1
- package/theme.js +5 -2
- package/utils/color.js +5 -2
- package/utils/date.js +7 -6
- package/utils/index.js +4 -5
- package/utils/preventDefaultEvent.js +2 -1
- package/utils/text.js +3 -2
- package/utils/useDeviceInfo.js +2 -1
- package/virtualWalkthrough.js +23 -31
- package/components/Button/button.test.js +0 -23
- package/components/MultiSelect/MultiSelect.test.js +0 -73
- package/components/VirtualWalkthrough/TfXrNavigation.test.js +0 -110
- package/components/VirtualWalkthrough/boundary-ring.test.js +0 -109
- package/components/VirtualWalkthrough/boundary-wall.test.js +0 -203
- package/components/VirtualWalkthrough/groundPlane.test.js +0 -45
- package/components/VirtualWalkthrough/splatFormat.test.js +0 -51
- package/components/VirtualWalkthrough/vr-annotation-panel-layout.test.js +0 -26
- package/components/VirtualWalkthrough/xr-annotation-targeting.test.js +0 -66
- package/components/VirtualWalkthrough/xr-button-arming.test.js +0 -35
- package/components/VirtualWalkthrough/xr-button-hold.test.js +0 -57
- package/components/VirtualWalkthrough/xr-exit-button.test.js +0 -23
- package/components/VirtualWalkthrough/xr-face-buttons.test.js +0 -82
- package/components/VirtualWalkthrough/xr-gaze-dwell-state.test.js +0 -61
- package/components/VirtualWalkthrough/xr-interactive-ui.test.js +0 -165
- package/components/VirtualWalkthrough/xr-progress-pie.test.js +0 -79
- package/components/VirtualWalkthrough/xr-ray-quad.test.js +0 -37
- package/components/VirtualWalkthrough/xr-scene-bounds.test.js +0 -70
- package/components/VirtualWalkthrough/xr-teleport-gesture.test.js +0 -90
- package/components/table/sort.test.js +0 -35
- package/utils/date.test.js +0 -84
- package/utils/text.test.js +0 -21
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState, useMemo, useEffect, useCallback } from 'react';
|
|
2
2
|
import { useTheme } from '@mui/material';
|
|
3
3
|
import { Entity } from '@playcanvas/react';
|
|
4
4
|
import { Camera, Script } from '@playcanvas/react/components';
|
|
5
5
|
import { useApp } from '@playcanvas/react/hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { Vec3, Color } from 'playcanvas';
|
|
7
7
|
import { XrControllers } from 'playcanvas/scripts/esm/xr/xr-controllers.mjs';
|
|
8
|
-
import { useCameraPosition } from '../../hooks/useCameraPosition';
|
|
9
|
-
import { useDevicePerformance } from '../../hooks/useDevicePerformance';
|
|
10
|
-
import
|
|
11
|
-
import Annotation from './Annotation';
|
|
12
|
-
import AnnotationPanel from './AnnotationPanel';
|
|
13
|
-
import { AutoRotator } from './AutoRotator';
|
|
14
|
-
import BoundaryRing from './BoundaryRing';
|
|
15
|
-
import BoundaryWall from './BoundaryWall';
|
|
16
|
-
import GradientSky from './GradientSky';
|
|
17
|
-
import SplatControls from './SplatControls';
|
|
18
|
-
import SplatModel from './SplatModel';
|
|
19
|
-
import { TfAnnotationManager } from './TfAnnotationManager';
|
|
20
|
-
import { TfXrNavigation } from './TfXrNavigation';
|
|
21
|
-
import VrAnnotationPanel from './VrAnnotationPanel';
|
|
22
|
-
import XrAnnotationInteraction from './XrAnnotationInteraction';
|
|
23
|
-
import XrExitButton from './XrExitButton';
|
|
24
|
-
import XrGazeDwell from './XrGazeDwell';
|
|
25
|
-
import XrPointerRay from './XrPointerRay';
|
|
26
|
-
import { WalkthroughCamera } from './walkthrough-camera';
|
|
27
|
-
import { rayHitsInteractiveUi } from './xr-interactive-ui';
|
|
28
|
-
import { jsx
|
|
8
|
+
import { useCameraPosition } from '../../hooks/useCameraPosition.js';
|
|
9
|
+
import { useDevicePerformance } from '../../hooks/useDevicePerformance.js';
|
|
10
|
+
import useXr from '../../hooks/useXr.js';
|
|
11
|
+
import Annotation from './Annotation.js';
|
|
12
|
+
import AnnotationPanel from './AnnotationPanel.js';
|
|
13
|
+
import { AutoRotator } from './AutoRotator.js';
|
|
14
|
+
import BoundaryRing from './BoundaryRing.js';
|
|
15
|
+
import BoundaryWall from './BoundaryWall.js';
|
|
16
|
+
import GradientSky from './GradientSky.js';
|
|
17
|
+
import SplatControls from './SplatControls.js';
|
|
18
|
+
import SplatModel from './SplatModel.js';
|
|
19
|
+
import { TfAnnotationManager } from './TfAnnotationManager.js';
|
|
20
|
+
import { TfXrNavigation } from './TfXrNavigation.js';
|
|
21
|
+
import VrAnnotationPanel from './VrAnnotationPanel.js';
|
|
22
|
+
import XrAnnotationInteraction from './XrAnnotationInteraction.js';
|
|
23
|
+
import XrExitButton from './XrExitButton.js';
|
|
24
|
+
import XrGazeDwell from './XrGazeDwell.js';
|
|
25
|
+
import XrPointerRay from './XrPointerRay.js';
|
|
26
|
+
import { WalkthroughCamera } from './walkthrough-camera.js';
|
|
27
|
+
import { rayHitsInteractiveUi } from './xr-interactive-ui.js';
|
|
28
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
29
|
+
|
|
29
30
|
const DEFAULT_FOCUS_POINT = [0, 0.1, 0];
|
|
30
31
|
const DEFAULT_POSITION = [1, 0.1, 0];
|
|
31
32
|
|
|
@@ -227,25 +228,25 @@ const VirtualWalkthroughViewer = ({
|
|
|
227
228
|
images: files
|
|
228
229
|
}), [handleAnnotationUpdate]);
|
|
229
230
|
const canSave = useMemo(() => localAnnotations.every(annotation => annotation.title && annotation.title.trim() !== ''), [localAnnotations]);
|
|
230
|
-
const splatModel = useMemo(() => /*#__PURE__*/
|
|
231
|
+
const splatModel = useMemo(() => /*#__PURE__*/jsx(SplatModel, {
|
|
231
232
|
splatSrc: splatSrc,
|
|
232
233
|
splatFormat: splatFormat,
|
|
233
234
|
rotation: [-180, 0, 0],
|
|
234
235
|
revealRain: isHighPerformance
|
|
235
236
|
}, 'splat'), [isHighPerformance, splatSrc, splatFormat]);
|
|
236
|
-
return /*#__PURE__*/
|
|
237
|
-
children: [/*#__PURE__*/
|
|
237
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
238
|
+
children: [/*#__PURE__*/jsx(GradientSky, {
|
|
238
239
|
topColor: skyColor || '#FFFFFF',
|
|
239
240
|
horizonColor: skyColor || '#EAF8FF',
|
|
240
241
|
groundColor: groundColor || '#C3BDB7'
|
|
241
|
-
}), /*#__PURE__*/
|
|
242
|
+
}), /*#__PURE__*/jsxs(Entity, {
|
|
242
243
|
name: "camera-root",
|
|
243
|
-
children: [/*#__PURE__*/
|
|
244
|
+
children: [/*#__PURE__*/jsxs(Entity, {
|
|
244
245
|
name: "camera",
|
|
245
|
-
children: [/*#__PURE__*/
|
|
246
|
+
children: [/*#__PURE__*/jsx(Camera, {
|
|
246
247
|
clearColor: "#EAF8FF",
|
|
247
248
|
fov: 60
|
|
248
|
-
}), !isCurrentlyInXr && /*#__PURE__*/
|
|
249
|
+
}), !isCurrentlyInXr && /*#__PURE__*/jsx(Script, {
|
|
249
250
|
script: WalkthroughCamera,
|
|
250
251
|
boundsCenter: cameraBoundsCenter,
|
|
251
252
|
boundsRadius: sceneBoundsRadius * scaleFactor,
|
|
@@ -255,39 +256,39 @@ const VirtualWalkthroughViewer = ({
|
|
|
255
256
|
moveFastSpeed: 0.5 * scaleFactor,
|
|
256
257
|
moveSlowSpeed: 0.15 * scaleFactor
|
|
257
258
|
})]
|
|
258
|
-
}), /*#__PURE__*/
|
|
259
|
+
}), /*#__PURE__*/jsx(XrExitButton, {}), /*#__PURE__*/jsx(Script, {
|
|
259
260
|
script: XrControllers,
|
|
260
261
|
enabled: !isEdit
|
|
261
|
-
}), /*#__PURE__*/
|
|
262
|
+
}), /*#__PURE__*/jsx(XrAnnotationInteraction, {
|
|
262
263
|
onDismiss: handleCloseAnnotation
|
|
263
|
-
}), /*#__PURE__*/
|
|
264
|
+
}), /*#__PURE__*/jsx(XrPointerRay, {}), isCurrentlyInVr && viewingAnnotation && /*#__PURE__*/jsx(VrAnnotationPanel, {
|
|
264
265
|
annotation: viewingAnnotation,
|
|
265
266
|
annotationIndex: viewingAnnotationIndex,
|
|
266
267
|
scaleFactor: scaleFactor
|
|
267
|
-
}, viewingAnnotationIndex), isCurrentlyInXr && /*#__PURE__*/
|
|
268
|
+
}, viewingAnnotationIndex), isCurrentlyInXr && /*#__PURE__*/jsx(XrGazeDwell, {
|
|
268
269
|
activeIndex: viewingAnnotationIndex
|
|
269
|
-
}), /*#__PURE__*/
|
|
270
|
+
}), /*#__PURE__*/jsx(Script, {
|
|
270
271
|
script: TfXrNavigation,
|
|
271
272
|
enabled: !isEdit,
|
|
272
273
|
enableTeleport: !isCurrentlyInAr && !viewingAnnotation,
|
|
273
274
|
isTeleportBlocked: isTeleportBlocked
|
|
274
|
-
}), !isCurrentlyInXr && /*#__PURE__*/
|
|
275
|
+
}), !isCurrentlyInXr && /*#__PURE__*/jsx(Script, {
|
|
275
276
|
script: AutoRotator,
|
|
276
277
|
enabled: !isEdit && autoRotate && !viewingAnnotation,
|
|
277
278
|
startDelay: 0.5,
|
|
278
279
|
restartDelay: 3,
|
|
279
280
|
startFadeInTime: 0.5
|
|
280
281
|
})]
|
|
281
|
-
}), /*#__PURE__*/
|
|
282
|
+
}), /*#__PURE__*/jsxs(Entity, {
|
|
282
283
|
name: "content-root",
|
|
283
284
|
scale: [scaleFactor, scaleFactor, scaleFactor],
|
|
284
|
-
children: [splatModel, sceneBounds?.m !== undefined && groundPlane.length === 3 && /*#__PURE__*/
|
|
285
|
+
children: [splatModel, sceneBounds?.m !== undefined && groundPlane.length === 3 && /*#__PURE__*/jsx(BoundaryRing, {
|
|
285
286
|
center: sceneBoundsCenter,
|
|
286
287
|
radius: sceneBoundsRadius,
|
|
287
288
|
groundPlane: groundPlane
|
|
288
|
-
}), localAnnotations.length > 0 && /*#__PURE__*/
|
|
289
|
+
}), localAnnotations.length > 0 && /*#__PURE__*/jsxs(Entity, {
|
|
289
290
|
name: "annotations-root",
|
|
290
|
-
children: [/*#__PURE__*/
|
|
291
|
+
children: [/*#__PURE__*/jsx(Script, {
|
|
291
292
|
script: TfAnnotationManager,
|
|
292
293
|
enabled: true,
|
|
293
294
|
hotspotSize: 30,
|
|
@@ -296,7 +297,7 @@ const VirtualWalkthroughViewer = ({
|
|
|
296
297
|
hotspotColor: new Color().fromString(theme.palette.TwClrIcnBrand),
|
|
297
298
|
hoverColor: new Color().fromString('#ffffff'),
|
|
298
299
|
hotspotBackgroundColor: theme.palette.TwClrBaseWhite
|
|
299
|
-
}), localAnnotations.map((annotation, index) => /*#__PURE__*/
|
|
300
|
+
}), localAnnotations.map((annotation, index) => /*#__PURE__*/jsx(Annotation, {
|
|
300
301
|
...annotation,
|
|
301
302
|
index: index,
|
|
302
303
|
visible: showAnnotations,
|
|
@@ -309,12 +310,12 @@ const VirtualWalkthroughViewer = ({
|
|
|
309
310
|
onScreenPositionUpdate: handleAnnotationScreenPositionUpdate
|
|
310
311
|
}, `annotation-${index}`))]
|
|
311
312
|
})]
|
|
312
|
-
}), isCurrentlyInXr && sceneBoundsRadius > 0 && /*#__PURE__*/
|
|
313
|
+
}), isCurrentlyInXr && sceneBoundsRadius > 0 && /*#__PURE__*/jsx(BoundaryWall, {
|
|
313
314
|
center: cameraBoundsCenter,
|
|
314
315
|
radius: sceneBoundsRadius * scaleFactor + WALL_INSET,
|
|
315
316
|
groundPlane: cameraGroundPlane,
|
|
316
317
|
baseY: 0
|
|
317
|
-
}), /*#__PURE__*/
|
|
318
|
+
}), /*#__PURE__*/jsx(SplatControls, {
|
|
318
319
|
defaultCameraFocus: origin,
|
|
319
320
|
defaultCameraPosition: cameraPosition,
|
|
320
321
|
showAnnotations: showAnnotations,
|
|
@@ -343,11 +344,12 @@ const VirtualWalkthroughViewer = ({
|
|
|
343
344
|
onToggleFreeFly: handleToggleFreeFly,
|
|
344
345
|
showFreeFly: showFreeFly,
|
|
345
346
|
strings: strings
|
|
346
|
-
}), /*#__PURE__*/
|
|
347
|
+
}), /*#__PURE__*/jsx(AnnotationPanel, {
|
|
347
348
|
annotation: viewingAnnotation,
|
|
348
349
|
hotspotPosition: viewedScreenPos,
|
|
349
350
|
onClose: handleCloseAnnotation
|
|
350
351
|
})]
|
|
351
352
|
});
|
|
352
353
|
};
|
|
353
|
-
|
|
354
|
+
|
|
355
|
+
export { VirtualWalkthroughViewer as default };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { Entity } from '@playcanvas/react';
|
|
3
3
|
import { Script } from '@playcanvas/react/components';
|
|
4
|
-
import { VrAnnotationPanel as
|
|
5
|
-
import { jsx
|
|
4
|
+
import { VrAnnotationPanel as VrAnnotationPanel$1 } from './vr-annotation-panel.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
6
7
|
const VrAnnotationPanel = ({
|
|
7
8
|
annotation,
|
|
8
9
|
annotationIndex,
|
|
9
10
|
scaleFactor
|
|
10
|
-
}) => /*#__PURE__*/
|
|
11
|
+
}) => /*#__PURE__*/jsx(Entity, {
|
|
11
12
|
name: "vr-annotation-panel",
|
|
12
|
-
children: /*#__PURE__*/
|
|
13
|
-
script:
|
|
13
|
+
children: /*#__PURE__*/jsx(Script, {
|
|
14
|
+
script: VrAnnotationPanel$1,
|
|
14
15
|
title: annotation.title,
|
|
15
16
|
label: annotation.label,
|
|
16
17
|
bodyText: annotation.bodyText,
|
|
@@ -19,4 +20,5 @@ const VrAnnotationPanel = ({
|
|
|
19
20
|
scaleFactor: scaleFactor
|
|
20
21
|
})
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
export { VrAnnotationPanel as default };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { Entity } from '@playcanvas/react';
|
|
3
3
|
import { Script } from '@playcanvas/react/components';
|
|
4
|
-
import { XrAnnotationInteraction as
|
|
5
|
-
import { jsx
|
|
4
|
+
import { XrAnnotationInteraction as XrAnnotationInteraction$1 } from './xr-annotation-interaction.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
6
7
|
const XrAnnotationInteraction = ({
|
|
7
8
|
onDismiss
|
|
8
|
-
}) => /*#__PURE__*/
|
|
9
|
+
}) => /*#__PURE__*/jsx(Entity, {
|
|
9
10
|
name: "xr-annotation-interaction",
|
|
10
|
-
children: /*#__PURE__*/
|
|
11
|
-
script:
|
|
11
|
+
children: /*#__PURE__*/jsx(Script, {
|
|
12
|
+
script: XrAnnotationInteraction$1,
|
|
12
13
|
onDismissCallback: onDismiss
|
|
13
14
|
})
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
export { XrAnnotationInteraction as default };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { Entity } from '@playcanvas/react';
|
|
3
3
|
import { Script } from '@playcanvas/react/components';
|
|
4
|
-
import { XrExitButton as
|
|
5
|
-
import { jsx
|
|
6
|
-
|
|
4
|
+
import { XrExitButton as XrExitButton$1 } from './xr-exit-button.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const XrExitButton = () => /*#__PURE__*/jsx(Entity, {
|
|
7
8
|
name: "xr-exit-button",
|
|
8
|
-
children: /*#__PURE__*/
|
|
9
|
-
script:
|
|
9
|
+
children: /*#__PURE__*/jsx(Script, {
|
|
10
|
+
script: XrExitButton$1
|
|
10
11
|
})
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
export { XrExitButton as default };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { Entity } from '@playcanvas/react';
|
|
3
3
|
import { Script } from '@playcanvas/react/components';
|
|
4
|
-
import { XrGazeDwell as
|
|
5
|
-
import { jsx
|
|
4
|
+
import { XrGazeDwell as XrGazeDwell$1 } from './xr-gaze-dwell.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
6
7
|
const XrGazeDwell = ({
|
|
7
8
|
activeIndex
|
|
8
|
-
}) => /*#__PURE__*/
|
|
9
|
+
}) => /*#__PURE__*/jsx(Entity, {
|
|
9
10
|
name: "xr-gaze-dwell",
|
|
10
|
-
children: /*#__PURE__*/
|
|
11
|
-
script:
|
|
11
|
+
children: /*#__PURE__*/jsx(Script, {
|
|
12
|
+
script: XrGazeDwell$1,
|
|
12
13
|
activeIndex: activeIndex
|
|
13
14
|
})
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
export { XrGazeDwell as default };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
import { Entity } from '@playcanvas/react';
|
|
3
3
|
import { Script } from '@playcanvas/react/components';
|
|
4
|
-
import { DEFAULT_RAY_COLOR, XrPointerRay as
|
|
5
|
-
import { jsx
|
|
4
|
+
import { DEFAULT_RAY_COLOR, XrPointerRay as XrPointerRay$1 } from './xr-pointer-ray.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
6
7
|
const XrPointerRay = ({
|
|
7
8
|
color = DEFAULT_RAY_COLOR
|
|
8
|
-
}) => /*#__PURE__*/
|
|
9
|
+
}) => /*#__PURE__*/jsx(Entity, {
|
|
9
10
|
name: "xr-pointer-ray",
|
|
10
|
-
children: /*#__PURE__*/
|
|
11
|
-
script:
|
|
11
|
+
children: /*#__PURE__*/jsx(Script, {
|
|
12
|
+
script: XrPointerRay$1,
|
|
12
13
|
color: color
|
|
13
14
|
})
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
export { XrPointerRay as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computeGroundPlane, yOnPlane } from './groundPlane';
|
|
1
|
+
import { Script, Vec3, Color, StandardMaterial, CULLFACE_NONE, Mesh, MeshInstance, LAYERID_IMMEDIATE } from 'playcanvas';
|
|
2
|
+
import { computeGroundPlane, yOnPlane } from './groundPlane.js';
|
|
3
3
|
|
|
4
4
|
/** Flat-array triangle geometry ready for `Mesh.setPositions` / `Mesh.setIndices`. */
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ import { computeGroundPlane, yOnPlane } from './groundPlane';
|
|
|
9
9
|
* every vertex is sampled on the circle in XZ and lifted onto the plane via `yOnPlane`.
|
|
10
10
|
* Returns empty arrays when radius, width, or dashCount is non-positive, or the plane is invalid.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
const boundaryRingMesh = ({
|
|
13
13
|
center,
|
|
14
14
|
radius,
|
|
15
15
|
groundPlane,
|
|
@@ -59,7 +59,7 @@ export const boundaryRingMesh = ({
|
|
|
59
59
|
* center / radius / groundPlane are set imperatively by the BoundaryRing component (see BoundaryRing.tsx for why
|
|
60
60
|
* they are not reactive Script props), which calls `rebuild()` after updating them.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
class BoundaryRingScript extends Script {
|
|
63
63
|
static scriptName = 'boundaryRing';
|
|
64
64
|
center = new Vec3();
|
|
65
65
|
radius = 0;
|
|
@@ -122,4 +122,6 @@ export class BoundaryRingScript extends Script {
|
|
|
122
122
|
this._material?.destroy();
|
|
123
123
|
this._material = undefined;
|
|
124
124
|
}
|
|
125
|
-
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { BoundaryRingScript, boundaryRingMesh };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computeGroundPlane, yOnPlane } from './groundPlane';
|
|
3
|
-
import { distanceToCircleEdge } from './xr-scene-bounds';
|
|
1
|
+
import { Script, Vec3, Color, ShaderMaterial, SEMANTIC_TEXCOORD0, SEMANTIC_POSITION, BLEND_NORMAL, CULLFACE_NONE, Mesh, MeshInstance, LAYERID_IMMEDIATE } from 'playcanvas';
|
|
2
|
+
import { computeGroundPlane, yOnPlane } from './groundPlane.js';
|
|
3
|
+
import { distanceToCircleEdge } from './xr-scene-bounds.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Flat-array geometry ready for `Mesh.setPositions` / `Mesh.setUvs` / `Mesh.setIndices`, plus the
|
|
@@ -18,7 +18,7 @@ import { distanceToCircleEdge } from './xr-scene-bounds';
|
|
|
18
18
|
* circumference and v runs 0..rows up the wall — so the shader can draw a line at every whole number
|
|
19
19
|
* and have the seam at u = columns line up perfectly with u = 0.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const boundaryWallMesh = ({
|
|
22
22
|
center,
|
|
23
23
|
radius,
|
|
24
24
|
groundPlane,
|
|
@@ -182,7 +182,7 @@ const wallFragmentGLSL = /* glsl */`
|
|
|
182
182
|
* All of them are world-space: this entity is deliberately mounted outside `content-root`, which
|
|
183
183
|
* carries the scene's scaleFactor.
|
|
184
184
|
*/
|
|
185
|
-
|
|
185
|
+
class BoundaryWallScript extends Script {
|
|
186
186
|
static scriptName = 'boundaryWall';
|
|
187
187
|
center = new Vec3();
|
|
188
188
|
radius = 0;
|
|
@@ -328,4 +328,6 @@ export class BoundaryWallScript extends Script {
|
|
|
328
328
|
this._mesh = undefined;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export { BoundaryWallScript, boundaryWallMesh };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Vec3 } from 'playcanvas';
|
|
2
|
+
|
|
2
3
|
/** Compute Y on the plane defined by `normal` passing through `point` at world XZ coords (x, z). */
|
|
3
|
-
|
|
4
|
+
const yOnPlane = (x, z, normal, point, fallback) => {
|
|
4
5
|
if (Math.abs(normal.y) < 1e-6) {
|
|
5
6
|
return fallback;
|
|
6
7
|
}
|
|
@@ -12,7 +13,7 @@ export const yOnPlane = (x, z, normal, point, fallback) => {
|
|
|
12
13
|
* Returns a normalized normal (flipped so normal.y >= 0) and a point on the plane,
|
|
13
14
|
* or null when fewer than 3 points are supplied or they are degenerate/collinear.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
const computeGroundPlane = points => {
|
|
16
17
|
if (points.length < 3) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
@@ -44,4 +45,6 @@ export const computeGroundPlane = points => {
|
|
|
44
45
|
normal: new Vec3(nx, ny, nz),
|
|
45
46
|
point: new Vec3(p0.x, p0.y, p0.z)
|
|
46
47
|
};
|
|
47
|
-
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { computeGroundPlane, yOnPlane };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vec3 } from 'playcanvas';
|
|
2
2
|
import { GSplatShaderEffect } from 'playcanvas/scripts/esm/gsplat/gsplat-shader-effect.mjs';
|
|
3
|
+
|
|
3
4
|
const shaderGLSL = /* glsl */`
|
|
4
5
|
uniform vec3 uAabbMin;
|
|
5
6
|
uniform vec3 uAabbMax;
|
|
@@ -92,7 +93,7 @@ fn modifySplatColor(center: vec3f, color: ptr<function, vec4f>) {
|
|
|
92
93
|
* Applies a smooth fade to splats outside the AABB based on distance.
|
|
93
94
|
* Splats at the AABB edge are fully visible, and fade to invisible at fadeDistance away.
|
|
94
95
|
*/
|
|
95
|
-
|
|
96
|
+
class GsplatFadeCropShaderEffect extends GSplatShaderEffect {
|
|
96
97
|
static scriptName = 'gsplatFadeCropShaderEffect';
|
|
97
98
|
_aabbMinArray = [0, 0, 0];
|
|
98
99
|
_aabbMaxArray = [0, 0, 0];
|
|
@@ -116,4 +117,6 @@ export class GsplatFadeCropShaderEffect extends GSplatShaderEffect {
|
|
|
116
117
|
this.setUniform('uAabbMax', this._aabbMaxArray);
|
|
117
118
|
this.setUniform('uFadeDistance', this.fadeDistance);
|
|
118
119
|
}
|
|
119
|
-
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { GsplatFadeCropShaderEffect };
|
|
@@ -29,9 +29,9 @@ const LOADER_FILENAMES = {
|
|
|
29
29
|
* that existing extensionless splat URLs keep loading the way they did before the other formats were
|
|
30
30
|
* supported.
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const DEFAULT_SPLAT_FORMAT = 'sog';
|
|
33
|
+
const splatLoaderFilename = format => LOADER_FILENAMES[format];
|
|
34
|
+
const detectSplatFormat = splatSrc => {
|
|
35
35
|
const path = splatSrc.split(/[?#]/)[0];
|
|
36
36
|
const basename = path.slice(path.lastIndexOf('/') + 1).toLowerCase();
|
|
37
37
|
if (basename === 'lod-meta.json') {
|
|
@@ -47,4 +47,6 @@ export const detectSplatFormat = splatSrc => {
|
|
|
47
47
|
return 'sog';
|
|
48
48
|
}
|
|
49
49
|
return DEFAULT_SPLAT_FORMAT;
|
|
50
|
-
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { DEFAULT_SPLAT_FORMAT, detectSplatFormat, splatLoaderFilename };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Greedily wraps `text` into lines no wider than `maxWidth`, using `measure` to size
|
|
3
3
|
* each candidate line. A single word wider than `maxWidth` still gets its own line.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
const wrapText = (text, maxWidth, measure) => {
|
|
6
6
|
const words = text.split(/\s+/).filter(Boolean);
|
|
7
7
|
const lines = [];
|
|
8
8
|
let current = '';
|
|
@@ -19,4 +19,6 @@ export const wrapText = (text, maxWidth, measure) => {
|
|
|
19
19
|
lines.push(current);
|
|
20
20
|
}
|
|
21
21
|
return lines;
|
|
22
|
-
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { wrapText };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { wrapText } from './vr-annotation-panel-layout';
|
|
3
|
-
import { rayQuadHit } from './xr-ray-quad';
|
|
1
|
+
import { Vec3, Script, Quat, Texture, FILTER_LINEAR, ADDRESS_CLAMP_TO_EDGE, StandardMaterial, Color, BLEND_NORMAL, CULLFACE_NONE, MeshInstance, LAYERID_IMMEDIATE, Mesh } from 'playcanvas';
|
|
2
|
+
import { wrapText } from './vr-annotation-panel-layout.js';
|
|
3
|
+
import { rayQuadHit } from './xr-ray-quad.js';
|
|
4
|
+
|
|
4
5
|
const CANVAS_WIDTH = 1024;
|
|
5
6
|
const CANVAS_HEIGHT = 768;
|
|
6
7
|
|
|
@@ -26,7 +27,7 @@ const IMAGE_H = 360;
|
|
|
26
27
|
|
|
27
28
|
/** Width (canvas px) of the left/right arrow hit + draw zones over the image band. */
|
|
28
29
|
const ARROW_ZONE_W = 170;
|
|
29
|
-
|
|
30
|
+
class VrAnnotationPanel extends Script {
|
|
30
31
|
static scriptName = 'vrAnnotationPanel';
|
|
31
32
|
|
|
32
33
|
// Props assigned by the React wrapper.
|
|
@@ -309,4 +310,6 @@ export class VrAnnotationPanel extends Script {
|
|
|
309
310
|
this._material = undefined;
|
|
310
311
|
this._texture = undefined;
|
|
311
312
|
}
|
|
312
|
-
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export { VrAnnotationPanel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Quat,
|
|
2
|
-
import { computeGroundPlane, yOnPlane } from './groundPlane';
|
|
1
|
+
import { Quat, Vec3, Script, math } from 'playcanvas';
|
|
2
|
+
import { computeGroundPlane, yOnPlane } from './groundPlane.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* First-person walkthrough camera for Gaussian Splat scenes.
|
|
@@ -26,7 +26,7 @@ const ANGLE_EPSILON = 1e-3;
|
|
|
26
26
|
|
|
27
27
|
/** Below this positional delta (world units) an idle frame skips the transform write. */
|
|
28
28
|
const POSITION_EPSILON = 1e-5;
|
|
29
|
-
|
|
29
|
+
class WalkthroughCamera extends Script {
|
|
30
30
|
static scriptName = 'walkthroughCamera';
|
|
31
31
|
|
|
32
32
|
/** @attribute */
|
|
@@ -317,4 +317,6 @@ export class WalkthroughCamera extends Script {
|
|
|
317
317
|
this._removeListeners.forEach(fn => fn());
|
|
318
318
|
this._removeListeners = [];
|
|
319
319
|
}
|
|
320
|
-
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { WalkthroughCamera };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Vec3 } from 'playcanvas';
|
|
2
|
-
import { Annotation
|
|
2
|
+
import { Annotation } from 'playcanvas/scripts/esm/annotations.mjs';
|
|
3
3
|
|
|
4
4
|
/** Local half-extent of the unit-plane hotspot quad. */
|
|
5
|
-
|
|
5
|
+
const HOTSPOT_HALF_EXTENT = 0.5;
|
|
6
6
|
|
|
7
7
|
/** Multiplier on the hotspot's world radius to make controller targeting forgiving. */
|
|
8
|
-
|
|
8
|
+
const HIT_RADIUS_PAD = 2.5;
|
|
9
9
|
const scratchScale = new Vec3();
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -13,14 +13,14 @@ const scratchScale = new Vec3();
|
|
|
13
13
|
* annotation script (which carries `onVrOpenCallback`), its world position, and a hit-sphere
|
|
14
14
|
* radius derived from the hotspot's rendered world size, padded by `radiusPad` for easier aiming.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
const collectAnnotationHitCandidates = (app, radiusPad) => {
|
|
17
17
|
const root = app.root.findByName('annotations-root');
|
|
18
18
|
if (!root) {
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
21
21
|
return root.children.map(entity => ({
|
|
22
22
|
entity,
|
|
23
|
-
script: entity.script?.get(
|
|
23
|
+
script: entity.script?.get(Annotation.scriptName)
|
|
24
24
|
})).filter(({
|
|
25
25
|
script
|
|
26
26
|
}) => script && script.enabled !== false && typeof script.onVrOpenCallback === 'function').map(({
|
|
@@ -35,4 +35,6 @@ export const collectAnnotationHitCandidates = (app, radiusPad) => {
|
|
|
35
35
|
radius: HOTSPOT_HALF_EXTENT * scratchScale.x * radiusPad
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
|
-
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { HIT_RADIUS_PAD, HOTSPOT_HALF_EXTENT, collectAnnotationHitCandidates };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Script, XRTYPE_VR } from 'playcanvas';
|
|
2
|
-
import {
|
|
3
|
-
import { nearestAnnotationHit } from './xr-annotation-targeting';
|
|
4
|
-
import { FaceButtonPressTracker } from './xr-face-buttons';
|
|
5
|
-
import { rayHitsAnnotationPanel } from './xr-interactive-ui';
|
|
6
|
-
|
|
2
|
+
import { collectAnnotationHitCandidates, HIT_RADIUS_PAD } from './xr-annotation-candidates.js';
|
|
3
|
+
import { nearestAnnotationHit } from './xr-annotation-targeting.js';
|
|
4
|
+
import { FaceButtonPressTracker } from './xr-face-buttons.js';
|
|
5
|
+
import { rayHitsAnnotationPanel } from './xr-interactive-ui.js';
|
|
6
|
+
|
|
7
|
+
class XrAnnotationInteraction extends Script {
|
|
7
8
|
static scriptName = 'xrAnnotationInteraction';
|
|
8
9
|
_faceButtons = new FaceButtonPressTracker();
|
|
9
10
|
_isVrActive = () => this.app.xr?.active === true && this.app.xr?.type === XRTYPE_VR;
|
|
@@ -56,4 +57,6 @@ export class XrAnnotationInteraction extends Script {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { XrAnnotationInteraction };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Vec3 } from 'playcanvas';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Distance along a (normalized) ray to where it first enters the sphere, or null if it never does.
|
|
4
5
|
* A ray starting inside the sphere returns 0.
|
|
@@ -21,7 +22,7 @@ const raySphereEntryDistance = (origin, dir, center, radius) => {
|
|
|
21
22
|
/**
|
|
22
23
|
* Index of the closest candidate sphere the ray enters, or null if it hits none.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
const nearestAnnotationHit = (origin, direction, candidates) => {
|
|
25
26
|
const dir = direction.clone().normalize();
|
|
26
27
|
let bestIndex = null;
|
|
27
28
|
let bestDistance = Infinity;
|
|
@@ -33,4 +34,6 @@ export const nearestAnnotationHit = (origin, direction, candidates) => {
|
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
return bestIndex;
|
|
36
|
-
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { nearestAnnotationHit };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* another from arming and counting. Callers must poll every frame for every source they care
|
|
6
6
|
* about; a press and release between polls is missed.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
class ButtonArmingLatch {
|
|
9
9
|
_armed = new WeakSet();
|
|
10
10
|
|
|
11
11
|
/** Records one frame for `inputSource` and returns whether its current press may count. */
|
|
@@ -16,4 +16,6 @@ export class ButtonArmingLatch {
|
|
|
16
16
|
}
|
|
17
17
|
return this._armed.has(inputSource);
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ButtonArmingLatch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const INITIAL_HOLD_STATE = {
|
|
2
2
|
elapsed: 0,
|
|
3
3
|
armed: false
|
|
4
4
|
};
|
|
@@ -15,7 +15,7 @@ const RELEASED_STATE = {
|
|
|
15
15
|
* button would fire `threshold` seconds later. `justFired` is true only on the frame elapsed first
|
|
16
16
|
* reaches `threshold`, so continuing to hold fires once.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
const advanceHold = (prev, held, dt, threshold) => {
|
|
19
19
|
if (!held) {
|
|
20
20
|
return {
|
|
21
21
|
state: RELEASED_STATE,
|
|
@@ -40,4 +40,6 @@ export const advanceHold = (prev, held, dt, threshold) => {
|
|
|
40
40
|
progress: elapsed / threshold,
|
|
41
41
|
justFired
|
|
42
42
|
};
|
|
43
|
-
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { INITIAL_HOLD_STATE, advanceHold };
|