@terraware/web-components 4.2.13 → 4.2.14-rc.1
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 +8 -14
- package/components/Autocomplete/Autocomplete.js +67 -70
- package/components/Badge/index.js +16 -20
- package/components/BusySpinner/index.js +30 -35
- package/components/Button/Button.js +23 -27
- package/components/Button/button.test.js +8 -10
- package/components/Checkbox.js +10 -19
- package/components/Confirm/index.js +44 -51
- package/components/DatePicker/DatePicker.js +116 -117
- package/components/DialogBox/DialogBox.js +76 -66
- package/components/Divisor.js +15 -20
- package/components/Dropdown.js +54 -61
- package/components/EditableTable/index.js +129 -135
- package/components/ErrorBox/ErrorBox.js +37 -36
- package/components/FileChooser/index.js +73 -77
- package/components/FormBottomBar/index.js +63 -69
- package/components/Icon/Icon.js +14 -21
- package/components/Icon/icons/index.js +251 -257
- package/components/IconTooltip/index.js +29 -34
- package/components/Map/MapBox.js +199 -220
- package/components/Map/MapContainer.js +14 -18
- package/components/Map/MapDateSliderControl.js +44 -46
- package/components/Map/MapDrawer.js +32 -33
- package/components/Map/MapLegend.js +96 -95
- package/components/Map/MapViewStyleControl.js +38 -48
- package/components/Map/ReactMapboxWrapper.js +2 -9
- package/components/Map/index.js +47 -55
- package/components/Map/types.js +2 -8
- package/components/Map/useMaintainLayerOrder.js +4 -11
- package/components/Markdown/index.js +14 -21
- package/components/Message/Message.js +59 -51
- package/components/MultiSelect/MultiSelect.test.js +22 -24
- package/components/MultiSelect/index.js +73 -69
- package/components/Navbar/NavFooter.js +8 -13
- package/components/Navbar/NavItem.js +43 -37
- package/components/Navbar/NavSection.js +13 -17
- package/components/Navbar/Navbar.js +35 -38
- package/components/Navbar/SubNavbar.js +8 -13
- package/components/Note.js +14 -19
- package/components/OverlayModal/OverlayModal.js +36 -37
- package/components/PageForm/index.js +30 -35
- package/components/PhotoChooser/index.js +93 -98
- package/components/Pill/index.js +29 -31
- package/components/PillList/index.js +16 -22
- package/components/PlacementWrapper/index.js +20 -25
- package/components/PopoverMenu/Popover.js +33 -37
- package/components/PopoverMenu/index.js +41 -46
- package/components/PopoverMultiSelect/index.js +18 -21
- package/components/ProgressCircle/ProgressCircle.js +23 -26
- package/components/RadioButton.js +7 -14
- package/components/Select/Select.js +8 -13
- package/components/Select/SelectT.js +110 -108
- package/components/Separator/index.js +8 -14
- package/components/Size.js +1 -5
- package/components/Slider/index.js +7 -13
- package/components/SummaryBox.js +36 -39
- package/components/Tabs/index.js +75 -77
- package/components/TextTruncated/index.js +64 -65
- package/components/Textfield/Textfield.js +100 -95
- package/components/Textfield/TruncatedTextArea.js +44 -46
- package/components/TimelineSlider/TimelineMarker.js +24 -28
- package/components/TimelineSlider/TimelineRail.js +5 -11
- package/components/TimelineSlider/index.js +47 -51
- package/components/Tooltip/Tooltip.js +21 -26
- package/components/ViewPhotosDialog/index.js +58 -62
- package/components/VirtualWalkthrough/Annotation.d.ts +41 -0
- package/components/VirtualWalkthrough/Annotation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Annotation.js +197 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts +20 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.js +136 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts +13 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationPanel.js +196 -0
- package/components/VirtualWalkthrough/Application.d.ts +9 -0
- package/components/VirtualWalkthrough/Application.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Application.js +32 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts +109 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AutoRotator.js +217 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts +3 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BlockingSpinner.js +27 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts +9 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BoundaryRing.js +33 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts +16 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts.map +1 -0
- package/components/VirtualWalkthrough/CameraInfo.js +88 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts +37 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.js +196 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts +9 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts.map +1 -0
- package/components/VirtualWalkthrough/GradientSky.js +73 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts +50 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatControls.js +252 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts +15 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatModel.js +60 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts +18 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatRevealRain.js +38 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts +110 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.js +368 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts +15 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfXrNavigation.js +24 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.d.ts +27 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.d.ts.map +1 -0
- package/components/VirtualWalkthrough/VirtualWalkthroughViewer.js +282 -0
- package/components/VirtualWalkthrough/annotation-styles.css +5 -0
- package/components/VirtualWalkthrough/application-styles.css +4 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts +47 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts.map +1 -0
- package/components/VirtualWalkthrough/boundary-ring.js +125 -0
- package/components/VirtualWalkthrough/boundary-ring.test.js +109 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts +14 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/groundPlane.js +47 -0
- package/components/VirtualWalkthrough/groundPlane.test.js +45 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts +19 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts.map +1 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +119 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts +77 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts.map +1 -0
- package/components/VirtualWalkthrough/walkthrough-camera.js +320 -0
- package/components/svg/BlobbyGrayIconImage.js +36 -41
- package/components/svg/BlobbyGrayIconImport.js +36 -41
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +36 -41
- package/components/svg/BlobbyIconCloudChecked.js +161 -158
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +161 -158
- package/components/svg/BlobbyIconFolder.js +161 -158
- package/components/svg/BlobbyIconGraphReport.js +161 -158
- package/components/svg/BlobbyIconHappy.js +161 -158
- package/components/svg/BlobbyIconHeartMonitor.js +161 -158
- package/components/svg/BlobbyIconLeaf.js +161 -158
- package/components/svg/BlobbyIconLibrary.js +161 -158
- package/components/svg/BlobbyIconNursery.js +163 -160
- package/components/svg/BlobbyIconOrganization.js +161 -158
- package/components/svg/BlobbyIconParchment.js +161 -158
- package/components/svg/BlobbyIconPeople.js +161 -158
- package/components/svg/BlobbyIconSeedBank.js +161 -158
- package/components/svg/BlobbyIconSeedling.js +161 -158
- package/components/svg/BlobbyIconSeeds.js +161 -158
- package/components/svg/BlobbyIconSite.js +164 -161
- package/components/svg/BlobbyIconSparkles.js +161 -158
- package/components/svg/BlobbyIconWrench.js +161 -158
- package/components/svg/Bug.js +18 -27
- package/components/svg/Calendar.js +18 -27
- package/components/svg/CaretDown.js +18 -27
- package/components/svg/CaretLeft.js +18 -27
- package/components/svg/CaretRight.js +18 -27
- package/components/svg/CaretUp.js +18 -27
- package/components/svg/ChevronDown.js +18 -27
- package/components/svg/ChevronUp.js +18 -27
- package/components/svg/Close.js +18 -27
- package/components/svg/Critical.js +18 -27
- package/components/svg/Edit.js +161 -158
- package/components/svg/Error.js +18 -27
- package/components/svg/Filter.js +18 -27
- package/components/svg/Folder.js +18 -27
- package/components/svg/Help.js +18 -27
- package/components/svg/Home.js +18 -27
- package/components/svg/IconAdd.js +18 -27
- package/components/svg/IconArrowRight.js +19 -28
- package/components/svg/IconBusinessNetwork.js +18 -27
- package/components/svg/IconCalendar.js +18 -27
- package/components/svg/IconCancel.js +18 -27
- package/components/svg/IconChargingBattery.js +18 -27
- package/components/svg/IconChecklist.js +19 -28
- package/components/svg/IconCheckmark.js +18 -27
- package/components/svg/IconCoinInHand.js +18 -27
- package/components/svg/IconColumns.js +18 -27
- package/components/svg/IconComment.js +18 -27
- package/components/svg/IconDashboard.js +18 -27
- package/components/svg/IconDataMigration.js +18 -27
- package/components/svg/IconDocument.js +19 -28
- package/components/svg/IconDownloadFromTheCloud.js +19 -28
- package/components/svg/IconEdit.js +19 -28
- package/components/svg/IconExpand.js +19 -28
- package/components/svg/IconExport.js +18 -27
- package/components/svg/IconExternalLink.js +18 -27
- package/components/svg/IconEye.js +18 -27
- package/components/svg/IconEyeOff.js +18 -27
- package/components/svg/IconFile.js +18 -27
- package/components/svg/IconFolder.js +18 -27
- package/components/svg/IconFullScreen.js +18 -27
- package/components/svg/IconFutures.js +18 -27
- package/components/svg/IconGraphReport.js +18 -27
- package/components/svg/IconHeartMonitor.js +18 -27
- package/components/svg/IconHelp.js +19 -28
- package/components/svg/IconHistory.js +18 -27
- package/components/svg/IconImport.js +18 -27
- package/components/svg/IconIndex.js +18 -27
- package/components/svg/IconLayers.js +18 -27
- package/components/svg/IconLibrary.js +18 -27
- package/components/svg/IconList.js +18 -27
- package/components/svg/IconLivePlant.js +18 -27
- package/components/svg/IconLocations.js +18 -27
- package/components/svg/IconMail.js +18 -27
- package/components/svg/IconManager.js +18 -27
- package/components/svg/IconMarker.js +18 -27
- package/components/svg/IconMenu.js +18 -27
- package/components/svg/IconMenuHorizontal.js +18 -27
- package/components/svg/IconModule.js +18 -27
- package/components/svg/IconMyLocation.js +18 -27
- package/components/svg/IconNote.js +19 -28
- package/components/svg/IconNursery.js +18 -27
- package/components/svg/IconOrg.js +18 -27
- package/components/svg/IconParchment.js +18 -27
- package/components/svg/IconPhoto.js +18 -27
- package/components/svg/IconPlantsFilled.js +18 -27
- package/components/svg/IconRedo.js +18 -27
- package/components/svg/IconRestorationSite.js +18 -27
- package/components/svg/IconSeedBank.js +18 -27
- package/components/svg/IconSeedling.js +18 -27
- package/components/svg/IconSettings.js +18 -27
- package/components/svg/IconSlice.js +18 -27
- package/components/svg/IconSubmit.js +18 -27
- package/components/svg/IconSubtract.js +19 -28
- package/components/svg/IconSynced.js +18 -27
- package/components/svg/IconTrashCan.js +18 -27
- package/components/svg/IconTreasureMap.js +18 -27
- package/components/svg/IconUnavailable.js +18 -27
- package/components/svg/IconUndo.js +18 -27
- package/components/svg/IconVariable.js +18 -27
- package/components/svg/IconVideo.js +19 -28
- package/components/svg/IconWifi.js +18 -27
- package/components/svg/Info.js +18 -27
- package/components/svg/Key.js +18 -27
- package/components/svg/Leaf.js +18 -27
- package/components/svg/Lock.js +18 -27
- package/components/svg/Logo.js +40 -45
- package/components/svg/MenuVertical.js +18 -27
- package/components/svg/Notification.js +18 -27
- package/components/svg/Person.js +18 -27
- package/components/svg/Plus.js +18 -27
- package/components/svg/RestorationSite.js +18 -27
- package/components/svg/Search.js +18 -27
- package/components/svg/Seeds.js +18 -27
- package/components/svg/Site.js +18 -27
- package/components/svg/Sparkles.js +18 -27
- package/components/svg/Species.js +18 -27
- package/components/svg/Species2.js +161 -158
- package/components/svg/Spinner.js +27 -36
- package/components/svg/Star.js +18 -27
- package/components/svg/Success.js +18 -27
- package/components/svg/SuccessFilled.js +18 -27
- package/components/svg/TerrawareLogoDesktop.js +44 -49
- package/components/svg/TerrawareLogoMobile.js +20 -29
- package/components/svg/Touchscreen.js +18 -27
- package/components/svg/UploadCloud.js +161 -158
- package/components/svg/Warning.js +18 -27
- package/components/svg/WelcomeClipboard.js +130 -135
- package/components/svg/index.js +127 -895
- package/components/table/EnhancedTableToolbar.js +45 -47
- package/components/table/EnhancedTableToolbarV2.js +18 -26
- package/components/table/TableCellRenderer.js +137 -143
- package/components/table/TableHeader.js +45 -47
- package/components/table/TableHeaderItem.js +65 -64
- package/components/table/density.js +3 -11
- package/components/table/index.js +225 -218
- package/components/table/sort.js +8 -18
- package/components/table/sort.test.js +6 -8
- package/components/table/types.js +1 -5
- package/components/types/index.js +1 -5
- package/hooks/useBoolean.d.ts +4 -0
- package/hooks/useBoolean.d.ts.map +1 -0
- package/hooks/useBoolean.js +12 -0
- package/hooks/useCameraPosition.d.ts +8 -0
- package/hooks/useCameraPosition.d.ts.map +1 -0
- package/hooks/useCameraPosition.js +33 -0
- package/hooks/useDevicePerformance.d.ts +9 -0
- package/hooks/useDevicePerformance.d.ts.map +1 -0
- package/hooks/useDevicePerformance.js +16 -0
- package/index.js +57 -398
- package/license-report.html +1 -1
- package/package.json +10 -3
- package/style-dictionary-dist/TerrawareTheme.js +1 -7
- package/theme.js +7 -14
- package/utils/color.d.ts +2 -0
- package/utils/color.d.ts.map +1 -0
- package/utils/color.js +14 -0
- package/utils/date.js +13 -24
- package/utils/date.test.js +40 -43
- package/utils/index.js +5 -53
- package/utils/preventDefaultEvent.js +1 -7
- package/utils/text.js +2 -9
- package/utils/text.test.js +9 -11
- package/utils/useDeviceInfo.js +10 -16
- package/virtualWalkthrough.d.ts +34 -0
- package/virtualWalkthrough.d.ts.map +1 -0
- package/virtualWalkthrough.js +30 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Fullscreen, FullscreenExit } from '@mui/icons-material';
|
|
3
|
+
import { Box, IconButton, useTheme } from '@mui/material';
|
|
4
|
+
import { useApp } from '@playcanvas/react/hooks';
|
|
5
|
+
import { XRSPACE_LOCAL, XRTYPE_AR, XRTYPE_VR } from 'playcanvas';
|
|
6
|
+
import useBoolean from '../../hooks/useBoolean';
|
|
7
|
+
import { useCameraPosition } from '../../hooks/useCameraPosition';
|
|
8
|
+
import { getRgbaFromHex } from '../../utils/color';
|
|
9
|
+
import useDeviceInfo from '../../utils/useDeviceInfo';
|
|
10
|
+
import Button from '../Button/Button';
|
|
11
|
+
import Icon from '../Icon/Icon';
|
|
12
|
+
import AnnotationEditPane from './AnnotationEditPane';
|
|
13
|
+
import CameraInfo from './CameraInfo';
|
|
14
|
+
import ControlsInfoPane from './ControlsInfoPane';
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const SplatControls = ({
|
|
17
|
+
strings,
|
|
18
|
+
defaultCameraPosition,
|
|
19
|
+
defaultCameraFocus,
|
|
20
|
+
showAnnotations,
|
|
21
|
+
onToggleAnnotations,
|
|
22
|
+
autoRotate,
|
|
23
|
+
onToggleAutoRotate,
|
|
24
|
+
editable,
|
|
25
|
+
isEdit,
|
|
26
|
+
onToggleEdit,
|
|
27
|
+
onSave,
|
|
28
|
+
onCancel,
|
|
29
|
+
onAddAnnotation,
|
|
30
|
+
onDeleteAnnotation,
|
|
31
|
+
onDeselectAnnotation,
|
|
32
|
+
hasSelectedAnnotation,
|
|
33
|
+
selectedAnnotation,
|
|
34
|
+
onAnnotationUpdate,
|
|
35
|
+
onTextFieldFocus,
|
|
36
|
+
canSave = true,
|
|
37
|
+
isFullScreen = false,
|
|
38
|
+
onToggleFullScreen,
|
|
39
|
+
isFreeFly,
|
|
40
|
+
onToggleFreeFly,
|
|
41
|
+
showFreeFly = false,
|
|
42
|
+
onError
|
|
43
|
+
}) => {
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const {
|
|
46
|
+
isDesktop
|
|
47
|
+
} = useDeviceInfo();
|
|
48
|
+
const app = useApp();
|
|
49
|
+
const {
|
|
50
|
+
setCamera,
|
|
51
|
+
getCameraState
|
|
52
|
+
} = useCameraPosition();
|
|
53
|
+
const [isArAvailable, setIsArAvailable] = useState(false);
|
|
54
|
+
const [isVrAvailable, setIsVrAvailable] = useState(false);
|
|
55
|
+
const [isInfoVisible, setIsInfoVisible] = useBoolean(true);
|
|
56
|
+
const paneRef = useRef(null);
|
|
57
|
+
const infoButtonRef = useRef(null);
|
|
58
|
+
const errorCallback = useCallback(err => {
|
|
59
|
+
if (err) {
|
|
60
|
+
onError?.(err);
|
|
61
|
+
app.xr?.end();
|
|
62
|
+
}
|
|
63
|
+
}, [app, onError]);
|
|
64
|
+
const handleAr = useCallback(() => app.xr?.start(app.root.findComponent('camera'), XRTYPE_AR, XRSPACE_LOCAL, {
|
|
65
|
+
callback: errorCallback
|
|
66
|
+
}), [app, errorCallback]);
|
|
67
|
+
const handleVr = useCallback(() => app.xr?.start(app.root.findComponent('camera'), XRTYPE_VR, XRSPACE_LOCAL, {
|
|
68
|
+
callback: errorCallback
|
|
69
|
+
}), [app, errorCallback]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
// this can't be changed to `useMemo(() => app.xr?.isAvailable(XRTYPE_AR), [app])` because `app` doesn't update when
|
|
72
|
+
// XR's availability is updated
|
|
73
|
+
const handleAvailable = (type, available) => {
|
|
74
|
+
if (type === XRTYPE_VR) {
|
|
75
|
+
setIsVrAvailable(available);
|
|
76
|
+
} else if (type === XRTYPE_AR) {
|
|
77
|
+
setIsArAvailable(available);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Check current availability state on mount
|
|
82
|
+
if (app.xr?.isAvailable(XRTYPE_VR)) {
|
|
83
|
+
setIsVrAvailable(true);
|
|
84
|
+
}
|
|
85
|
+
if (app.xr?.isAvailable(XRTYPE_AR)) {
|
|
86
|
+
setIsArAvailable(true);
|
|
87
|
+
}
|
|
88
|
+
app.xr?.on('available', handleAvailable);
|
|
89
|
+
return () => {
|
|
90
|
+
app.xr?.off('available', handleAvailable);
|
|
91
|
+
};
|
|
92
|
+
}, [app]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const handleKeyPress = event => {
|
|
95
|
+
if (event.key === 'r' || event.key === 'R') {
|
|
96
|
+
if (defaultCameraFocus && !(isEdit && selectedAnnotation !== null)) {
|
|
97
|
+
setCamera(defaultCameraFocus, defaultCameraPosition);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
window.addEventListener('keydown', handleKeyPress);
|
|
102
|
+
return () => {
|
|
103
|
+
window.removeEventListener('keydown', handleKeyPress);
|
|
104
|
+
};
|
|
105
|
+
}, [isEdit, defaultCameraFocus, defaultCameraPosition, setCamera, selectedAnnotation]);
|
|
106
|
+
const handleInfo = useCallback(() => {
|
|
107
|
+
setIsInfoVisible(prev => !prev);
|
|
108
|
+
}, [setIsInfoVisible]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const handleScroll = event => {
|
|
111
|
+
if (isInfoVisible && paneRef.current && !paneRef.current.contains(event.target)) {
|
|
112
|
+
setIsInfoVisible(false);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const handleMouseDown = event => {
|
|
116
|
+
const target = event.target;
|
|
117
|
+
const isClickOnInfoButton = infoButtonRef.current?.contains(target);
|
|
118
|
+
if (isInfoVisible && paneRef.current && !paneRef.current.contains(target) && !isClickOnInfoButton) {
|
|
119
|
+
setIsInfoVisible(false);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
if (isInfoVisible) {
|
|
123
|
+
window.addEventListener('wheel', handleScroll, true);
|
|
124
|
+
window.addEventListener('mousedown', handleMouseDown, true);
|
|
125
|
+
}
|
|
126
|
+
return () => {
|
|
127
|
+
window.removeEventListener('wheel', handleScroll, true);
|
|
128
|
+
window.removeEventListener('mousedown', handleMouseDown, true);
|
|
129
|
+
};
|
|
130
|
+
}, [isInfoVisible, setIsInfoVisible, infoButtonRef]);
|
|
131
|
+
const handleEdit = useCallback(() => onToggleEdit?.(true), [onToggleEdit]);
|
|
132
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
133
|
+
sx: {
|
|
134
|
+
position: 'absolute',
|
|
135
|
+
top: 0,
|
|
136
|
+
left: 0,
|
|
137
|
+
right: 0,
|
|
138
|
+
height: '100%',
|
|
139
|
+
pointerEvents: 'none'
|
|
140
|
+
},
|
|
141
|
+
children: [isEdit && /*#__PURE__*/_jsxs(Box, {
|
|
142
|
+
sx: {
|
|
143
|
+
position: 'absolute',
|
|
144
|
+
top: 16,
|
|
145
|
+
left: '50%',
|
|
146
|
+
transform: 'translateX(-50%)',
|
|
147
|
+
display: 'flex',
|
|
148
|
+
gap: 1,
|
|
149
|
+
pointerEvents: 'auto'
|
|
150
|
+
},
|
|
151
|
+
children: [!hasSelectedAnnotation && onAddAnnotation && /*#__PURE__*/_jsx(Button, {
|
|
152
|
+
label: strings.addAnnotation,
|
|
153
|
+
onClick: onAddAnnotation
|
|
154
|
+
}), hasSelectedAnnotation && onDeselectAnnotation && /*#__PURE__*/_jsx(Button, {
|
|
155
|
+
label: strings.deselectAnnotation,
|
|
156
|
+
onClick: onDeselectAnnotation
|
|
157
|
+
}), hasSelectedAnnotation && onDeleteAnnotation && /*#__PURE__*/_jsx(Button, {
|
|
158
|
+
label: strings.deleteAnnotation,
|
|
159
|
+
onClick: onDeleteAnnotation
|
|
160
|
+
})]
|
|
161
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
162
|
+
sx: {
|
|
163
|
+
position: 'absolute',
|
|
164
|
+
bottom: 16,
|
|
165
|
+
left: '50%',
|
|
166
|
+
transform: 'translateX(-50%)',
|
|
167
|
+
display: 'flex',
|
|
168
|
+
gap: 1,
|
|
169
|
+
pointerEvents: 'auto'
|
|
170
|
+
},
|
|
171
|
+
children: [isArAvailable && !isEdit && /*#__PURE__*/_jsx(Button, {
|
|
172
|
+
label: strings.ar,
|
|
173
|
+
onClick: handleAr
|
|
174
|
+
}), isVrAvailable && !isEdit && /*#__PURE__*/_jsx(Button, {
|
|
175
|
+
label: strings.vr,
|
|
176
|
+
onClick: handleVr
|
|
177
|
+
}), isDesktop && editable && !isEdit && onToggleEdit && /*#__PURE__*/_jsx(Button, {
|
|
178
|
+
label: strings.edit,
|
|
179
|
+
onClick: handleEdit
|
|
180
|
+
}), isDesktop && showFreeFly && !isEdit && onToggleFreeFly && /*#__PURE__*/_jsx(Button, {
|
|
181
|
+
label: isFreeFly ? strings.boundedFly : strings.freeFly,
|
|
182
|
+
onClick: onToggleFreeFly
|
|
183
|
+
}), isEdit && onCancel && /*#__PURE__*/_jsx(Button, {
|
|
184
|
+
label: strings.cancel,
|
|
185
|
+
onClick: onCancel
|
|
186
|
+
}), isEdit && onSave && /*#__PURE__*/_jsx(Button, {
|
|
187
|
+
label: strings.save,
|
|
188
|
+
onClick: onSave,
|
|
189
|
+
disabled: !canSave
|
|
190
|
+
})]
|
|
191
|
+
}), onToggleFullScreen && /*#__PURE__*/_jsx(IconButton, {
|
|
192
|
+
sx: {
|
|
193
|
+
position: 'absolute',
|
|
194
|
+
bottom: 16,
|
|
195
|
+
right: 72,
|
|
196
|
+
backgroundColor: getRgbaFromHex(theme.palette.TwClrIcnOnBrand, 0.9),
|
|
197
|
+
'&:hover': {
|
|
198
|
+
backgroundColor: getRgbaFromHex(theme.palette.TwClrIcnOnBrand, 1)
|
|
199
|
+
},
|
|
200
|
+
pointerEvents: 'auto'
|
|
201
|
+
},
|
|
202
|
+
onClick: onToggleFullScreen,
|
|
203
|
+
"aria-label": isFullScreen ? 'Exit fullscreen' : 'Enter fullscreen',
|
|
204
|
+
children: isFullScreen ? /*#__PURE__*/_jsx(FullscreenExit, {
|
|
205
|
+
sx: {
|
|
206
|
+
color: theme.palette.TwClrIcnInfo
|
|
207
|
+
}
|
|
208
|
+
}) : /*#__PURE__*/_jsx(Fullscreen, {
|
|
209
|
+
sx: {
|
|
210
|
+
color: theme.palette.TwClrIcnInfo
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
214
|
+
ref: infoButtonRef,
|
|
215
|
+
sx: {
|
|
216
|
+
position: 'absolute',
|
|
217
|
+
bottom: 16,
|
|
218
|
+
right: 16,
|
|
219
|
+
backgroundColor: getRgbaFromHex(theme.palette.TwClrIcnOnBrand, 0.9),
|
|
220
|
+
'&:hover': {
|
|
221
|
+
backgroundColor: getRgbaFromHex(theme.palette.TwClrIcnOnBrand, 1)
|
|
222
|
+
},
|
|
223
|
+
pointerEvents: 'auto'
|
|
224
|
+
},
|
|
225
|
+
onClick: handleInfo,
|
|
226
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
227
|
+
name: "info",
|
|
228
|
+
size: 'medium',
|
|
229
|
+
fillColor: theme.palette.TwClrIcnInfo
|
|
230
|
+
})
|
|
231
|
+
}), /*#__PURE__*/_jsx(ControlsInfoPane, {
|
|
232
|
+
visible: isInfoVisible,
|
|
233
|
+
paneRef: paneRef,
|
|
234
|
+
strings: strings.controlsInfoPane,
|
|
235
|
+
showAnnotations: showAnnotations,
|
|
236
|
+
onToggleAnnotations: onToggleAnnotations,
|
|
237
|
+
autoRotate: autoRotate,
|
|
238
|
+
onToggleAutoRotate: onToggleAutoRotate,
|
|
239
|
+
isFullScreen: isFullScreen
|
|
240
|
+
}), /*#__PURE__*/_jsx(AnnotationEditPane, {
|
|
241
|
+
visible: isEdit === true && hasSelectedAnnotation === true,
|
|
242
|
+
annotation: selectedAnnotation ?? null,
|
|
243
|
+
strings: strings.annotationEditPane,
|
|
244
|
+
onUpdate: onAnnotationUpdate,
|
|
245
|
+
onTextFieldFocus: onTextFieldFocus
|
|
246
|
+
}), isEdit && /*#__PURE__*/_jsx(CameraInfo, {
|
|
247
|
+
strings: strings.cameraInfo,
|
|
248
|
+
getCameraState: getCameraState
|
|
249
|
+
})]
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
export default SplatControls;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SplatCropProps {
|
|
2
|
+
aabbMin?: [number, number, number];
|
|
3
|
+
aabbMax?: [number, number, number];
|
|
4
|
+
edgeScaleFactor?: number;
|
|
5
|
+
}
|
|
6
|
+
declare const SplatCrop: ({ aabbMin, aabbMax, edgeScaleFactor }: SplatCropProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SplatCrop;
|
|
8
|
+
//# sourceMappingURL=SplatCrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplatCrop.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/SplatCrop.tsx"],"names":[],"mappings":"AAMA,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,QAAA,MAAM,SAAS,GAAI,uCAAwE,cAAc,4CASxG,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Script } from '@playcanvas/react/components';
|
|
3
|
+
import { Vec3 } from 'playcanvas';
|
|
4
|
+
import { GsplatCropShaderEffect } from 'playcanvas/scripts/esm/gsplat/shader-effect-crop.mjs';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const SplatCrop = ({
|
|
7
|
+
aabbMin = [-1, -1, -1],
|
|
8
|
+
aabbMax = [1, 1, 1],
|
|
9
|
+
edgeScaleFactor = 0.5
|
|
10
|
+
}) => {
|
|
11
|
+
return /*#__PURE__*/_jsx(Script, {
|
|
12
|
+
script: GsplatCropShaderEffect,
|
|
13
|
+
aabbMin: new Vec3(...aabbMin),
|
|
14
|
+
aabbMax: new Vec3(...aabbMax),
|
|
15
|
+
edgeScaleFactor: edgeScaleFactor
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default SplatCrop;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface SplatFadeCropProps {
|
|
2
|
+
aabbMin?: [number, number, number];
|
|
3
|
+
aabbMax?: [number, number, number];
|
|
4
|
+
fadeDistance?: number;
|
|
5
|
+
}
|
|
6
|
+
declare const SplatFadeCrop: ({ aabbMin, aabbMax, fadeDistance }: SplatFadeCropProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SplatFadeCrop;
|
|
8
|
+
//# sourceMappingURL=SplatFadeCrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplatFadeCrop.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/SplatFadeCrop.tsx"],"names":[],"mappings":"AAOA,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,aAAa,GAAI,oCAAqE,kBAAkB,4CAS7G,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Script } from '@playcanvas/react/components';
|
|
3
|
+
import { Vec3 } from 'playcanvas';
|
|
4
|
+
import { GsplatFadeCropShaderEffect } from './gsplat-fade-crop-effect';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const SplatFadeCrop = ({
|
|
7
|
+
aabbMin = [-1, -1, -1],
|
|
8
|
+
aabbMax = [1, 1, 1],
|
|
9
|
+
fadeDistance = 0.5
|
|
10
|
+
}) => {
|
|
11
|
+
return /*#__PURE__*/_jsx(Script, {
|
|
12
|
+
script: GsplatFadeCropShaderEffect,
|
|
13
|
+
aabbMin: new Vec3(...aabbMin),
|
|
14
|
+
aabbMax: new Vec3(...aabbMax),
|
|
15
|
+
fadeDistance: fadeDistance
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default SplatFadeCrop;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SplatModelProps {
|
|
3
|
+
splatSrc: string;
|
|
4
|
+
rotation?: [number, number, number];
|
|
5
|
+
cropAabbMin?: [number, number, number];
|
|
6
|
+
cropAabbMax?: [number, number, number];
|
|
7
|
+
cropEdgeScaleFactor?: number;
|
|
8
|
+
cropFade?: boolean;
|
|
9
|
+
cropFadeDistance?: number;
|
|
10
|
+
revealRain?: boolean;
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ splatSrc, rotation, cropAabbMin, cropAabbMax, cropEdgeScaleFactor, cropFade, cropFadeDistance, revealRain, onError, }: SplatModelProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=SplatModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplatModel.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/SplatModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAW/C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;4KAYE,eAAe;AAgClB,wBAAgC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { memo, useEffect } from 'react';
|
|
2
|
+
import { Entity } from '@playcanvas/react';
|
|
3
|
+
import { GSplat } from '@playcanvas/react/components';
|
|
4
|
+
import { useSplat } from '@playcanvas/react/hooks';
|
|
5
|
+
import BlockingSpinner from './BlockingSpinner';
|
|
6
|
+
import SplatCrop from './SplatCrop';
|
|
7
|
+
import SplatFadeCrop from './SplatFadeCrop';
|
|
8
|
+
import SplatRevealRain from './SplatRevealRain';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const SplatModel = ({
|
|
11
|
+
splatSrc,
|
|
12
|
+
rotation,
|
|
13
|
+
cropAabbMin,
|
|
14
|
+
cropAabbMax,
|
|
15
|
+
cropEdgeScaleFactor,
|
|
16
|
+
cropFade = false,
|
|
17
|
+
cropFadeDistance = 0.5,
|
|
18
|
+
revealRain = false,
|
|
19
|
+
onError
|
|
20
|
+
}) => {
|
|
21
|
+
// A filename is required for the file props to assist with the asset loading. Otherwise it assumes that the splatSrc is a ply file.
|
|
22
|
+
const {
|
|
23
|
+
asset,
|
|
24
|
+
loading,
|
|
25
|
+
error
|
|
26
|
+
} = useSplat(splatSrc, {
|
|
27
|
+
file: {
|
|
28
|
+
filename: 'model.sog'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (error) {
|
|
33
|
+
onError?.(new Error(error));
|
|
34
|
+
}
|
|
35
|
+
}, [error, onError]);
|
|
36
|
+
if (loading) {
|
|
37
|
+
return /*#__PURE__*/_jsx(BlockingSpinner, {});
|
|
38
|
+
}
|
|
39
|
+
if (!asset) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/_jsxs(Entity, {
|
|
43
|
+
name: "splat",
|
|
44
|
+
rotation: rotation,
|
|
45
|
+
children: [/*#__PURE__*/_jsx(GSplat, {
|
|
46
|
+
asset: asset
|
|
47
|
+
}), (cropAabbMin || cropAabbMax) && (cropFade ? /*#__PURE__*/_jsx(SplatFadeCrop, {
|
|
48
|
+
aabbMin: cropAabbMin,
|
|
49
|
+
aabbMax: cropAabbMax,
|
|
50
|
+
fadeDistance: cropFadeDistance
|
|
51
|
+
}) : /*#__PURE__*/_jsx(SplatCrop, {
|
|
52
|
+
aabbMin: cropAabbMin,
|
|
53
|
+
aabbMax: cropAabbMax,
|
|
54
|
+
edgeScaleFactor: cropEdgeScaleFactor
|
|
55
|
+
})), /*#__PURE__*/_jsx(SplatRevealRain, {
|
|
56
|
+
enabled: revealRain
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export default /*#__PURE__*/memo(SplatModel);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface SplatRevealRainProps {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
center?: [number, number, number];
|
|
4
|
+
distance?: number;
|
|
5
|
+
speed?: number;
|
|
6
|
+
acceleration?: number;
|
|
7
|
+
flightTime?: number;
|
|
8
|
+
rainSize?: number;
|
|
9
|
+
rotation?: number;
|
|
10
|
+
fallTint?: [number, number, number];
|
|
11
|
+
fallTintIntensity?: number;
|
|
12
|
+
hitTint?: [number, number, number];
|
|
13
|
+
hitDuration?: number;
|
|
14
|
+
endRadius?: number;
|
|
15
|
+
}
|
|
16
|
+
declare const SplatRevealRain: ({ enabled, center, distance, speed, acceleration, flightTime, rainSize, rotation, fallTint, fallTintIntensity, hitTint, hitDuration, endRadius, }: SplatRevealRainProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default SplatRevealRain;
|
|
18
|
+
//# sourceMappingURL=SplatRevealRain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplatRevealRain.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/SplatRevealRain.tsx"],"names":[],"mappings":"AAMA,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,eAAe,GAAI,mJActB,oBAAoB,4CAmBtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Script } from '@playcanvas/react/components';
|
|
3
|
+
import { Color, Vec3 } from 'playcanvas';
|
|
4
|
+
import { GsplatRevealRain } from 'playcanvas/scripts/esm/gsplat/reveal-rain.mjs';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const SplatRevealRain = ({
|
|
7
|
+
enabled = true,
|
|
8
|
+
center = [0, 0, 0],
|
|
9
|
+
distance = 3,
|
|
10
|
+
speed = 10,
|
|
11
|
+
acceleration = 5,
|
|
12
|
+
flightTime = 0.25,
|
|
13
|
+
rainSize = 0.0,
|
|
14
|
+
rotation = 0,
|
|
15
|
+
fallTint = [0, 0, 0],
|
|
16
|
+
fallTintIntensity = 0,
|
|
17
|
+
hitTint = [0, 0, 0],
|
|
18
|
+
hitDuration = 0,
|
|
19
|
+
endRadius = 5
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/_jsx(Script, {
|
|
22
|
+
script: GsplatRevealRain,
|
|
23
|
+
enabled: enabled,
|
|
24
|
+
center: new Vec3(...center),
|
|
25
|
+
distance: distance,
|
|
26
|
+
speed: speed,
|
|
27
|
+
acceleration: acceleration,
|
|
28
|
+
flightTime: flightTime,
|
|
29
|
+
rainSize: rainSize,
|
|
30
|
+
rotation: rotation,
|
|
31
|
+
fallTint: new Color(...fallTint),
|
|
32
|
+
fallTintIntensity: fallTintIntensity,
|
|
33
|
+
hitTint: new Color(...hitTint),
|
|
34
|
+
hitDuration: hitDuration,
|
|
35
|
+
endRadius: endRadius
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default SplatRevealRain;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Texture } from 'playcanvas';
|
|
2
|
+
import { AnnotationManager as PcAnnotationManager } from 'playcanvas/scripts/esm/annotations.mjs';
|
|
3
|
+
import { AnnotationIconType } from './Annotation';
|
|
4
|
+
/**
|
|
5
|
+
* Extended AnnotationManager that adds max size clamping for annotations
|
|
6
|
+
* and fixes positioning when canvas is not at document origin.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TfAnnotationManager extends PcAnnotationManager {
|
|
9
|
+
static scriptName: string;
|
|
10
|
+
private _maxWorldSize;
|
|
11
|
+
private _customParentDom;
|
|
12
|
+
private _clickHandlersAttached;
|
|
13
|
+
private _hotspotBackgroundColor;
|
|
14
|
+
private _iconImages;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum world-space size for annotations.
|
|
17
|
+
* This prevents annotations from growing beyond this size regardless of camera distance.
|
|
18
|
+
*
|
|
19
|
+
* @attribute
|
|
20
|
+
* @title Max World Size
|
|
21
|
+
* @type {number}
|
|
22
|
+
* @default 1.0
|
|
23
|
+
*/
|
|
24
|
+
set maxWorldSize(value: number);
|
|
25
|
+
get maxWorldSize(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Background color for the hotspot texture canvas (the circle fill color).
|
|
28
|
+
* This is a hex color string (e.g., '#2C8658') that's drawn on the texture canvas.
|
|
29
|
+
* Note: This is different from hotspotColor and hoverColor, which are PlayCanvas Color objects
|
|
30
|
+
* used for the material's emissive property.
|
|
31
|
+
*
|
|
32
|
+
* @attribute
|
|
33
|
+
* @title Hotspot Background Color
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @default '#2C8658'
|
|
36
|
+
*/
|
|
37
|
+
set hotspotBackgroundColor(value: string);
|
|
38
|
+
get hotspotBackgroundColor(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Initialize with custom parent DOM if needed.
|
|
41
|
+
*/
|
|
42
|
+
initialize(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Renders each web-components icon to an SVG image once. When an image finishes
|
|
45
|
+
* loading, any annotations already using that icon are redrawn.
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
_loadIconImages(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Redraws the texture for all annotations using the given icon, once its image
|
|
51
|
+
* has loaded.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
_refreshIcon(iconType: AnnotationIconType): void;
|
|
55
|
+
/**
|
|
56
|
+
* Update loop to attach click handlers to annotations and manage visibility.
|
|
57
|
+
*/
|
|
58
|
+
update(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Override annotation registration to draw the media icon onto the hotspot
|
|
61
|
+
* texture once the annotation (and its icon) is available.
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
_registerAnnotation(annotation: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Recreates the hotspot texture with the appropriate media icon drawn on it.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
_applyAnnotationIcon(annotation: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* Draws the icon image onto the hotspot texture canvas, scaled to fit the
|
|
72
|
+
* circle. Does nothing if the image has not finished loading yet; the
|
|
73
|
+
* annotation is redrawn once it has (see `_refreshIcon`).
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
_drawIcon(ctx: CanvasRenderingContext2D, icon: AnnotationIconType, size: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Keep the media icon drawn on the hotspot texture. The label text itself
|
|
79
|
+
* is not rendered on the hotspot, so we simply redraw with the icon.
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
_onLabelChange(annotation: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* The hotspot colors are baked into the texture in `_createHotspotTexture`,
|
|
85
|
+
* so the material emissive is kept white to let those colors render as drawn.
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
_createHotspotMaterial(texture: any, options?: any): any;
|
|
89
|
+
_setAnnotationHover(_annotation: any, _hover: boolean): void;
|
|
90
|
+
_updateAllAnnotationColors(): void;
|
|
91
|
+
_showTooltip(_annotation: any): void;
|
|
92
|
+
_onTextChange(_annotation: any, _text: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Override position update to adjust for canvas offset and respect visibility.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
_updateAnnotationPositions(annotation: any, resources: any, screenPos: any): void;
|
|
98
|
+
/**
|
|
99
|
+
* Override the scale update to clamp the world size to a maximum value.
|
|
100
|
+
* Also scales the hotspot DOM element to match.
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
_updateAnnotationRotationAndScale(annotation: any): void;
|
|
104
|
+
/**
|
|
105
|
+
* Override to create hotspot texture with custom background color.
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
_createHotspotTexture(label: string, size?: number, borderWidth?: number, icon?: AnnotationIconType): Texture;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=TfAnnotationManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TfAnnotationManager.d.ts","sourceRoot":"","sources":["../../../src/components/VirtualWalkthrough/TfAnnotationManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoC,OAAO,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAIlG,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAelD;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC1D,MAAM,CAAC,UAAU,SAAyB;IAE1C,OAAO,CAAC,aAAa,CAAO;IAC5B,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,sBAAsB,CAAkB;IAChD,OAAO,CAAC,uBAAuB,CAAa;IAC5C,OAAO,CAAC,WAAW,CAAmD;IAEtE;;;;;;;;OAQG;IACH,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAE7B;IAED,IAAI,YAAY,IAJQ,MAAM,CAM7B;IAED;;;;;;;;;;OAUG;IACH,IAAI,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAEvC;IAED,IAAI,sBAAsB,IAJQ,MAAM,CAMvC;IAED;;OAEG;IACH,UAAU;IAgBV;;;;OAIG;IACH,eAAe;IAiBf;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,kBAAkB;IAazC;;OAEG;IACH,MAAM;IAmCN;;;;OAIG;IACH,mBAAmB,CAAC,UAAU,EAAE,GAAG;IAKnC;;;OAGG;IACH,oBAAoB,CAAC,UAAU,EAAE,GAAG;IAiBpC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,wBAAwB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM;IAW/E;;;;OAIG;IACH,cAAc,CAAC,UAAU,EAAE,GAAG;IAI9B;;;;OAIG;IACH,sBAAsB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG;IASlD,mBAAmB,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO;IAKrD,0BAA0B;IAK1B,YAAY,CAAC,WAAW,EAAE,GAAG;IAK7B,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM;IAI7C;;;OAGG;IACH,0BAA0B,CAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IA6B1E;;;;OAIG;IACH,iCAAiC,CAAC,UAAU,EAAE,GAAG;IAmCjD;;;OAGG;IACH,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAuB,EAAE,WAAW,SAAI,EAAE,IAAI,CAAC,EAAE,kBAAkB;CAyD7G"}
|