@3cr/viewer-browser 0.0.248 → 0.0.293
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/.circleci/config.yml +53 -0
- package/README.md +79 -74
- package/components.d.ts +94 -36
- package/dist/Viewer3CR.js +663 -47
- package/dist/Viewer3CR.mjs +107687 -36565
- package/dist/Viewer3CR.umd.js +663 -47
- package/index.html +35 -33
- package/package.json +27 -8
- package/playground/img.png +0 -0
- package/playground/index.html +6 -2
- package/src/App.vue +41 -97
- package/src/__tests__/app.spec.ts +2 -1
- package/src/__tests__/main.spec.ts +14 -14
- package/src/assets/_palette.scss +112 -0
- package/src/assets/_settings.scss +64 -0
- package/src/assets/_typography.scss +187 -0
- package/src/assets/images/cloud-storage.svg +22 -0
- package/src/assets/images/courtney.png +0 -0
- package/src/assets/images/dark/magic-wand.svg +32 -0
- package/src/assets/images/dark-theme.svg +33 -0
- package/src/assets/images/dot.svg +5 -0
- package/src/assets/images/dr-miles.png +0 -0
- package/src/assets/images/illustration.svg +118 -0
- package/src/assets/images/intro.svg +30 -0
- package/src/assets/{magic_wand.svg → images/light/magic-wand.svg} +22 -14
- package/src/assets/images/light-theme.svg +33 -0
- package/src/assets/images/system-theme.svg +51 -0
- package/src/assets/images/totalSegmentator.png +0 -0
- package/src/assets/logos/3dicom/black/black.svg +30 -0
- package/src/assets/logos/3dicom/colour/colour.svg +18 -0
- package/src/assets/logos/3dicom/colour/colour_single.svg +18 -0
- package/src/assets/logos/3dicom/wordmark/patients/patients.svg +29 -0
- package/src/assets/logos/3dicom/wordmark/powered-by/powered-by.svg +41 -0
- package/src/assets/logos/3dicom/wordmark/practitioners/practitioner.svg +34 -0
- package/src/assets/logos/3dicom/wordmark/research/research.svg +29 -0
- package/src/assets/logos/license/black/black.svg +22 -0
- package/src/assets/logos/license/white/white.svg +22 -0
- package/src/assets/styles.scss +435 -12
- package/src/components/ShFlatIconBtn.vue +36 -0
- package/src/components/ShPlainIconBtn.vue +42 -0
- package/src/components/ShSelect.vue +48 -0
- package/src/components/ShTextField.vue +39 -0
- package/src/components/ShTextarea.vue +39 -0
- package/src/components/__tests__/ShFlatIconBtn.spec.ts +32 -0
- package/src/components/__tests__/ShPlainIconBtn.spec.ts +37 -0
- package/src/components/__tests__/ShSelect.spec.ts +30 -0
- package/src/components/__tests__/ShTextField.spec.ts +30 -0
- package/src/components/__tests__/ShTextarea.spec.ts +30 -0
- package/src/components/demo/CloudDropZone.vue +105 -0
- package/src/components/demo/DemoAvatarDropdownMenu.vue +343 -0
- package/src/components/demo/DemoInfoModal.vue +60 -0
- package/src/components/demo/DemoNotificationNavigationDrawer.vue +118 -0
- package/src/components/demo/DemoPurchaseCreditsModal.vue +141 -0
- package/src/components/demo/DemoUpgradeCloudStorageModal.vue +74 -0
- package/src/components/demo/DemoUpgradePlanModal.vue +17 -0
- package/src/components/demo/UploadDicomToCloudModal.vue +225 -0
- package/src/components/demo/__tests__/CloudDropZone.spec.ts +132 -0
- package/src/components/demo/__tests__/DemoAvatarDropdownMenu.spec.ts +16 -0
- package/src/components/demo/{licence/__tests__/DemoLicenceEnableCloudStorageModal.spec.ts → __tests__/DemoEnableCloudStorageModal.spec.ts} +11 -11
- package/src/components/demo/{licence/__tests__/DemoLicenceInfoModal.spec.ts → __tests__/DemoInfoModal.spec.ts} +11 -8
- package/src/components/demo/__tests__/DemoNotificationNavigationDrawer.spec.ts +56 -0
- package/src/components/demo/__tests__/UploadDicomToCloudModal.spec.ts +320 -0
- package/src/components/demo/__tests__/demo-payload.spec.ts +10 -0
- package/src/components/demo/demo-notifications.ts +45 -0
- package/src/components/demo/demo-payload.ts +9 -0
- package/src/components/demo/fileReader.ts +47 -0
- package/src/{composables/useViewerOptions.ts → components/demo/mockDemoViewerStlDecimator.ts} +8 -12
- package/src/components/intro/ViewerIntro.vue +56 -0
- package/src/components/intro/ViewerTour.vue +53 -0
- package/src/components/intro/tour/Tour.vue +205 -0
- package/src/components/intro/tour/step.ts +6 -0
- package/src/components/modal/ActionRail.vue +4 -0
- package/src/components/modal/Viewer3cr.vue +224 -0
- package/src/components/modal/Viewer3crWebGL.vue +65 -0
- package/src/components/modal/ViewerActionRail.vue +10 -27
- package/src/components/modal/ViewerMain.vue +84 -0
- package/src/components/modal/ViewerNavigationDrawer.vue +269 -68
- package/src/components/modal/ViewerScanView.vue +223 -67
- package/src/components/modal/__tests__/{MftpWebGL3DRModal.spec.ts → Viewer3cr.spec.ts} +154 -53
- package/src/components/modal/__tests__/{WebGL3DR.spec.ts → Viewer3crWebGL.spec.ts} +11 -11
- package/src/components/modal/__tests__/ViewerNavigationDrawer.spec.ts +271 -11
- package/src/components/modal/__tests__/ViewerScanView.spec.ts +15 -7
- package/src/components/modal/actions/Action.vue +3 -8
- package/src/components/modal/actions/Flip3dAction.vue +31 -16
- package/src/components/modal/actions/FlipHorizontalAction.vue +14 -5
- package/src/components/modal/actions/FlipVerticalAction.vue +14 -5
- package/src/components/modal/actions/FullscreenAction.vue +9 -5
- package/src/components/modal/actions/PanAction.vue +11 -51
- package/src/components/modal/actions/ResetViewAction.vue +10 -8
- package/src/components/modal/actions/Rotate2dAction.vue +25 -15
- package/src/components/modal/actions/Slice3dAction.vue +22 -10
- package/src/components/modal/actions/ZoomAction.vue +21 -13
- package/src/components/modal/actions/__tests__/Action.spec.ts +2 -2
- package/src/components/modal/actions/__tests__/Flip3dAction.spec.ts +58 -14
- package/src/components/modal/actions/__tests__/FlipHorizontalAction.spec.ts +15 -5
- package/src/components/modal/actions/__tests__/FlipVerticalAction.spec.ts +15 -5
- package/src/components/modal/actions/__tests__/FullscreenAction.spec.ts +7 -5
- package/src/components/modal/actions/__tests__/PanAction.spec.ts +13 -32
- package/src/components/modal/actions/__tests__/ResetViewAction.spec.ts +5 -3
- package/src/components/modal/actions/__tests__/Rotate2dAction.spec.ts +13 -6
- package/src/components/modal/actions/__tests__/Slice3dAction.spec.ts +1 -1
- package/src/components/modal/actions/__tests__/ZoomAction.spec.ts +25 -11
- package/src/components/modal/app-bars/ViewerActionBar.vue +224 -0
- package/src/components/modal/app-bars/ViewerAppBar.vue +126 -0
- package/src/components/modal/app-bars/__tests__/ViewerActionBar.spec.ts +176 -0
- package/src/components/modal/app-bars/__tests__/ViewerAppBar.spec.ts +99 -0
- package/src/components/modal/layouts/Layout1x3ClipPath.vue +35 -0
- package/src/components/modal/layouts/Layout2x2ClipPath.vue +35 -0
- package/src/components/modal/layouts/LayoutFullscreenClipPath.vue +29 -0
- package/src/components/modal/layouts/__tests__/Layout1x3ClipPath.spec.ts +15 -0
- package/src/components/modal/layouts/__tests__/Layout2x2ClipPath.spec.ts +15 -0
- package/src/components/modal/layouts/__tests__/LayoutFullscreenClipPath.spec.ts +15 -0
- package/src/components/modal/layouts/composables/__tests__/useLayout1x3.spec.ts +40 -0
- package/src/components/modal/layouts/composables/__tests__/useLayout2x2.spec.ts +40 -0
- package/src/components/modal/layouts/composables/__tests__/useLayoutFullscreen.spec.ts +40 -0
- package/src/components/modal/layouts/composables/useLayout1x3.ts +46 -0
- package/src/components/modal/layouts/composables/useLayout2x2.ts +46 -0
- package/src/components/modal/layouts/composables/useLayoutFullscreen.ts +24 -0
- package/src/components/modal/menus/AutoAnnotateMenu.vue +67 -0
- package/src/components/modal/menus/AvatarDropdownMenu.vue +66 -0
- package/src/components/modal/menus/HelpMenu.vue +47 -0
- package/src/components/modal/menus/SettingsMenu.vue +242 -92
- package/src/components/modal/menus/ShareMenu.vue +58 -0
- package/src/components/modal/menus/__tests__/AutoAnnotateMenu.spec.ts +80 -0
- package/src/components/modal/menus/__tests__/AvatarDropdownMenu.spec.ts +49 -0
- package/src/components/modal/menus/__tests__/HelpMenu.spec.ts +12 -0
- package/src/components/modal/menus/__tests__/SettingsMenu.spec.ts +163 -57
- package/src/components/modal/modal/AboutModal.vue +61 -0
- package/src/components/modal/modal/AiModelList.vue +70 -0
- package/src/components/modal/{AskAI.vue → modal/AskAiModal.vue} +26 -34
- package/src/components/modal/modal/AutoAnnotateModal.vue +136 -0
- package/src/components/modal/modal/CloseViewerModal.vue +108 -0
- package/src/components/modal/modal/DataOverlayGeneralModal.vue +122 -0
- package/src/components/modal/modal/DataOverlayMeasurementModal.vue +59 -0
- package/src/components/modal/modal/DataOverlayModal.vue +121 -0
- package/src/components/modal/modal/ShareModal.vue +201 -0
- package/src/components/modal/modal/UploadsDrawer.vue +165 -0
- package/src/components/modal/modal/WhatsNewModal.vue +45 -0
- package/src/components/modal/modal/__tests__/AboutModal.spec.ts +60 -0
- package/src/components/modal/modal/__tests__/AiModelList.spec.ts +50 -0
- package/src/components/modal/{__tests__ → modal/__tests__}/AskAI.spec.ts +8 -7
- package/src/components/modal/modal/__tests__/AutoAnnotateModal.spec.ts +29 -0
- package/src/components/modal/modal/__tests__/CloseViewerModal.spec.ts +60 -0
- package/src/components/modal/modal/__tests__/DataOverlayGeneralModal.spec.ts +55 -0
- package/src/components/modal/modal/__tests__/DataOverlayMeasurementModal.spec.ts +82 -0
- package/src/components/modal/modal/__tests__/DataOverlayModal.spec.ts +94 -0
- package/src/components/modal/modal/__tests__/ShareModal.spec.ts +260 -0
- package/src/components/modal/modal/__tests__/UploadsDrawer.spec.ts +174 -0
- package/src/components/modal/modal/__tests__/WhatsNewModal.spec.ts +29 -0
- package/src/components/modal/snackbars/AnnotationGeneratedSnackbar.vue +34 -0
- package/src/components/modal/snackbars/ImagesSharedSnackbar.vue +26 -0
- package/src/components/modal/snackbars/LinkCopiedSnackbar.vue +26 -0
- package/src/components/modal/snackbars/__tests__/AnnotationGeneratedSnackbar.spec.ts +43 -0
- package/src/components/modal/snackbars/__tests__/ImagesSharedSnackbar.spec.ts +22 -0
- package/src/components/modal/snackbars/__tests__/LinkCopiedSnackbar.spec.ts +21 -0
- package/src/components/navigation/annotation/AnnotationCreateModal.vue +104 -0
- package/src/components/navigation/annotation/AnnotationCreateSnackbar.vue +20 -0
- package/src/components/navigation/annotation/AnnotationDataTable.vue +157 -0
- package/src/components/navigation/annotation/AnnotationDeleteModal.vue +48 -0
- package/src/components/navigation/annotation/AnnotationDeleteSnackbar.vue +25 -0
- package/src/components/navigation/annotation/AnnotationForm.vue +253 -0
- package/src/components/navigation/annotation/AnnotationIcon.vue +45 -0
- package/src/components/navigation/annotation/AnnotationInfo.vue +141 -0
- package/src/components/navigation/annotation/AnnotationMenu.vue +99 -0
- package/src/components/navigation/annotation/AnnotationPanel.vue +30 -0
- package/src/components/navigation/annotation/AnnotationTools.vue +106 -0
- package/src/components/navigation/annotation/AnnotationUpdateModal.vue +92 -0
- package/src/components/navigation/annotation/AnnotationVisibilityBtn.vue +52 -0
- package/src/components/navigation/annotation/DrawerTitle.vue +25 -0
- package/src/components/navigation/annotation/__tests__/AnnotationCreateModal.spec.ts +175 -0
- package/src/components/navigation/annotation/__tests__/AnnotationCreateSnackbar.spec.ts +31 -0
- package/src/components/navigation/annotation/__tests__/AnnotationDataTable.spec.ts +79 -0
- package/src/components/navigation/annotation/__tests__/AnnotationDeleteSnackbar.spec.ts +66 -0
- package/src/components/navigation/annotation/__tests__/AnnotationForm.spec.ts +248 -0
- package/src/components/navigation/annotation/__tests__/AnnotationIcon.spec.ts +13 -0
- package/src/components/navigation/annotation/__tests__/AnnotationTools.spec.ts +107 -0
- package/src/components/navigation/display/DisplayPanel.vue +156 -0
- package/src/components/{views/__tests__/DisplaySettings.spec.ts → navigation/display/__tests__/DisplayPanel.spec.ts} +14 -3
- package/src/components/navigation/history/HistoryModal.vue +140 -0
- package/src/components/navigation/mcad/McadAddObjectBtn.vue +41 -0
- package/src/components/navigation/mcad/McadDataTable.vue +78 -0
- package/src/components/navigation/mcad/McadDataTableItems.vue +382 -0
- package/src/components/navigation/mcad/McadDeleteModal.vue +44 -0
- package/src/components/navigation/mcad/McadDropZone.vue +148 -0
- package/src/components/navigation/mcad/McadFloating.vue +193 -0
- package/src/components/navigation/mcad/McadIcon.vue +34 -0
- package/src/components/navigation/mcad/McadInvert.vue +91 -0
- package/src/components/navigation/mcad/McadLockBtn.vue +62 -0
- package/src/components/navigation/mcad/McadMenu.vue +249 -0
- package/src/components/navigation/mcad/McadOpacity.vue +79 -0
- package/src/components/navigation/mcad/McadPanel.vue +31 -0
- package/src/components/navigation/mcad/McadToggleSortBtn.vue +18 -0
- package/src/components/navigation/mcad/McadToggleVisibilityBtn.vue +46 -0
- package/src/components/navigation/mcad/McadUpdateModal.vue +108 -0
- package/src/components/navigation/mcad/McadVisibilityBtn.vue +46 -0
- package/src/components/navigation/mcad/__tests__/McadAddObjectBtn.spec.ts +73 -0
- package/src/components/navigation/mcad/__tests__/McadDataTable.spec.ts +27 -0
- package/src/components/navigation/mcad/__tests__/McadDataTableItems.spec.ts +621 -0
- package/src/components/navigation/mcad/__tests__/McadDeleteModal.spec.ts +67 -0
- package/src/components/navigation/mcad/__tests__/McadDropZone.spec.ts +109 -0
- package/src/components/navigation/mcad/__tests__/McadIcon.spec.ts +13 -0
- package/src/components/navigation/mcad/__tests__/McadInvert.spec.ts +45 -0
- package/src/components/navigation/mcad/__tests__/McadLockBtn.spec.ts +38 -0
- package/src/components/navigation/mcad/__tests__/McadMenu.spec.ts +258 -0
- package/src/components/navigation/mcad/__tests__/McadOpacity.spec.ts +68 -0
- package/src/components/navigation/mcad/__tests__/McadToggleSortBtn.spec.ts +36 -0
- package/src/components/navigation/mcad/__tests__/McadToggleVisibilityBtn.spec.ts +53 -0
- package/src/components/navigation/mcad/__tests__/McadUpdateModal.spec.ts +122 -0
- package/src/components/navigation/mcad/__tests__/McadVisibilityBtn.spec.ts +45 -0
- package/src/components/navigation/measurement/MeasurementAngleSnackbar.vue +18 -0
- package/src/components/navigation/measurement/MeasurementDataTable.vue +162 -0
- package/src/components/navigation/measurement/MeasurementDeleteModal.vue +49 -0
- package/src/components/navigation/measurement/MeasurementDeleteSnackbar.vue +40 -0
- package/src/components/navigation/measurement/MeasurementIcon.vue +41 -0
- package/src/components/navigation/measurement/MeasurementInfo.vue +25 -0
- package/src/components/navigation/measurement/MeasurementInfoAngle.vue +36 -0
- package/src/components/navigation/measurement/MeasurementInfoLength.vue +37 -0
- package/src/components/navigation/measurement/MeasurementInfoPolygon.vue +58 -0
- package/src/components/navigation/measurement/MeasurementLengthSnackbar.vue +18 -0
- package/src/components/navigation/measurement/MeasurementMenu.vue +97 -0
- package/src/components/navigation/measurement/MeasurementPanel.vue +30 -0
- package/src/components/navigation/measurement/MeasurementPolygonSnackbar.vue +18 -0
- package/src/components/navigation/measurement/MeasurementTools.vue +101 -0
- package/src/components/navigation/measurement/MeasurementVisibilityBtn.vue +53 -0
- package/src/components/navigation/measurement/__tests__/MeasurementAngleSnackbar.spec.ts +34 -0
- package/src/components/navigation/measurement/__tests__/MeasurementDataTable.spec.ts +79 -0
- package/src/components/navigation/measurement/__tests__/MeasurementDeleteSnackbar.spec.ts +51 -0
- package/src/components/navigation/measurement/__tests__/MeasurementInfo.spec.ts +77 -0
- package/src/components/navigation/measurement/__tests__/MeasurementLengthSnackbar.spec.ts +35 -0
- package/src/components/navigation/measurement/__tests__/MeasurementPolygonSnackbar.spec.ts +35 -0
- package/src/components/navigation/measurement/__tests__/MeasurementTools.spec.ts +87 -0
- package/src/components/shared/ColourPalette.vue +71 -0
- package/src/components/shared/DoubleSliderSelector.vue +66 -28
- package/src/components/shared/HorizontalSliderSelector.vue +80 -0
- package/src/components/shared/KeyboardShortcuts.vue +184 -0
- package/src/components/shared/LoadingSpinner.vue +508 -144
- package/src/components/shared/MultiLoginError.vue +98 -0
- package/src/components/shared/NotificationToaster.vue +112 -0
- package/src/components/shared/UpdateSnackbar.vue +22 -9
- package/src/components/shared/ValueSelector.vue +10 -10
- package/src/components/shared/VerticalSliderSelector.vue +45 -44
- package/src/components/shared/__tests__/ColourPalette.spec.ts +21 -0
- package/src/components/shared/__tests__/DoubleSliderSelector.spec.ts +58 -46
- package/src/components/shared/__tests__/HorizontalSliderSelector.spec.ts +35 -0
- package/src/components/shared/__tests__/KeyboardShortcuts.spec.ts +50 -0
- package/src/components/shared/__tests__/MultiLoginError.spec.ts +50 -0
- package/src/components/shared/__tests__/NotificationToaster.spec.ts +65 -0
- package/src/components/shared/__tests__/UpdateSnackbar.spec.ts +7 -7
- package/src/components/shared/__tests__/ValueSelector.spec.ts +6 -0
- package/src/composables/__tests__/useDebounce.spec.ts +17 -0
- package/src/composables/__tests__/useMovingAverage.spec.ts +40 -0
- package/src/composables/__tests__/useNavigationCube.spec.ts +79 -0
- package/src/{functions/__tests__/notification.spec.ts → composables/__tests__/useNotificationHandler.spec.ts} +74 -17
- package/src/composables/__tests__/useToolGroup.spec.ts +41 -0
- package/src/composables/__tests__/useViewName.spec.ts +29 -0
- package/src/composables/useBoundingBox.ts +32 -0
- package/src/composables/useEventListener.ts +7 -9
- package/src/composables/useMedia.ts +27 -0
- package/src/composables/useNavigationCube.ts +80 -0
- package/src/composables/useNotificationHandler.ts +82 -0
- package/src/composables/useResizeObserver.ts +31 -0
- package/src/composables/useToolGroup.ts +36 -0
- package/src/composables/useViewName.ts +34 -0
- package/src/composables/useViewer3cr.ts +3 -2
- package/src/config.ts +1 -1
- package/src/constants.ts +8 -0
- package/src/functions/HotkeyScope.ts +87 -0
- package/src/functions/__tests__/HotkeyScope.spec.ts +49 -0
- package/src/functions/__tests__/colours.spec.ts +42 -0
- package/src/functions/__tests__/fileReader.spec.ts +130 -0
- package/src/functions/__tests__/modelHelper.spec.ts +1 -0
- package/src/functions/__tests__/tsHelper.spec.ts +7 -0
- package/src/functions/chunker.ts +21 -0
- package/src/functions/colours.ts +45 -0
- package/src/functions/fileReader.ts +48 -0
- package/src/functions/guards/__tests__/isDataOverlayAngle.spec.ts +21 -0
- package/src/functions/guards/__tests__/isDataOverlayLength.spec.ts +21 -0
- package/src/functions/guards/__tests__/isDataOverlayPolygon.spec.ts +21 -0
- package/src/functions/guards/isDataOverlayAngle.ts +3 -4
- package/src/functions/guards/isDataOverlayLength.ts +3 -4
- package/src/functions/guards/isDataOverlayPolygon.ts +3 -4
- package/src/functions/openUrl.ts +3 -0
- package/src/functions/{__tests__ → parsers/__tests__}/parseAction.spec.ts +1 -1
- package/src/functions/{__tests__ → parsers/__tests__}/parseCallToAction.spec.ts +1 -1
- package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlay.spec.ts +1 -1
- package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlayData.spec.ts +1 -1
- package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlayEvent.spec.ts +3 -3
- package/src/functions/{__tests__ → parsers/__tests__}/parseMcadEvent.spec.ts +3 -3
- package/src/functions/{parseAction.ts → parsers/parseAction.ts} +1 -2
- package/src/functions/{parseCallToAction.ts → parsers/parseCallToAction.ts} +2 -2
- package/src/functions/{parseDataOverlay.ts → parsers/parseDataOverlay.ts} +3 -3
- package/src/functions/parsers/parseDataOverlayData.ts +9 -0
- package/src/functions/parsers/parseDataOverlayEvent.ts +19 -0
- package/src/functions/parsers/parseMcadEvent.ts +9 -0
- package/src/functions/platform.ts +7 -0
- package/src/functions/translateTooltipShortcut.ts +35 -0
- package/src/functions/tsHelper.ts +3 -0
- package/src/main.ts +70 -48
- package/src/models/__tests__/iso-languages.spec.ts +23 -0
- package/src/models/__tests__/scanState.spec.ts +14 -38
- package/src/models/iso-languages.ts +1609 -0
- package/src/models/progress.ts +23 -0
- package/src/models/scanState.ts +56 -100
- package/src/plugins/__tests__/pinia.spec.ts +7 -0
- package/src/plugins/__tests__/vue-i18n.spec.ts +7 -0
- package/src/plugins/__tests__/vuetify.spec.ts +3 -3
- package/src/plugins/locales/en.json +442 -0
- package/src/plugins/material-symbols/aliases.ts +43 -0
- package/src/plugins/material-symbols/material-symbols-filled.ts +11 -0
- package/src/plugins/material-symbols/material-symbols-outlined.ts +9 -0
- package/src/plugins/pinia.ts +3 -0
- package/src/plugins/vue-i18n.ts +9 -0
- package/src/plugins/vuetify.ts +157 -25
- package/src/services/__tests__/features.service.spec.ts +14 -0
- package/src/services/__tests__/gpt.service.spec.ts +64 -3
- package/src/services/__tests__/viewer-3cr.service.spec.ts +616 -192
- package/src/services/features.service.ts +32 -0
- package/src/services/gpt.service.ts +5 -2
- package/src/services/viewer-3cr.service.ts +374 -307
- package/src/stores/__tests__/data-overlay.store.spec.ts +92 -0
- package/src/stores/__tests__/demo.store.spec.ts +196 -0
- package/src/stores/__tests__/drawer.store.spec.ts +27 -0
- package/src/stores/__tests__/intro.store.spec.ts +102 -0
- package/src/stores/__tests__/language.store.spec.ts +83 -0
- package/src/stores/__tests__/mcad-floating.store.spec.ts +339 -0
- package/src/stores/__tests__/mcad.store.spec.ts +88 -0
- package/src/stores/__tests__/save.store.spec.ts +51 -0
- package/src/stores/__tests__/theme.store.spec.ts +18 -0
- package/src/stores/__tests__/tool.store.spec.ts +53 -0
- package/src/stores/__tests__/upload.store.spec.ts +19 -0
- package/src/stores/__tests__/viewer.store.spec.ts +18 -0
- package/src/stores/data-overlay.store.ts +93 -0
- package/src/stores/demo.store.ts +284 -0
- package/src/stores/drawer.store.ts +23 -0
- package/src/stores/intro.store.ts +35 -0
- package/src/stores/language.store.ts +59 -0
- package/src/stores/mcad-floating.store.ts +141 -0
- package/src/stores/mcad.store.ts +53 -0
- package/src/stores/save.store.ts +59 -0
- package/src/stores/theme.store.ts +45 -0
- package/src/stores/tool.store.ts +41 -0
- package/src/stores/upload.store.ts +19 -0
- package/src/stores/viewer.store.ts +30 -0
- package/src/tools/__tests__/annotation-create.tool.spec.ts +87 -0
- package/src/tools/__tests__/annotation-move.tool.spec.ts +107 -0
- package/src/tools/__tests__/data-overlay.tool.spec.ts +127 -0
- package/src/tools/__tests__/mcad-move.tool.spec.ts +106 -0
- package/src/tools/__tests__/mcad-rotate.tool.spec.ts +103 -0
- package/src/tools/__tests__/mcad-scale.tool.spec.ts +8 -0
- package/src/tools/__tests__/mcad-select.tool.spec.ts +63 -0
- package/src/tools/__tests__/measurement-angle.tool.spec.ts +26 -0
- package/src/tools/__tests__/measurement-length.tool.spec.ts +26 -0
- package/src/tools/__tests__/measurement-polygon.tool.spec.ts +26 -0
- package/src/tools/annotation-create.tool.ts +48 -0
- package/src/tools/annotation-move.tool.ts +48 -0
- package/src/tools/data-overlay.tool.ts +45 -48
- package/src/tools/mcad-move.tool.ts +47 -0
- package/src/tools/mcad-rotate.tool.ts +47 -0
- package/src/tools/mcad-scale-tool.ts +10 -0
- package/src/tools/mcad-select-tool.ts +32 -0
- package/src/tools/measurement-angle.tool.ts +20 -0
- package/src/tools/measurement-length.tool.ts +20 -0
- package/src/tools/measurement-polygon.tool.ts +20 -0
- package/src/types/feature.ts +6 -0
- package/src/types/viewer-tool.ts +5 -0
- package/test/MockImportOriginal.ts +7 -0
- package/test/assertions/beTypeOrNull.ts +24 -0
- package/test/fakers/action-data.faker.ts +1 -1
- package/test/fakers/action.faker.ts +1 -1
- package/test/fakers/call-to-action.faker.ts +1 -1
- package/test/fakers/data-overlay-angle.faker.ts +1 -1
- package/test/fakers/data-overlay-annotation.faker.ts +1 -1
- package/test/fakers/data-overlay-data.faker.ts +18 -15
- package/test/fakers/data-overlay-interaction.faker.ts +25 -17
- package/test/fakers/data-overlay-length.faker.ts +1 -1
- package/test/fakers/data-overlay-mcad.faker.ts +4 -3
- package/test/fakers/data-overlay-polygon.faker.ts +1 -1
- package/test/fakers/feature.faker.ts +13 -0
- package/test/fakers/file.faker.ts +11 -0
- package/test/fakers/gpt-question.faker.ts +1 -1
- package/test/fakers/gpt-response.faker.ts +1 -1
- package/test/fakers/mcad-object-interaction.faker.ts +4 -4
- package/test/fakers/orientation.faker.ts +1 -1
- package/test/fakers/segment-angle.faker.ts +1 -1
- package/test/fakers/upload.faker.ts +14 -0
- package/test/getAnimationFrame.ts +3 -0
- package/test/plugins/findByTestId.ts +13 -6
- package/test/plugins/pinia.ts +20 -0
- package/test/plugins/vitest.d.ts +8 -0
- package/test/plugins/vue-i18n.ts +22 -0
- package/test/plugins/vuetify.ts +10 -0
- package/test/setup.ts +37 -12
- package/tsconfig.json +1 -1
- package/vite.config.mts +48 -18
- package/vitest.config.mts +12 -3
- package/src/assets/images/MainBackdrop.svg +0 -48
- package/src/assets/images/dark/Singular-Health-Disc-Mono.svg +0 -9
- package/src/assets/images/dark/demo-icon-small.png +0 -0
- package/src/assets/images/dark/demo-logo-small.svg +0 -27
- package/src/assets/images/dark/demo-logo.svg +0 -1
- package/src/assets/images/light/Singular-Health-Disc-Mono.svg +0 -9
- package/src/assets/logos/3dicom/white-mini.svg +0 -20
- package/src/components/demo/DemoModal.vue +0 -44
- package/src/components/demo/DemoPatientModal.vue +0 -52
- package/src/components/demo/__tests__/DemoModal.spec.ts +0 -26
- package/src/components/demo/__tests__/DemoPatientModal.spec.ts +0 -38
- package/src/components/demo/__tests__/options.spec.ts +0 -25
- package/src/components/demo/licence/DemoLicenceEnableCloudStorageModal.vue +0 -64
- package/src/components/demo/licence/DemoLicenceInfoModal.vue +0 -49
- package/src/components/demo/licence/DemoLicenceSendToPartyModal.vue +0 -178
- package/src/components/demo/licence/DemoLicenceShareToMobileModal.vue +0 -102
- package/src/components/demo/licence/__tests__/DemoLicenceSendToPartyModal.spec.ts +0 -36
- package/src/components/demo/licence/__tests__/DemoLicenceShareToMobileModal.spec.ts +0 -52
- package/src/components/demo/options.ts +0 -170
- package/src/components/demo/patient/DemoPatientEnableCloudStorageModal.vue +0 -64
- package/src/components/demo/patient/DemoPatientInfoModal.vue +0 -49
- package/src/components/demo/patient/DemoPatientSendToPartyModal.vue +0 -177
- package/src/components/demo/patient/DemoPatientShareToMobileModal.vue +0 -102
- package/src/components/demo/patient/__tests__/DemoPatientEnableCloudStorageModal.spec.ts +0 -38
- package/src/components/demo/patient/__tests__/DemoPatientInfoModal.spec.ts +0 -38
- package/src/components/demo/patient/__tests__/DemoPatientSendToPartyModal.spec.ts +0 -36
- package/src/components/demo/patient/__tests__/DemoPatientShareToMobileModal.spec.ts +0 -52
- package/src/components/modal/CloseViewerModal.vue +0 -69
- package/src/components/modal/MftpWebGL3DRModal.vue +0 -336
- package/src/components/modal/ViewerNavigationDrawerContent.vue +0 -168
- package/src/components/modal/ViewerNavigationDrawerFooter.vue +0 -131
- package/src/components/modal/ViewerNavigationDrawerHeader.vue +0 -33
- package/src/components/modal/WebGL3DR.vue +0 -91
- package/src/components/modal/__tests__/CloseViewerModal.spec.ts +0 -70
- package/src/components/modal/__tests__/ViewerNavigationDrawerContent.spec.ts +0 -11
- package/src/components/modal/__tests__/ViewerNavigationDrawerFooter.spec.ts +0 -46
- package/src/components/modal/__tests__/ViewerNavigationDrawerHeader.spec.ts +0 -40
- package/src/components/modal/actions/NavigationCubeAction.vue +0 -26
- package/src/components/modal/actions/__tests__/NavigationCubeAction.spec.ts +0 -25
- package/src/components/modal/buttons/AutoAnnotateBtn.vue +0 -197
- package/src/components/modal/buttons/__tests__/AutoAnnotateBtn.spec.ts +0 -28
- package/src/components/modal/menus/FileMenu.vue +0 -73
- package/src/components/modal/menus/__tests__/FileMenu.spec.ts +0 -110
- package/src/components/navigation/mcad/McadGlobalActions.vue +0 -20
- package/src/components/navigation/mcad/McadGlobalOpacitySlider.vue +0 -103
- package/src/components/navigation/mcad/McadGlobalScanViewBtn.vue +0 -28
- package/src/components/navigation/mcad/McadGlobalVisibilityBtn.vue +0 -38
- package/src/components/views/AnnotationTreeView.vue +0 -236
- package/src/components/views/DisplaySettings.vue +0 -94
- package/src/components/views/MarkupTreeView.vue +0 -201
- package/src/components/views/McadObjectTreeView.vue +0 -129
- package/src/components/views/__tests__/AnnotationTreeView.spec.ts +0 -62
- package/src/components/views/__tests__/MarkupTreeView.spec.ts +0 -41
- package/src/components/views/__tests__/McadObjectTreeView.spec.ts +0 -47
- package/src/components/views/modals/DataOverlayGeneralModal.vue +0 -71
- package/src/components/views/modals/DataOverlayMarkupModal.vue +0 -60
- package/src/components/views/modals/DataOverlayModal.vue +0 -88
- package/src/components/views/shared/MaskIcon.vue +0 -44
- package/src/components/views/shared/ObjectColor.vue +0 -31
- package/src/components/views/shared/ObjectLabel.vue +0 -30
- package/src/components/views/shared/Opacity.vue +0 -65
- package/src/components/views/shared/VisibilityBtn.vue +0 -25
- package/src/components/views/shared/__tests__/MaskIcon.spec.ts +0 -10
- package/src/components/views/shared/__tests__/ObjectColor.spec.ts +0 -10
- package/src/components/views/shared/__tests__/ObjectLabel.spec.ts +0 -10
- package/src/components/views/shared/__tests__/Opacity.spec.ts +0 -24
- package/src/components/views/shared/__tests__/VisibilityBtn.spec.ts +0 -11
- package/src/components/views/types/annotation-tree-view-item-child-action.ts +0 -6
- package/src/components/views/types/annotation-tree-view-item-child.ts +0 -9
- package/src/components/views/types/annotation-tree-view-item.ts +0 -13
- package/src/components/views/types/markup-tree-view-item-child.ts +0 -6
- package/src/components/views/types/markup-tree-view-item.ts +0 -14
- package/src/components/views/types/mcad-object-tree-view-item.ts +0 -13
- package/src/composables/__tests__/useAnnotations.spec.ts +0 -35
- package/src/composables/__tests__/useIntroJs.spec.ts +0 -51
- package/src/composables/__tests__/useMarkups.spec.ts +0 -39
- package/src/composables/__tests__/useMcadObjects.spec.ts +0 -36
- package/src/composables/__tests__/useNavigationCubeObserver.spec.ts +0 -61
- package/src/composables/useAnnotations.ts +0 -37
- package/src/composables/useIntroJs.ts +0 -142
- package/src/composables/useMarkups.ts +0 -41
- package/src/composables/useMcadObjects.ts +0 -32
- package/src/composables/useNavigationCubeObserver.ts +0 -114
- package/src/composables/useVersion3cr.ts +0 -7
- package/src/functions/__tests__/layoutOverlayStyle.spec.ts +0 -325
- package/src/functions/asyncTools.ts +0 -3
- package/src/functions/layoutOverlayStyle.ts +0 -84
- package/src/functions/notification.ts +0 -82
- package/src/functions/parseDataOverlayData.ts +0 -10
- package/src/functions/parseDataOverlayEvent.ts +0 -17
- package/src/functions/parseMcadEvent.ts +0 -10
- package/src/functions/rgbaToCss.ts +0 -13
- package/src/models/__tests__/loadViewerOptions.spec.ts +0 -72
- package/src/models/__tests__/loadViewerPayload.spec.ts +0 -10
- package/src/models/callbacks.ts +0 -4
- package/src/models/loadViewerOptions.ts +0 -79
- package/src/models/loadViewerPayload.ts +0 -17
- package/src/plugins/__tests__/usePlugins.spec.ts +0 -12
- package/src/plugins/usePlugins.ts +0 -8
- package/src/types/action-data.ts +0 -4
- package/src/types/action.ts +0 -13
- package/src/types/call-to-action.ts +0 -9
- package/src/types/colour.ts +0 -6
- package/src/types/data-overlay-angle.ts +0 -16
- package/src/types/data-overlay-annotation.ts +0 -18
- package/src/types/data-overlay-data.ts +0 -15
- package/src/types/data-overlay-event.ts +0 -5
- package/src/types/data-overlay-info.ts +0 -18
- package/src/types/data-overlay-interaction.ts +0 -15
- package/src/types/data-overlay-length.ts +0 -16
- package/src/types/data-overlay-markup.ts +0 -7
- package/src/types/data-overlay-mcad.ts +0 -20
- package/src/types/data-overlay-polygon.ts +0 -18
- package/src/types/data-overlay.ts +0 -16
- package/src/types/demo-type.ts +0 -4
- package/src/types/gpt-question.ts +0 -4
- package/src/types/gpt-response-payload.ts +0 -6
- package/src/types/mcad-object-interaction.ts +0 -15
- package/src/types/segment-angle.ts +0 -5
- package/src/types/vector2.ts +0 -4
- package/src/types/vector3.ts +0 -5
- package/test/fakers/data-overlay-info.faker.ts +0 -29
- /package/src/assets/logos/3dicom/{white.svg → white/white.svg} +0 -0
- /package/src/assets/{images/light/Singular-Health-Trademark-mono.svg → logos/singular-health/black/black.svg} +0 -0
- /package/src/assets/{images/dark/Singular-Health-Trademark-mono.svg → logos/singular-health/white/white.svg} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { emptyPayload, Viewer3crService } from '@/services/viewer-3cr.service';
|
|
2
1
|
import { unref } from 'vue';
|
|
3
2
|
import {
|
|
4
|
-
AnchorPoint,
|
|
5
3
|
DataOverlaysActions,
|
|
4
|
+
FileManagementActions,
|
|
6
5
|
FrontEndInterfaces,
|
|
7
6
|
InteractivityActions,
|
|
8
7
|
LayoutActions,
|
|
@@ -12,20 +11,23 @@ import {
|
|
|
12
11
|
PresetsActions,
|
|
13
12
|
ScanMovementActions,
|
|
14
13
|
ScanOrientationActions,
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
SlidersActions,
|
|
15
|
+
ViewSelectionActions
|
|
17
16
|
} from '@3cr/types-ts';
|
|
18
17
|
import { currentColourPreset, previousLayout, transactionStarted } from '@/models/scanState';
|
|
19
18
|
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
20
|
-
import {
|
|
19
|
+
import { Viewer3crServiceImpl } from '@/services/viewer-3cr.service';
|
|
20
|
+
import { executePayload } from '@3cr/sdk-browser';
|
|
21
|
+
import { flushPromises } from '@vue/test-utils';
|
|
22
|
+
import { Mock, MockInstance } from '@vitest/spy';
|
|
21
23
|
|
|
22
24
|
describe('Viewer3cr tests', () => {
|
|
23
|
-
const viewer3cr = useViewer3cr();
|
|
25
|
+
const viewer3cr = useViewer3cr() as Viewer3crServiceImpl;
|
|
24
26
|
|
|
25
27
|
let sendPayload: MockInstance;
|
|
26
28
|
|
|
27
29
|
beforeEach(() => {
|
|
28
|
-
sendPayload = vi.spyOn(
|
|
30
|
+
sendPayload = vi.spyOn(viewer3cr, 'sendPayload').mockResolvedValue();
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
it('should create instance', () => {
|
|
@@ -34,37 +36,151 @@ describe('Viewer3cr tests', () => {
|
|
|
34
36
|
|
|
35
37
|
describe('data overlay actions', () => {
|
|
36
38
|
it('should toggle 2d annotation', async () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
await viewer3cr.setAnnotation2dVisibility({} as any);
|
|
40
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
41
|
+
FrontEndInterfaces.data_overlay,
|
|
42
|
+
DataOverlaysActions.do03,
|
|
43
|
+
expect.any(Object)
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should set size 2d annotation', async () => {
|
|
48
|
+
await viewer3cr.setAnnotation2dSize({} as any);
|
|
49
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
50
|
+
FrontEndInterfaces.data_overlay,
|
|
51
|
+
DataOverlaysActions.do04,
|
|
52
|
+
expect.any(Object)
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should set colour 2d annotation', async () => {
|
|
57
|
+
await viewer3cr.setAnnotation2dColour({} as any);
|
|
58
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
59
|
+
FrontEndInterfaces.data_overlay,
|
|
60
|
+
DataOverlaysActions.do05,
|
|
61
|
+
expect.any(Object)
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should set Icon annotation', async () => {
|
|
66
|
+
await viewer3cr.setAnnotationIcon({} as any);
|
|
67
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
68
|
+
FrontEndInterfaces.data_overlay,
|
|
69
|
+
DataOverlaysActions.do06,
|
|
70
|
+
expect.any(Object)
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should set size 3d annotation', async () => {
|
|
75
|
+
await viewer3cr.setAnnotation3dSize({} as any);
|
|
76
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
77
|
+
FrontEndInterfaces.data_overlay,
|
|
78
|
+
DataOverlaysActions.do08,
|
|
79
|
+
expect.any(Object)
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should set size 3d annotation', async () => {
|
|
84
|
+
await viewer3cr.setAnnotation3dColour({} as any);
|
|
85
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
86
|
+
FrontEndInterfaces.data_overlay,
|
|
87
|
+
DataOverlaysActions.do09,
|
|
88
|
+
expect.any(Object)
|
|
89
|
+
);
|
|
44
90
|
});
|
|
45
91
|
|
|
46
92
|
it('should toggle 3d annotation', async () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
93
|
+
await viewer3cr.setAnnotation3dVisibility({} as any);
|
|
94
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
95
|
+
FrontEndInterfaces.data_overlay,
|
|
96
|
+
DataOverlaysActions.do11,
|
|
97
|
+
expect.any(Object)
|
|
98
|
+
);
|
|
54
99
|
});
|
|
55
100
|
});
|
|
56
101
|
|
|
57
102
|
describe('interactivity actions', () => {
|
|
103
|
+
it('should set mouse input', async () => {
|
|
104
|
+
await viewer3cr.setMouseInput({} as any);
|
|
105
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
106
|
+
FrontEndInterfaces.interactivity,
|
|
107
|
+
InteractivityActions.in01,
|
|
108
|
+
expect.any(Object)
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
58
112
|
it('should enable/disable unity inputs', async () => {
|
|
59
|
-
await viewer3cr.
|
|
60
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
113
|
+
await viewer3cr.setKeyboardInput({} as any);
|
|
114
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
115
|
+
FrontEndInterfaces.interactivity,
|
|
116
|
+
InteractivityActions.in02,
|
|
117
|
+
expect.any(Object)
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('file management actions', () => {
|
|
123
|
+
it('should set loadScan', async () => {
|
|
124
|
+
await viewer3cr.loadScan({} as any);
|
|
125
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
126
|
+
FrontEndInterfaces.file_management,
|
|
127
|
+
FileManagementActions.fm01,
|
|
128
|
+
expect.any(Object)
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should set loadScanSession', async () => {
|
|
133
|
+
await viewer3cr.loadScanSession({} as any);
|
|
134
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
135
|
+
FrontEndInterfaces.file_management,
|
|
136
|
+
FileManagementActions.fm03,
|
|
137
|
+
expect.any(Object)
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('should set setDataOverlaySession', async () => {
|
|
142
|
+
await viewer3cr.setDataOverlaySession({} as any);
|
|
143
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
144
|
+
FrontEndInterfaces.file_management,
|
|
145
|
+
FileManagementActions.fm05,
|
|
146
|
+
expect.any(Object)
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should set addDataOverlaySession', async () => {
|
|
151
|
+
await viewer3cr.addDataOverlaySession({} as any);
|
|
152
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
153
|
+
FrontEndInterfaces.file_management,
|
|
154
|
+
FileManagementActions.fm06,
|
|
155
|
+
expect.any(Object)
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should set loadExternalMcadObject', async () => {
|
|
160
|
+
await viewer3cr.loadExternalMcadObject({} as any);
|
|
161
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
162
|
+
FrontEndInterfaces.file_management,
|
|
163
|
+
FileManagementActions.fm07,
|
|
164
|
+
expect.any(Object)
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should set loadExternalMcadObject', async () => {
|
|
169
|
+
await viewer3cr.loadLocalMcadObject({} as any);
|
|
170
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
171
|
+
FrontEndInterfaces.file_management,
|
|
172
|
+
FileManagementActions.fm08,
|
|
173
|
+
expect.any(Object)
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should set loadMcadObjects', async () => {
|
|
178
|
+
await viewer3cr.loadMcadObjects({} as any);
|
|
179
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
180
|
+
FrontEndInterfaces.file_management,
|
|
181
|
+
FileManagementActions.fm09,
|
|
182
|
+
expect.any(Object)
|
|
183
|
+
);
|
|
68
184
|
});
|
|
69
185
|
});
|
|
70
186
|
|
|
@@ -77,7 +193,7 @@ describe('Viewer3cr tests', () => {
|
|
|
77
193
|
const action = LayoutActions.lo01;
|
|
78
194
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
79
195
|
await viewer3cr.layouts(action);
|
|
80
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.layout, action,
|
|
196
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.layout, action, expect.any(Object));
|
|
81
197
|
});
|
|
82
198
|
|
|
83
199
|
it('should set prevLayout', async () => {
|
|
@@ -86,145 +202,209 @@ describe('Viewer3cr tests', () => {
|
|
|
86
202
|
expect(unref(previousLayout)).not.toBe(LayoutActions.lo02);
|
|
87
203
|
await viewer3cr.layouts(action);
|
|
88
204
|
expect(unref(previousLayout)).toBe(LayoutActions.lo02);
|
|
89
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.layout, action,
|
|
205
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.layout, action, expect.any(Object));
|
|
90
206
|
});
|
|
91
207
|
});
|
|
92
208
|
|
|
93
209
|
describe('mcad actions', () => {
|
|
94
210
|
it('should set mcad object visibility', async () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc03, value);
|
|
211
|
+
await viewer3cr.setMcadObjectVisibility({} as any);
|
|
212
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc03, expect.any(Object));
|
|
98
213
|
});
|
|
99
214
|
|
|
100
215
|
it('should set mcad object colour', async () => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc04, value);
|
|
216
|
+
await viewer3cr.setMcadObjectColour({} as any);
|
|
217
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc04, expect.any(Object));
|
|
104
218
|
});
|
|
105
219
|
|
|
106
220
|
it('should toggle mcad object movement', async () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
221
|
+
await viewer3cr.moveMcadObject({} as any);
|
|
222
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc05, expect.any(Object));
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should toggle rotateMcadObject', async () => {
|
|
226
|
+
await viewer3cr.rotateMcadObject({} as any);
|
|
227
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc06, expect.any(Object));
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('should toggle lockMcad', async () => {
|
|
231
|
+
await viewer3cr.lockMcad({} as any);
|
|
232
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc09, expect.any(Object));
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('should toggle groupMcad', async () => {
|
|
236
|
+
await viewer3cr.groupMcad({} as any);
|
|
237
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc10, expect.any(Object));
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it('should toggle ungroupMcad', async () => {
|
|
241
|
+
await viewer3cr.ungroupMcad({} as any);
|
|
242
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc11, expect.any(Object));
|
|
110
243
|
});
|
|
111
244
|
|
|
112
245
|
it('should toggle mcad inversion', async () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
await viewer3cr.
|
|
119
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.
|
|
246
|
+
await viewer3cr.invertMcadObject({} as any);
|
|
247
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc16, expect.any(Object));
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('should toggle removeMcadObject', async () => {
|
|
251
|
+
await viewer3cr.removeMcadObject({} as any);
|
|
252
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc17, expect.any(Object));
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should toggle setMcadObjectTitle', async () => {
|
|
256
|
+
await viewer3cr.setMcadObjectTitle({} as any);
|
|
257
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.mcad, McadActions.mc18, expect.any(Object));
|
|
120
258
|
});
|
|
121
259
|
});
|
|
122
260
|
|
|
123
|
-
describe('
|
|
124
|
-
it('should set
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
261
|
+
describe('measurement actions', () => {
|
|
262
|
+
it('should set createAnnotation2dTool', async () => {
|
|
263
|
+
await viewer3cr.createAnnotation2dTool({} as any);
|
|
264
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu01, expect.any(Object));
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('should set createAnnotation3dTool', async () => {
|
|
268
|
+
await viewer3cr.createAnnotation3dTool({} as any);
|
|
269
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu02, expect.any(Object));
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('should set createAnnotation', async () => {
|
|
273
|
+
await viewer3cr.createAnnotation({} as any);
|
|
274
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu03, expect.any(Object));
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should set moveAnnotation2dTool', async () => {
|
|
278
|
+
await viewer3cr.moveAnnotation2dTool({} as any);
|
|
279
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu04, expect.any(Object));
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it('should set moveAnnotation3dTool', async () => {
|
|
283
|
+
await viewer3cr.moveAnnotation3dTool({} as any);
|
|
284
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu05, expect.any(Object));
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('should set moveAnnotation', async () => {
|
|
288
|
+
await viewer3cr.moveAnnotation({} as any);
|
|
289
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu06, expect.any(Object));
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('should set removeAnnotation', async () => {
|
|
293
|
+
await viewer3cr.removeAnnotation({} as any);
|
|
294
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu07, expect.any(Object));
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('should set updateAnnotationTitle', async () => {
|
|
298
|
+
await viewer3cr.updateAnnotationTitle({} as any);
|
|
299
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu08, expect.any(Object));
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it('should set updateAnnotationDescription', async () => {
|
|
303
|
+
await viewer3cr.updateAnnotationDescription({} as any);
|
|
304
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu09, expect.any(Object));
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('should set updateAnnotationActions', async () => {
|
|
308
|
+
await viewer3cr.updateAnnotationActions({} as any);
|
|
309
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu10, expect.any(Object));
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('should set measurement visibility', async () => {
|
|
313
|
+
await viewer3cr.setMeasurementVisibility({} as any);
|
|
314
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu16, expect.any(Object));
|
|
128
315
|
});
|
|
129
316
|
|
|
130
317
|
it('should toggle length tool', async () => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu20, value);
|
|
318
|
+
await viewer3cr.lengthTool({} as any);
|
|
319
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu20, expect.any(Object));
|
|
134
320
|
});
|
|
135
321
|
|
|
136
322
|
it('should toggle polygon tool', async () => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu21, value);
|
|
323
|
+
await viewer3cr.polygonTool({} as any);
|
|
324
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu21, expect.any(Object));
|
|
140
325
|
});
|
|
141
326
|
|
|
142
327
|
it('should toggle angle tool', async () => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu22, value);
|
|
328
|
+
await viewer3cr.angleTool({} as any);
|
|
329
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.markups, MarkupsActions.mu22, expect.any(Object));
|
|
146
330
|
});
|
|
147
331
|
});
|
|
148
332
|
|
|
149
333
|
describe('navigation actions', () => {
|
|
150
334
|
it('should set nav cube position', async () => {
|
|
151
|
-
await viewer3cr.setNavCubePositionSize(
|
|
152
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
});
|
|
335
|
+
await viewer3cr.setNavCubePositionSize({} as any);
|
|
336
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
337
|
+
FrontEndInterfaces.navigation_cube,
|
|
338
|
+
NavigationCubeActions.nc01,
|
|
339
|
+
expect.any(Object)
|
|
340
|
+
);
|
|
158
341
|
});
|
|
159
342
|
|
|
160
343
|
it('should set nav cube visibility', async () => {
|
|
161
|
-
await viewer3cr.setNavCubeVisibility(
|
|
162
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
344
|
+
await viewer3cr.setNavCubeVisibility({} as any);
|
|
345
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
346
|
+
FrontEndInterfaces.navigation_cube,
|
|
347
|
+
NavigationCubeActions.nc02,
|
|
348
|
+
expect.any(Object)
|
|
349
|
+
);
|
|
166
350
|
});
|
|
167
351
|
|
|
168
352
|
it('should set nav cube interactivity', async () => {
|
|
169
|
-
await viewer3cr.setNavCubeInteractivity(
|
|
170
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
it('should set nav cube perspective', async () => {
|
|
177
|
-
await viewer3cr.setNavCubePerspective(true);
|
|
178
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.navigation_cube, NavigationCubeActions.nc04, {
|
|
179
|
-
Version: expect.any(String),
|
|
180
|
-
Value: true
|
|
181
|
-
});
|
|
353
|
+
await viewer3cr.setNavCubeInteractivity({} as any);
|
|
354
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
355
|
+
FrontEndInterfaces.navigation_cube,
|
|
356
|
+
NavigationCubeActions.nc03,
|
|
357
|
+
expect.any(Object)
|
|
358
|
+
);
|
|
182
359
|
});
|
|
183
360
|
|
|
184
361
|
it('should set nav cube colour/opacity', async () => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
B: colour.B / 255,
|
|
192
|
-
A: colour.A / 255
|
|
193
|
-
});
|
|
362
|
+
await viewer3cr.setNavCubeColourOpacity({} as any);
|
|
363
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
364
|
+
FrontEndInterfaces.navigation_cube,
|
|
365
|
+
NavigationCubeActions.nc05,
|
|
366
|
+
expect.any(Object)
|
|
367
|
+
);
|
|
194
368
|
});
|
|
195
369
|
|
|
196
370
|
it('should set nav cube highlight colour/opacity', async () => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
371
|
+
await viewer3cr.setNavCubeHighlightColourOpacity({} as any);
|
|
372
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
373
|
+
FrontEndInterfaces.navigation_cube,
|
|
374
|
+
NavigationCubeActions.nc07,
|
|
375
|
+
expect.any(Object)
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it('should set nav cube setNavCubeGraphics', async () => {
|
|
380
|
+
await viewer3cr.setNavCubeGraphics({} as any);
|
|
381
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
382
|
+
FrontEndInterfaces.navigation_cube,
|
|
383
|
+
NavigationCubeActions.nc08,
|
|
384
|
+
expect.any(Object)
|
|
385
|
+
);
|
|
206
386
|
});
|
|
207
387
|
});
|
|
208
388
|
|
|
209
389
|
describe('preset actions', () => {
|
|
210
390
|
it('should set setPreset', async () => {
|
|
211
391
|
const action = PresetsActions.pr01;
|
|
212
|
-
const data = { asd: '123' };
|
|
392
|
+
const data = { asd: '123' } as any;
|
|
213
393
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
214
394
|
expect(unref(currentColourPreset)).not.toBe(data);
|
|
215
395
|
await viewer3cr.setPreset(action, data);
|
|
216
396
|
expect(unref(currentColourPreset)).not.toBe(data);
|
|
217
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.presets, action, data);
|
|
397
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.presets, action, { message: data });
|
|
218
398
|
});
|
|
219
399
|
|
|
220
400
|
it('should set setPreset change colour', async () => {
|
|
221
401
|
const action = PresetsActions.pr02;
|
|
222
|
-
const data = { asd: '123' };
|
|
402
|
+
const data = { asd: '123' } as any;
|
|
223
403
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
224
404
|
expect(unref(currentColourPreset)).not.toBe(data);
|
|
225
405
|
await viewer3cr.setPreset(action, data);
|
|
226
406
|
expect(unref(currentColourPreset)).toStrictEqual(data);
|
|
227
|
-
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.presets, action, data);
|
|
407
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.presets, action, { message: data });
|
|
228
408
|
});
|
|
229
409
|
});
|
|
230
410
|
|
|
@@ -235,8 +415,10 @@ describe('Viewer3cr tests', () => {
|
|
|
235
415
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
236
416
|
await viewer3cr.scanMovementHandler(action, value);
|
|
237
417
|
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.scan_movement, action, {
|
|
238
|
-
|
|
239
|
-
|
|
418
|
+
message: {
|
|
419
|
+
Version: expect.any(String),
|
|
420
|
+
Value: value
|
|
421
|
+
}
|
|
240
422
|
});
|
|
241
423
|
});
|
|
242
424
|
|
|
@@ -247,117 +429,133 @@ describe('Viewer3cr tests', () => {
|
|
|
247
429
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
248
430
|
await viewer3cr.scanMovementHandler(action, value);
|
|
249
431
|
expect(sendPayload).not.toHaveBeenCalledWith(FrontEndInterfaces.scan_movement, action, {
|
|
250
|
-
|
|
251
|
-
|
|
432
|
+
message: {
|
|
433
|
+
Version: expect.any(String),
|
|
434
|
+
Value: value
|
|
435
|
+
}
|
|
252
436
|
});
|
|
253
437
|
});
|
|
254
438
|
|
|
255
439
|
it('should pan left', async () => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
Movement: movement
|
|
263
|
-
});
|
|
440
|
+
await viewer3cr.panLeft({} as any);
|
|
441
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
442
|
+
FrontEndInterfaces.scan_movement,
|
|
443
|
+
ScanMovementActions.sm13,
|
|
444
|
+
expect.any(Object)
|
|
445
|
+
);
|
|
264
446
|
});
|
|
265
447
|
|
|
266
448
|
it('should pan right', async () => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
Movement: movement
|
|
274
|
-
});
|
|
449
|
+
await viewer3cr.panRight({} as any);
|
|
450
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
451
|
+
FrontEndInterfaces.scan_movement,
|
|
452
|
+
ScanMovementActions.sm14,
|
|
453
|
+
expect.any(Object)
|
|
454
|
+
);
|
|
275
455
|
});
|
|
276
456
|
|
|
277
457
|
it('should pan up', async () => {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
Movement: movement
|
|
285
|
-
});
|
|
458
|
+
await viewer3cr.panUp({} as any);
|
|
459
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
460
|
+
FrontEndInterfaces.scan_movement,
|
|
461
|
+
ScanMovementActions.sm15,
|
|
462
|
+
expect.any(Object)
|
|
463
|
+
);
|
|
286
464
|
});
|
|
287
465
|
|
|
288
466
|
it('should pan down', async () => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
Movement: movement
|
|
296
|
-
});
|
|
467
|
+
await viewer3cr.panDown({} as any);
|
|
468
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
469
|
+
FrontEndInterfaces.scan_movement,
|
|
470
|
+
ScanMovementActions.sm16,
|
|
471
|
+
expect.any(Object)
|
|
472
|
+
);
|
|
297
473
|
});
|
|
298
474
|
|
|
299
475
|
it('should zoom in', async () => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
Movement: movement
|
|
307
|
-
});
|
|
476
|
+
await viewer3cr.zoomIn({} as any);
|
|
477
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
478
|
+
FrontEndInterfaces.scan_movement,
|
|
479
|
+
ScanMovementActions.sm17,
|
|
480
|
+
expect.any(Object)
|
|
481
|
+
);
|
|
308
482
|
});
|
|
309
483
|
|
|
310
484
|
it('should zoom out', async () => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
485
|
+
await viewer3cr.zoomOut({} as any);
|
|
486
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
487
|
+
FrontEndInterfaces.scan_movement,
|
|
488
|
+
ScanMovementActions.sm18,
|
|
489
|
+
expect.any(Object)
|
|
490
|
+
);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
it('should pan', async () => {
|
|
494
|
+
await viewer3cr.pan({} as any);
|
|
495
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
496
|
+
FrontEndInterfaces.scan_movement,
|
|
497
|
+
ScanMovementActions.sm26,
|
|
498
|
+
expect.any(Object)
|
|
499
|
+
);
|
|
319
500
|
});
|
|
320
501
|
});
|
|
321
502
|
|
|
322
503
|
describe('scan orientation actions', () => {
|
|
323
504
|
it('should rotateByDeg', async () => {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
View: view,
|
|
331
|
-
Angle: deg
|
|
332
|
-
});
|
|
505
|
+
await viewer3cr.rotateByDeg({} as any);
|
|
506
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
507
|
+
FrontEndInterfaces.scan_orientation,
|
|
508
|
+
ScanOrientationActions.so01,
|
|
509
|
+
expect.any(Object)
|
|
510
|
+
);
|
|
333
511
|
});
|
|
334
512
|
|
|
335
513
|
it('should flip 2d view horizontally', async () => {
|
|
336
|
-
await viewer3cr.flipHorizontally(
|
|
337
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
514
|
+
await viewer3cr.flipHorizontally({} as any);
|
|
515
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
516
|
+
FrontEndInterfaces.scan_orientation,
|
|
517
|
+
ScanOrientationActions.so02,
|
|
518
|
+
expect.any(Object)
|
|
519
|
+
);
|
|
342
520
|
});
|
|
343
521
|
|
|
344
522
|
it('should flip 2d view vertically', async () => {
|
|
345
|
-
await viewer3cr.flipVertically(
|
|
346
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
523
|
+
await viewer3cr.flipVertically({} as any);
|
|
524
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
525
|
+
FrontEndInterfaces.scan_orientation,
|
|
526
|
+
ScanOrientationActions.so03,
|
|
527
|
+
expect.any(Object)
|
|
528
|
+
);
|
|
351
529
|
});
|
|
352
530
|
|
|
353
531
|
it('should invert transform', async () => {
|
|
354
|
-
await viewer3cr.invertTransform(
|
|
355
|
-
expect(sendPayload).toHaveBeenCalledWith(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
532
|
+
await viewer3cr.invertTransform({} as any);
|
|
533
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
534
|
+
FrontEndInterfaces.scan_orientation,
|
|
535
|
+
ScanOrientationActions.so04,
|
|
536
|
+
expect.any(Object)
|
|
537
|
+
);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
describe('view selection actions', () => {
|
|
541
|
+
for (const action of Object.keys(ViewSelectionActions)) {
|
|
542
|
+
it('should viewSelection', async () => {
|
|
543
|
+
expect(sendPayload).not.toHaveBeenCalled();
|
|
544
|
+
await viewer3cr.viewSelection(action as ViewSelectionActions);
|
|
545
|
+
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.view_selection, action, {
|
|
546
|
+
message: {
|
|
547
|
+
Version: expect.any(String)
|
|
548
|
+
}
|
|
549
|
+
});
|
|
360
550
|
});
|
|
551
|
+
}
|
|
552
|
+
it('should viewSelectionToggleView', async () => {
|
|
553
|
+
await viewer3cr.viewSelectionToggleView({} as any);
|
|
554
|
+
expect(sendPayload).toHaveBeenCalledWith(
|
|
555
|
+
FrontEndInterfaces.view_selection,
|
|
556
|
+
ViewSelectionActions.vs07,
|
|
557
|
+
expect.any(Object)
|
|
558
|
+
);
|
|
361
559
|
});
|
|
362
560
|
});
|
|
363
561
|
|
|
@@ -372,8 +570,10 @@ describe('Viewer3cr tests', () => {
|
|
|
372
570
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
373
571
|
await viewer3cr.sliderHandler(action, value);
|
|
374
572
|
expect(sendPayload).toHaveBeenCalledWith(FrontEndInterfaces.sliders, action, {
|
|
375
|
-
|
|
376
|
-
|
|
573
|
+
message: {
|
|
574
|
+
Version: expect.any(String),
|
|
575
|
+
Value: value
|
|
576
|
+
}
|
|
377
577
|
});
|
|
378
578
|
});
|
|
379
579
|
|
|
@@ -384,9 +584,233 @@ describe('Viewer3cr tests', () => {
|
|
|
384
584
|
expect(sendPayload).not.toHaveBeenCalled();
|
|
385
585
|
await viewer3cr.sliderHandler(action, value);
|
|
386
586
|
expect(sendPayload).not.toHaveBeenCalledWith(FrontEndInterfaces.sliders, action, {
|
|
387
|
-
|
|
388
|
-
|
|
587
|
+
message: {
|
|
588
|
+
Version: expect.any(String),
|
|
589
|
+
Value: value
|
|
590
|
+
}
|
|
389
591
|
});
|
|
390
592
|
});
|
|
391
593
|
});
|
|
392
594
|
});
|
|
595
|
+
|
|
596
|
+
describe('Viewer3CR payloads', () => {
|
|
597
|
+
const viewer3cr = new Viewer3crServiceImpl();
|
|
598
|
+
const execMockRef = executePayload as Mock<typeof executePayload>;
|
|
599
|
+
|
|
600
|
+
beforeEach(() => {
|
|
601
|
+
execMockRef.mockClear();
|
|
602
|
+
execMockRef.mockResolvedValue();
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
it('should sendPayload', async () => {
|
|
606
|
+
const iface = FrontEndInterfaces.sliders;
|
|
607
|
+
const action = SlidersActions.sl08;
|
|
608
|
+
|
|
609
|
+
await viewer3cr.sendPayload(iface, action, {} as any);
|
|
610
|
+
|
|
611
|
+
await flushPromises();
|
|
612
|
+
expect(execMockRef).toHaveBeenCalledWith({
|
|
613
|
+
Version: '0.0.1',
|
|
614
|
+
Interface: iface,
|
|
615
|
+
Action: action,
|
|
616
|
+
Message: expect.toBeTypeOrNull(String),
|
|
617
|
+
ReturnChannel: expect.toBeTypeOrNull(String),
|
|
618
|
+
ReturnTo: expect.toBeTypeOrNull(String)
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
it('should sendPayload with message JSON', async () => {
|
|
623
|
+
const iface = FrontEndInterfaces.sliders;
|
|
624
|
+
const action = SlidersActions.sl08;
|
|
625
|
+
|
|
626
|
+
const messageJSON = {
|
|
627
|
+
Value: '123'
|
|
628
|
+
};
|
|
629
|
+
await viewer3cr.sendPayload(iface, action, {
|
|
630
|
+
message: messageJSON
|
|
631
|
+
} as any);
|
|
632
|
+
|
|
633
|
+
await flushPromises();
|
|
634
|
+
expect(execMockRef).toHaveBeenCalledWith({
|
|
635
|
+
Version: '0.0.1',
|
|
636
|
+
Interface: iface,
|
|
637
|
+
Action: action,
|
|
638
|
+
Message: JSON.stringify(messageJSON),
|
|
639
|
+
ReturnChannel: expect.toBeTypeOrNull(String),
|
|
640
|
+
ReturnTo: expect.toBeTypeOrNull(String)
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
it('should sendPayload with returnChannel JSON', async () => {
|
|
645
|
+
const iface = FrontEndInterfaces.sliders;
|
|
646
|
+
const action = SlidersActions.sl08;
|
|
647
|
+
|
|
648
|
+
const returnChannelJSON = {
|
|
649
|
+
Value: '123'
|
|
650
|
+
};
|
|
651
|
+
await viewer3cr.sendPayload(iface, action, {
|
|
652
|
+
returnChannel: returnChannelJSON
|
|
653
|
+
} as any);
|
|
654
|
+
|
|
655
|
+
await flushPromises();
|
|
656
|
+
expect(execMockRef).toHaveBeenCalledWith({
|
|
657
|
+
Version: '0.0.1',
|
|
658
|
+
Interface: iface,
|
|
659
|
+
Action: action,
|
|
660
|
+
Message: expect.toBeTypeOrNull(String),
|
|
661
|
+
ReturnChannel: JSON.stringify(returnChannelJSON),
|
|
662
|
+
ReturnTo: expect.toBeTypeOrNull(String)
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
describe('Viewer3CR callbacks', () => {
|
|
667
|
+
let viewer3cr = new Viewer3crServiceImpl();
|
|
668
|
+
const execMockRef = executePayload as Mock<typeof executePayload>;
|
|
669
|
+
const interfaceCallback = vi.fn();
|
|
670
|
+
const actionCallback = vi.fn();
|
|
671
|
+
|
|
672
|
+
beforeEach(() => {
|
|
673
|
+
execMockRef.mockClear();
|
|
674
|
+
execMockRef.mockResolvedValue();
|
|
675
|
+
interfaceCallback.mockClear();
|
|
676
|
+
actionCallback.mockClear();
|
|
677
|
+
viewer3cr = new Viewer3crServiceImpl();
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
for (const iface of Object.keys(FrontEndInterfaces)) {
|
|
681
|
+
it(`should call interface callbacks onPayload [${iface}]`, async () => {
|
|
682
|
+
const ifaceTyped: FrontEndInterfaces = iface as FrontEndInterfaces;
|
|
683
|
+
const action = SlidersActions.sl08;
|
|
684
|
+
|
|
685
|
+
viewer3cr.addInterfaceHandler(ifaceTyped, interfaceCallback);
|
|
686
|
+
|
|
687
|
+
const payload = {
|
|
688
|
+
Version: '0.0.1',
|
|
689
|
+
Interface: ifaceTyped,
|
|
690
|
+
Action: action,
|
|
691
|
+
Message: null,
|
|
692
|
+
ReturnChannel: null,
|
|
693
|
+
ReturnTo: null
|
|
694
|
+
};
|
|
695
|
+
await viewer3cr.onPayload(payload);
|
|
696
|
+
|
|
697
|
+
await flushPromises();
|
|
698
|
+
expect(interfaceCallback).toHaveBeenCalledWith(
|
|
699
|
+
expect.toBeTypeOrNull(String),
|
|
700
|
+
action,
|
|
701
|
+
expect.toBeTypeOrNull(String),
|
|
702
|
+
expect.toBeTypeOrNull(String)
|
|
703
|
+
);
|
|
704
|
+
});
|
|
705
|
+
it(`should call interface callbacks onPayload [${iface}] and not on removal`, async () => {
|
|
706
|
+
const ifaceTyped: FrontEndInterfaces = iface as FrontEndInterfaces;
|
|
707
|
+
const action = SlidersActions.sl08;
|
|
708
|
+
|
|
709
|
+
viewer3cr.addInterfaceHandler(ifaceTyped, interfaceCallback);
|
|
710
|
+
|
|
711
|
+
const payload = {
|
|
712
|
+
Version: '0.0.1',
|
|
713
|
+
Interface: ifaceTyped,
|
|
714
|
+
Action: action,
|
|
715
|
+
Message: null,
|
|
716
|
+
ReturnChannel: null,
|
|
717
|
+
ReturnTo: null
|
|
718
|
+
};
|
|
719
|
+
await viewer3cr.onPayload(payload);
|
|
720
|
+
|
|
721
|
+
await flushPromises();
|
|
722
|
+
expect(interfaceCallback).toHaveBeenCalledWith(
|
|
723
|
+
expect.toBeTypeOrNull(String),
|
|
724
|
+
action,
|
|
725
|
+
expect.toBeTypeOrNull(String),
|
|
726
|
+
expect.toBeTypeOrNull(String)
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
interfaceCallback.mockClear();
|
|
730
|
+
|
|
731
|
+
viewer3cr.removeInterfaceHandler(ifaceTyped, interfaceCallback);
|
|
732
|
+
|
|
733
|
+
await viewer3cr.onPayload(payload);
|
|
734
|
+
|
|
735
|
+
await flushPromises();
|
|
736
|
+
expect(interfaceCallback).not.toHaveBeenCalledWith(
|
|
737
|
+
expect.toBeTypeOrNull(String),
|
|
738
|
+
action,
|
|
739
|
+
expect.toBeTypeOrNull(String),
|
|
740
|
+
expect.toBeTypeOrNull(String)
|
|
741
|
+
);
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
for (const actionSet of [
|
|
746
|
+
DataOverlaysActions,
|
|
747
|
+
FileManagementActions,
|
|
748
|
+
InteractivityActions,
|
|
749
|
+
LayoutActions,
|
|
750
|
+
MarkupsActions,
|
|
751
|
+
McadActions,
|
|
752
|
+
NavigationCubeActions,
|
|
753
|
+
PresetsActions,
|
|
754
|
+
ScanMovementActions,
|
|
755
|
+
ScanOrientationActions,
|
|
756
|
+
SlidersActions,
|
|
757
|
+
ViewSelectionActions
|
|
758
|
+
]) {
|
|
759
|
+
for (const action of Object.keys(actionSet)) {
|
|
760
|
+
const ifaceTyped: FrontEndInterfaces = FrontEndInterfaces.file_management;
|
|
761
|
+
it(`should call action callbacks onPayload [${action}]`, async () => {
|
|
762
|
+
viewer3cr.addActionHandler(action, actionCallback);
|
|
763
|
+
|
|
764
|
+
const payload = {
|
|
765
|
+
Version: '0.0.1',
|
|
766
|
+
Interface: ifaceTyped,
|
|
767
|
+
Action: action,
|
|
768
|
+
Message: null,
|
|
769
|
+
ReturnChannel: null,
|
|
770
|
+
ReturnTo: null
|
|
771
|
+
};
|
|
772
|
+
await viewer3cr.onPayload(payload);
|
|
773
|
+
|
|
774
|
+
await flushPromises();
|
|
775
|
+
expect(actionCallback).toHaveBeenCalledWith(
|
|
776
|
+
expect.toBeTypeOrNull(String),
|
|
777
|
+
expect.toBeTypeOrNull(String),
|
|
778
|
+
expect.toBeTypeOrNull(String)
|
|
779
|
+
);
|
|
780
|
+
});
|
|
781
|
+
it(`should call action callbacks onPayload [${action}] and not on removal`, async () => {
|
|
782
|
+
viewer3cr.addActionHandler(action, actionCallback);
|
|
783
|
+
|
|
784
|
+
const payload = {
|
|
785
|
+
Version: '0.0.1',
|
|
786
|
+
Interface: ifaceTyped,
|
|
787
|
+
Action: action,
|
|
788
|
+
Message: null,
|
|
789
|
+
ReturnChannel: null,
|
|
790
|
+
ReturnTo: null
|
|
791
|
+
};
|
|
792
|
+
await viewer3cr.onPayload(payload);
|
|
793
|
+
|
|
794
|
+
await flushPromises();
|
|
795
|
+
expect(actionCallback).toHaveBeenCalledWith(
|
|
796
|
+
expect.toBeTypeOrNull(String),
|
|
797
|
+
expect.toBeTypeOrNull(String),
|
|
798
|
+
expect.toBeTypeOrNull(String)
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
actionCallback.mockClear();
|
|
802
|
+
|
|
803
|
+
viewer3cr.removeActionHandler(action, actionCallback);
|
|
804
|
+
|
|
805
|
+
await viewer3cr.onPayload(payload);
|
|
806
|
+
|
|
807
|
+
await flushPromises();
|
|
808
|
+
expect(actionCallback).not.toHaveBeenCalledWith(
|
|
809
|
+
expect.toBeTypeOrNull(String),
|
|
810
|
+
expect.toBeTypeOrNull(String),
|
|
811
|
+
expect.toBeTypeOrNull(String)
|
|
812
|
+
);
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
});
|