@3cr/viewer-browser 0.0.200 → 0.0.220
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 +46 -22
- package/.prettierrc +6 -0
- package/components.d.ts +23 -10
- package/dist/Viewer3CR.js +37 -46
- package/dist/Viewer3CR.mjs +22625 -20892
- package/dist/Viewer3CR.umd.js +37 -46
- package/dist/android-chrome-192x192.png +0 -0
- package/dist/android-chrome-512x512.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/browserconfig.xml +9 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/mstile-144x144.png +0 -0
- package/dist/mstile-150x150.png +0 -0
- package/dist/mstile-310x150.png +0 -0
- package/dist/mstile-310x310.png +0 -0
- package/dist/mstile-70x70.png +0 -0
- package/dist/safari-pinned-tab.svg +50 -0
- package/dist/site.webmanifest +19 -0
- package/index.html +34 -41
- package/package.json +23 -20
- package/playground/android-chrome-192x192.png +0 -0
- package/playground/android-chrome-512x512.png +0 -0
- package/playground/apple-touch-icon.png +0 -0
- package/playground/browserconfig.xml +9 -0
- package/playground/favicon-16x16.png +0 -0
- package/playground/favicon-32x32.png +0 -0
- package/playground/favicon.ico +0 -0
- package/playground/index.html +26 -29
- package/playground/mstile-144x144.png +0 -0
- package/playground/mstile-150x150.png +0 -0
- package/playground/mstile-310x150.png +0 -0
- package/playground/mstile-310x310.png +0 -0
- package/playground/mstile-70x70.png +0 -0
- package/playground/safari-pinned-tab.svg +50 -0
- package/playground/site.webmanifest +19 -0
- package/playground/sw.js +15 -1
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/browserconfig.xml +9 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/mstile-144x144.png +0 -0
- package/public/mstile-150x150.png +0 -0
- package/public/mstile-310x150.png +0 -0
- package/public/mstile-310x310.png +0 -0
- package/public/mstile-70x70.png +0 -0
- package/public/safari-pinned-tab.svg +50 -0
- package/public/site.webmanifest +19 -0
- package/src/App.vue +35 -45
- package/src/__tests__/app.spec.ts +7 -8
- package/{__tests__/index.spec.ts → src/__tests__/main.spec.ts} +5 -6
- package/src/assets/logos/3dicom/white-mini.svg +20 -0
- package/src/assets/logos/3dicom/white.svg +30 -0
- package/src/assets/styles.scss +14 -4
- package/src/components/demo/__tests__/DemoModal.spec.ts +9 -8
- package/src/components/demo/__tests__/DemoPatientModal.spec.ts +11 -10
- package/src/components/demo/__tests__/options.spec.ts +1 -1
- package/src/components/demo/licence/__tests__/DemoLicenceEnableCloudStorageModal.spec.ts +11 -10
- package/src/components/demo/licence/__tests__/DemoLicenceInfoModal.spec.ts +21 -11
- package/src/components/demo/licence/__tests__/DemoLicenceSendToPartyModal.spec.ts +10 -10
- package/src/components/demo/licence/__tests__/DemoLicenceShareToMobileModal.spec.ts +14 -13
- package/src/components/demo/options.ts +54 -59
- package/src/components/demo/patient/__tests__/DemoPatientEnableCloudStorageModal.spec.ts +11 -10
- package/src/components/demo/patient/__tests__/DemoPatientInfoModal.spec.ts +12 -11
- package/src/components/demo/patient/__tests__/DemoPatientSendToPartyModal.spec.ts +10 -10
- package/src/components/demo/patient/__tests__/DemoPatientShareToMobileModal.spec.ts +14 -13
- package/src/components/modal/ActionRail.vue +7 -11
- package/src/components/modal/AskAI.vue +35 -50
- package/src/components/modal/CloseViewerModal.vue +22 -57
- package/src/components/modal/MftpWebGL3DRModal.vue +152 -570
- package/src/components/modal/ViewerActionRail.vue +50 -39
- package/src/components/modal/ViewerNavigationDrawer.vue +10 -8
- package/src/components/modal/ViewerNavigationDrawerContent.vue +82 -49
- package/src/components/modal/ViewerNavigationDrawerFooter.vue +57 -60
- package/src/components/modal/ViewerNavigationDrawerHeader.vue +13 -48
- package/src/components/modal/ViewerScanView.vue +114 -0
- package/src/components/modal/WebGL3DR.vue +84 -0
- package/src/components/modal/__tests__/ActionRail.spec.ts +10 -0
- package/src/components/modal/__tests__/AskAI.spec.ts +33 -0
- package/src/components/modal/__tests__/CloseViewerModal.spec.ts +24 -14
- package/src/components/modal/__tests__/MftpWebGL3DRModal.spec.ts +147 -176
- package/src/components/modal/__tests__/ViewerActionRail.spec.ts +11 -0
- package/src/components/modal/__tests__/ViewerNavigationDrawer.spec.ts +10 -12
- package/src/components/modal/__tests__/ViewerNavigationDrawerContent.spec.ts +4 -22
- package/src/components/modal/__tests__/ViewerNavigationDrawerFooter.spec.ts +35 -32
- package/src/components/modal/__tests__/ViewerNavigationDrawerHeader.spec.ts +11 -9
- package/src/components/modal/__tests__/ViewerScanView.spec.ts +60 -0
- package/src/components/modal/__tests__/WebGL3DR.spec.ts +57 -0
- package/src/components/modal/actions/Flip3dAction.vue +1 -1
- package/src/components/modal/actions/FlipHorizontalAction.vue +5 -10
- package/src/components/modal/actions/FlipVerticalAction.vue +5 -10
- package/src/components/modal/actions/FullscreenAction.vue +6 -11
- package/src/components/modal/actions/HideViewAction.vue +38 -0
- package/src/components/modal/actions/NavigationCubeAction.vue +7 -14
- package/src/components/modal/actions/PanAction.vue +4 -4
- package/src/components/modal/actions/ResetViewAction.vue +1 -1
- package/src/components/modal/actions/Rotate2dAction.vue +8 -20
- package/src/components/modal/actions/Slice3dAction.vue +10 -32
- package/src/components/modal/actions/ZoomAction.vue +1 -1
- package/src/components/modal/actions/__tests__/Action.spec.ts +8 -9
- package/src/components/modal/actions/__tests__/Flip3dAction.spec.ts +6 -8
- package/src/components/modal/actions/__tests__/FlipHorizontalAction.spec.ts +6 -7
- package/src/components/modal/actions/__tests__/FlipVerticalAction.spec.ts +6 -7
- package/src/components/modal/actions/__tests__/FullscreenAction.spec.ts +9 -10
- package/src/components/modal/actions/__tests__/NavigationCubeAction.spec.ts +11 -11
- package/src/components/modal/actions/__tests__/PanAction.spec.ts +9 -10
- package/src/components/modal/actions/__tests__/ResetViewAction.spec.ts +7 -7
- package/src/components/modal/actions/__tests__/Rotate2dAction.spec.ts +6 -8
- package/src/components/modal/actions/__tests__/Slice3dAction.spec.ts +23 -5
- package/src/components/modal/actions/__tests__/ZoomAction.spec.ts +8 -10
- package/src/components/modal/buttons/AutoAnnotateBtn.vue +29 -0
- package/src/components/modal/buttons/__tests__/AutoAnnotateBtn.spec.ts +28 -0
- package/src/components/modal/menus/FileMenu.vue +80 -0
- package/src/components/modal/menus/SettingsMenu.vue +111 -0
- package/src/components/modal/menus/__tests__/FileMenu.spec.ts +110 -0
- package/src/components/modal/menus/__tests__/SettingsMenu.spec.ts +71 -0
- package/src/components/shared/DoubleSliderSelector.vue +142 -0
- package/src/components/shared/UpdateSnackbar.vue +72 -0
- package/src/components/{selectors → shared}/ValueSelector.vue +9 -12
- package/src/components/shared/__tests__/DoubleSliderSelector.spec.ts +83 -0
- package/src/components/shared/__tests__/LoadingSpinner.spec.ts +9 -0
- package/src/components/shared/__tests__/UpdateSnackbar.spec.ts +116 -0
- package/src/components/shared/__tests__/ValueSelector.spec.ts +39 -0
- package/src/components/shared/__tests__/VerticalSliderSelector.spec.ts +50 -0
- package/src/components/views/AnnotationTreeView.vue +234 -0
- package/src/components/{modal/ViewerDisplaySettings.vue → views/DisplaySettings.vue} +7 -15
- package/src/components/views/MarkupTreeView.vue +199 -0
- package/src/components/views/McadObjectTreeView.vue +119 -0
- package/src/components/views/__tests__/AnnotationTreeView.spec.ts +62 -0
- package/src/components/{modal/__tests__/ViewerDisplaySettings.spec.ts → views/__tests__/DisplaySettings.spec.ts} +24 -20
- package/src/components/views/__tests__/MarkupTreeView.spec.ts +41 -0
- package/src/components/views/__tests__/McadObjectTreeView.spec.ts +47 -0
- package/src/components/views/modals/DataOverlayModal.vue +89 -0
- package/src/components/views/modals/DataOverlayModalManager.vue +104 -0
- package/src/components/views/modals/__tests__/DataOverlayModal.spec.ts +33 -0
- package/src/components/views/modals/__tests__/DataOverlayModalManager.spec.ts +93 -0
- package/src/components/views/shared/MaskIcon.vue +44 -0
- package/src/components/views/shared/ObjectColor.vue +31 -0
- package/src/components/views/shared/ObjectLabel.vue +30 -0
- package/src/components/views/shared/Opacity.vue +66 -0
- package/src/components/views/shared/VisibilityBtn.vue +25 -0
- package/src/components/views/shared/__tests__/MaskIcon.spec.ts +10 -0
- package/src/components/views/shared/__tests__/ObjectColor.spec.ts +10 -0
- package/src/components/views/shared/__tests__/ObjectLabel.spec.ts +10 -0
- package/src/components/views/shared/__tests__/Opacity.spec.ts +24 -0
- package/src/components/views/shared/__tests__/VisibilityBtn.spec.ts +11 -0
- package/src/components/views/types/annotation-tree-view-item-child-action.ts +6 -0
- package/src/components/views/types/annotation-tree-view-item-child.ts +9 -0
- package/src/components/views/types/annotation-tree-view-item.ts +13 -0
- package/src/components/views/types/markup-tree-view-item-child.ts +6 -0
- package/src/components/views/types/markup-tree-view-item.ts +14 -0
- package/src/components/views/types/mcad-object-tree-view-item.ts +13 -0
- package/src/composables/__tests__/useAnnotations.spec.ts +35 -0
- package/src/composables/__tests__/useEventListener.spec.ts +32 -0
- package/src/composables/__tests__/useIntroJs.spec.ts +51 -0
- package/src/composables/__tests__/useMarkups.spec.ts +39 -0
- package/src/composables/__tests__/useMcadObjects.spec.ts +36 -0
- package/src/composables/__tests__/useMouse.spec.ts +20 -0
- package/src/{components/modal/composables → composables}/__tests__/useNavigationCubeObserver.spec.ts +17 -12
- package/src/{dataLayer → composables}/__tests__/useViewer3cr.spec.ts +1 -2
- package/src/composables/useAnnotations.ts +37 -0
- package/src/composables/useEventListener.ts +25 -0
- package/src/composables/useIntroJs.ts +125 -0
- package/src/composables/useMarkups.ts +41 -0
- package/src/composables/useMcadObjects.ts +32 -0
- package/src/composables/useMouse.ts +14 -0
- package/src/{components/modal/composables → composables}/useNavigationCubeObserver.ts +35 -25
- package/src/composables/useScanMovement.ts +25 -0
- package/src/composables/useScanSliders.ts +36 -0
- package/src/composables/useVersion3cr.ts +7 -0
- package/src/composables/useViewer3cr.ts +7 -0
- package/src/composables/useViewerOptions.ts +35 -0
- package/src/{dataLayer → functions}/__tests__/clamp.spec.ts +1 -2
- package/src/functions/__tests__/layoutOverlayStyle.spec.ts +325 -0
- package/src/{helpers/__tests__/model-helper.spec.ts → functions/__tests__/modelHelper.spec.ts} +77 -40
- package/src/{notifications → functions}/__tests__/notification.spec.ts +19 -29
- package/src/functions/__tests__/parseAction.spec.ts +9 -0
- package/src/functions/__tests__/parseCallToAction.spec.ts +11 -0
- package/src/functions/__tests__/parseDataOverlay.spec.ts +15 -0
- package/src/functions/__tests__/parseDataOverlayData.spec.ts +9 -0
- package/src/functions/__tests__/parseDataOverlayEvent.spec.ts +10 -0
- package/src/functions/__tests__/parseMcadEvent.spec.ts +10 -0
- package/src/functions/layoutOverlayStyle.ts +84 -0
- package/src/{helpers → functions}/modelHelper.ts +79 -18
- package/src/{notifications → functions}/notification.ts +12 -14
- package/src/functions/parseAction.ts +9 -0
- package/src/functions/parseCallToAction.ts +9 -0
- package/src/functions/parseDataOverlay.ts +10 -0
- package/src/functions/parseDataOverlayData.ts +10 -0
- package/src/functions/parseDataOverlayEvent.ts +17 -0
- package/src/functions/parseMcadEvent.ts +10 -0
- package/src/functions/rgbaToCss.ts +13 -0
- package/src/main.ts +48 -9
- package/src/{dataLayer → models}/__tests__/eventHandlers.spec.ts +2 -3
- package/src/models/__tests__/loadViewerOptions.spec.ts +72 -0
- package/src/models/__tests__/loadViewerPayload.spec.ts +10 -0
- package/src/models/__tests__/scanState.spec.ts +190 -0
- package/src/models/callbacks.ts +4 -0
- package/src/models/loadViewerOptions.ts +40 -0
- package/src/models/loadViewerPayload.ts +24 -0
- package/src/{dataLayer → models}/scanState.ts +63 -74
- package/src/plugins/__tests__/usePlugins.spec.ts +12 -0
- package/src/plugins/__tests__/vuetify.spec.ts +3 -4
- package/src/plugins/usePlugins.ts +8 -0
- package/src/plugins/vuetify.ts +31 -65
- package/src/services/{gpt/__tests__ → __tests__}/gpt.service.spec.ts +2 -2
- package/src/services/__tests__/service-worker.service.spec.ts +32 -0
- package/src/{dataLayer/__tests__/viewer3cr.spec.ts → services/__tests__/viewer-3cr.service.spec.ts} +97 -36
- package/src/services/gpt.service.ts +17 -0
- package/src/services/service-worker.service.ts +16 -0
- package/src/{dataLayer/viewer3cr.ts → services/viewer-3cr.service.ts} +269 -150
- package/src/types/action.ts +13 -0
- package/src/types/call-to-action.ts +9 -0
- package/src/types/colour.ts +6 -0
- package/src/types/data-overlay-angle.ts +16 -0
- package/src/types/data-overlay-annotation.ts +18 -0
- package/src/types/data-overlay-data.ts +15 -0
- package/src/types/data-overlay-info.ts +14 -0
- package/src/types/data-overlay-interaction.ts +15 -0
- package/src/types/data-overlay-length.ts +16 -0
- package/src/types/data-overlay-markup.ts +7 -0
- package/src/types/data-overlay-mcad.ts +20 -0
- package/src/types/data-overlay-polygon.ts +18 -0
- package/src/types/data-overlay.ts +16 -0
- package/src/types/gpt-question.ts +4 -0
- package/src/types/gpt-response-payload.ts +6 -0
- package/src/types/mcad-object-interaction.ts +15 -0
- package/src/types/segment-angle.ts +5 -0
- package/src/types/vector2.ts +4 -0
- package/src/types/vector3.ts +5 -0
- package/test/fakers/action-data.faker.ts +11 -0
- package/test/fakers/action.faker.ts +19 -0
- package/test/fakers/call-to-action.faker.ts +17 -0
- package/test/fakers/colour.faker.ts +17 -0
- package/test/fakers/data-overlay-angle.faker.ts +37 -0
- package/test/fakers/data-overlay-annotation.faker.ts +41 -0
- package/test/fakers/data-overlay-data.faker.ts +97 -0
- package/test/fakers/data-overlay-info.faker.ts +29 -0
- package/test/fakers/data-overlay-interaction.faker.ts +62 -0
- package/test/fakers/data-overlay-length.faker.ts +37 -0
- package/test/fakers/data-overlay-mcad.faker.ts +40 -0
- package/test/fakers/data-overlay-polygon.faker.ts +39 -0
- package/test/fakers/gpt-question.faker.ts +11 -0
- package/test/fakers/gpt-response.faker.ts +12 -0
- package/test/fakers/invert-transform.faker.ts +16 -0
- package/test/fakers/mcad-object-interaction.faker.ts +22 -0
- package/test/fakers/orientation.faker.ts +17 -0
- package/test/fakers/segment-angle.faker.ts +12 -0
- package/test/fakers/vector2.faker.ts +12 -0
- package/test/fakers/vector3.faker.ts +16 -0
- package/test/plugins/findByTestId.ts +25 -0
- package/test/plugins/vuetify.ts +16 -0
- package/test/setup.ts +16 -5
- package/tsconfig.json +4 -15
- package/vite.config.mts +20 -46
- package/vitest.config.mts +24 -43
- package/index.ts +0 -72
- package/src/assets/images/dark/3DICOM.png +0 -0
- package/src/assets/images/dark/3dicom-logo.svg +0 -1
- package/src/assets/images/light/3DICOM.png +0 -0
- package/src/assets/images/light/3dicom-logo.svg +0 -1
- package/src/assets/logo.png +0 -0
- package/src/assets/logo.svg +0 -6
- package/src/components/WebGL3DR.vue +0 -102
- package/src/components/__tests__/webgl3dr.spec.ts +0 -37
- package/src/components/icons/liver.vue +0 -21
- package/src/components/loading/__tests__/loading-spinner.spec.ts +0 -11
- package/src/components/modal/ViewerAnnotationModal.vue +0 -111
- package/src/components/modal/ViewerAnnotations.vue +0 -289
- package/src/components/modal/__tests__/ViewerAnnotationModal.spec.ts +0 -79
- package/src/components/modal/composables/useEventListener.ts +0 -22
- package/src/components/selectors/__tests__/value-selector.spec.ts +0 -53
- package/src/components/sliders/DoubleSliderSelector.vue +0 -141
- package/src/components/sliders/__tests__/double-slider-selector.spec.ts +0 -104
- package/src/components/sliders/__tests__/vertical-slider-selector.spec.ts +0 -61
- package/src/dataLayer/__tests__/getIconForPreset.spec.ts +0 -40
- package/src/dataLayer/__tests__/patchDataOverlay.spec.ts +0 -88
- package/src/dataLayer/__tests__/scanState.spec.ts +0 -93
- package/src/dataLayer/getIconForPreset.ts +0 -11
- package/src/dataLayer/patchDataOverlay.ts +0 -101
- package/src/dataLayer/useViewer3cr.ts +0 -7
- package/src/helpers/__tests__/layout-overlay-style.spec.ts +0 -290
- package/src/helpers/__tests__/utils.spec.ts +0 -70
- package/src/helpers/layoutOverlayStyle.ts +0 -96
- package/src/helpers/utils.ts +0 -16
- package/src/models/Callbacks.ts +0 -2
- package/src/models/LoadViewerOptions.ts +0 -31
- package/src/models/LoadViewerPayload.ts +0 -9
- package/src/models/__tests__/load-viewer-options.spec.ts +0 -22
- package/src/plugins/__tests__/index.spec.ts +0 -19
- package/src/plugins/index.ts +0 -17
- package/src/services/gpt/gpt.service.ts +0 -35
- package/static/3cr-types-browser/index.ts +0 -74
- package/static/3cr-types-browser/types/Action.ts +0 -6
- package/static/3cr-types-browser/types/AlphaKeys.ts +0 -5
- package/static/3cr-types-browser/types/AnchorPoint.ts +0 -12
- package/static/3cr-types-browser/types/CallToAction.ts +0 -5
- package/static/3cr-types-browser/types/ColourData.ts +0 -7
- package/static/3cr-types-browser/types/ColourPresetData.ts +0 -9
- package/static/3cr-types-browser/types/CurrentDataOverlayState.ts +0 -6
- package/static/3cr-types-browser/types/CurrentScanState.ts +0 -22
- package/static/3cr-types-browser/types/DataOverlay.ts +0 -22
- package/static/3cr-types-browser/types/DataOverlayActions.ts +0 -14
- package/static/3cr-types-browser/types/DataOverlayData.ts +0 -8
- package/static/3cr-types-browser/types/DataOverlayEvent.ts +0 -8
- package/static/3cr-types-browser/types/DecryptionKey.ts +0 -4
- package/static/3cr-types-browser/types/DisplaySettings.ts +0 -10
- package/static/3cr-types-browser/types/EmptyPayload.ts +0 -3
- package/static/3cr-types-browser/types/EnumPayload.ts +0 -4
- package/static/3cr-types-browser/types/FileManagementActions.ts +0 -11
- package/static/3cr-types-browser/types/FlipValue.ts +0 -7
- package/static/3cr-types-browser/types/FrontEndInterfaces.ts +0 -14
- package/static/3cr-types-browser/types/GradientKeys.ts +0 -7
- package/static/3cr-types-browser/types/GreyscalePresetData.ts +0 -6
- package/static/3cr-types-browser/types/InitialDataOverlayState.ts +0 -6
- package/static/3cr-types-browser/types/InitialScanState.ts +0 -19
- package/static/3cr-types-browser/types/InteractionType.ts +0 -8
- package/static/3cr-types-browser/types/InteractivityActions.ts +0 -6
- package/static/3cr-types-browser/types/InteractivityState.ts +0 -4
- package/static/3cr-types-browser/types/InvertTransformData.ts +0 -6
- package/static/3cr-types-browser/types/LayoutActions.ts +0 -6
- package/static/3cr-types-browser/types/LayoutData.ts +0 -7
- package/static/3cr-types-browser/types/LoadDataSet.ts +0 -6
- package/static/3cr-types-browser/types/LoadSessionState.ts +0 -4
- package/static/3cr-types-browser/types/LocalLoadDataset.ts +0 -3
- package/static/3cr-types-browser/types/MovementData.ts +0 -7
- package/static/3cr-types-browser/types/NavigationCubeActions.ts +0 -8
- package/static/3cr-types-browser/types/NavigationCubeData.ts +0 -12
- package/static/3cr-types-browser/types/NavigationCubeTransform.ts +0 -9
- package/static/3cr-types-browser/types/NotificationPayload.ts +0 -7
- package/static/3cr-types-browser/types/NotificationsActions.ts +0 -6
- package/static/3cr-types-browser/types/Object.ts +0 -1
- package/static/3cr-types-browser/types/ObjectColour.ts +0 -7
- package/static/3cr-types-browser/types/ObjectIcon.ts +0 -5
- package/static/3cr-types-browser/types/ObjectInvert.ts +0 -7
- package/static/3cr-types-browser/types/ObjectSize.ts +0 -7
- package/static/3cr-types-browser/types/ObjectSize2D.ts +0 -7
- package/static/3cr-types-browser/types/ObjectVisible.ts +0 -5
- package/static/3cr-types-browser/types/PositionData.ts +0 -14
- package/static/3cr-types-browser/types/PresetsActions.ts +0 -4
- package/static/3cr-types-browser/types/RotationValue.ts +0 -7
- package/static/3cr-types-browser/types/ScanMovementActions.ts +0 -27
- package/static/3cr-types-browser/types/ScanMovementData.ts +0 -3
- package/static/3cr-types-browser/types/ScanOrientationActions.ts +0 -6
- package/static/3cr-types-browser/types/ScanStateActions.ts +0 -4
- package/static/3cr-types-browser/types/ScanView.ts +0 -6
- package/static/3cr-types-browser/types/SettingsData.ts +0 -12
- package/static/3cr-types-browser/types/SlicerData.ts +0 -9
- package/static/3cr-types-browser/types/SliderValue.ts +0 -4
- package/static/3cr-types-browser/types/SlidersActions.ts +0 -18
- package/static/3cr-types-browser/types/Vector2Data.ts +0 -5
- package/static/3cr-types-browser/types/Vector3Data.ts +0 -6
- package/static/3cr-types-browser/types/VectorMovementData.ts +0 -8
- package/static/3cr-types-browser/types/ViewInteractiveMode.ts +0 -5
- package/static/3cr-types-browser/types/ViewOrientation.ts +0 -8
- package/static/3cr-types-browser/types/ViewOrientations.ts +0 -10
- package/static/3cr-types-browser/types/ViewSelectionActions.ts +0 -9
- package/static/3cr-types-browser/types/ViewToggleData.ts +0 -7
- package/static/3cr-types-browser/types/VolumeOrientation.ts +0 -7
- package/test/helper.ts +0 -44
- /package/src/components/{loading → shared}/LoadingSpinner.vue +0 -0
- /package/src/components/{sliders → shared}/VerticalSliderSelector.vue +0 -0
- /package/{config.ts → src/config.ts} +0 -0
- /package/src/{dataLayer → functions}/clamp.ts +0 -0
- /package/src/{dataLayer → models}/eventHandlers.ts +0 -0
- /package/{static/3cr-types-browser/types/ActionData.ts → src/types/action-data.ts} +0 -0
|
@@ -1,40 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { inflateInitialScanState, inflateScanState } from '@/functions/modelHelper';
|
|
2
|
+
import {
|
|
3
|
+
currentColourPreset,
|
|
4
|
+
currentGreyscalePreset,
|
|
5
|
+
setInitialScanStateFromPayload,
|
|
6
|
+
setScanState,
|
|
7
|
+
thresholdSlider,
|
|
8
|
+
windowSlider
|
|
9
|
+
} from '@/models/scanState';
|
|
10
|
+
import { ColourPresetData } from '@3cr/types-ts';
|
|
11
|
+
import { VRangeSlider } from 'vuetify/components';
|
|
12
|
+
import { mount } from '@vue/test-utils';
|
|
13
|
+
import ViewerDisplaySettings from '@/components/views/DisplaySettings.vue';
|
|
14
|
+
import DoubleSliderSelector from '@/components/shared/DoubleSliderSelector.vue';
|
|
9
15
|
|
|
10
16
|
describe('ViewerDisplaySettings tests', () => {
|
|
11
17
|
it('should mount', () => {
|
|
12
|
-
const wrapper =
|
|
18
|
+
const wrapper = mount(ViewerDisplaySettings);
|
|
13
19
|
expect(wrapper).toBeTruthy();
|
|
14
20
|
});
|
|
15
21
|
|
|
16
22
|
describe('sliders', async () => {
|
|
17
|
-
const wrapper =
|
|
23
|
+
const wrapper = mount(ViewerDisplaySettings);
|
|
18
24
|
const sliders = wrapper.findAllComponents(DoubleSliderSelector);
|
|
19
25
|
|
|
20
26
|
it('should test window slider', async () => {
|
|
21
|
-
const
|
|
22
|
-
await
|
|
23
|
-
await textFields[1].setValue(40);
|
|
27
|
+
const slider = sliders[0].findComponent(VRangeSlider);
|
|
28
|
+
await slider.setValue([20, 40]);
|
|
24
29
|
expect(windowSlider.value).toStrictEqual([20, 40]);
|
|
25
30
|
});
|
|
26
31
|
|
|
27
32
|
it('should test threshold slider', async () => {
|
|
28
|
-
const
|
|
29
|
-
await
|
|
30
|
-
await textFields[1].setValue(80);
|
|
33
|
+
const slider = sliders[1].findComponent(VRangeSlider);
|
|
34
|
+
await slider.setValue([50, 80]);
|
|
31
35
|
expect(thresholdSlider.value).toStrictEqual([50, 80]);
|
|
32
36
|
});
|
|
33
37
|
});
|
|
34
38
|
|
|
35
39
|
it('should set greyscale preset', async () => {
|
|
36
40
|
const initial = inflateInitialScanState();
|
|
37
|
-
initial.GreyscalePresets = [{ Name:
|
|
41
|
+
initial.GreyscalePresets = [{ Name: 'testing', Lower: 30, Upper: 60, Version: '1.0.0' }];
|
|
38
42
|
setInitialScanStateFromPayload(JSON.stringify(initial));
|
|
39
43
|
|
|
40
44
|
const scanState = inflateScanState();
|
|
@@ -42,7 +46,7 @@ describe('ViewerDisplaySettings tests', () => {
|
|
|
42
46
|
scanState.Display.WindowUpper = 60;
|
|
43
47
|
setScanState(JSON.stringify(scanState));
|
|
44
48
|
|
|
45
|
-
const wrapper =
|
|
49
|
+
const wrapper = mount(ViewerDisplaySettings);
|
|
46
50
|
const greyscale = wrapper.findComponent('[data-testid="greyscale"]');
|
|
47
51
|
await greyscale.setValue(initial.GreyscalePresets[0]);
|
|
48
52
|
expect(currentGreyscalePreset.value).toStrictEqual(initial.GreyscalePresets[0]);
|
|
@@ -50,10 +54,10 @@ describe('ViewerDisplaySettings tests', () => {
|
|
|
50
54
|
|
|
51
55
|
it('should set colour preset', async () => {
|
|
52
56
|
const initial = inflateInitialScanState();
|
|
53
|
-
initial.ColourPresets = [{ Name:
|
|
57
|
+
initial.ColourPresets = [{ Name: 'testing' } as ColourPresetData];
|
|
54
58
|
setInitialScanStateFromPayload(JSON.stringify(initial));
|
|
55
59
|
|
|
56
|
-
const wrapper =
|
|
60
|
+
const wrapper = mount(ViewerDisplaySettings);
|
|
57
61
|
const colour = wrapper.findComponent('[data-testid="colour"]');
|
|
58
62
|
await colour.setValue(initial.ColourPresets[0]);
|
|
59
63
|
expect(currentColourPreset.value).toStrictEqual(initial.ColourPresets[0]);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import MarkupTreeView from '@/components/views/MarkupTreeView.vue';
|
|
3
|
+
import { DataOverlayDataFaker } from '@test/fakers/data-overlay-data.faker';
|
|
4
|
+
import { DataOverlayType } from '@3cr/types-ts';
|
|
5
|
+
import VisibilityBtn from '@/components/views/shared/VisibilityBtn.vue';
|
|
6
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
7
|
+
import ObjectLabel from '@/components/views/shared/ObjectLabel.vue';
|
|
8
|
+
|
|
9
|
+
const items = [
|
|
10
|
+
DataOverlayDataFaker.length(),
|
|
11
|
+
DataOverlayDataFaker.polygon(),
|
|
12
|
+
DataOverlayDataFaker.angle(),
|
|
13
|
+
{ ...DataOverlayDataFaker.angle(), DataType: DataOverlayType._ErrorEntity }
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
describe('MarkupTreeView tests', () => {
|
|
17
|
+
it('should mount', () => {
|
|
18
|
+
const props = { items };
|
|
19
|
+
const wrapper = mount(MarkupTreeView, { props });
|
|
20
|
+
expect(wrapper).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should toggle visibility', async () => {
|
|
24
|
+
const viewer3cr = useViewer3cr();
|
|
25
|
+
const spy = vi.spyOn(viewer3cr, 'setMarkupVisibility').mockImplementation(vi.fn());
|
|
26
|
+
const props = { items };
|
|
27
|
+
const wrapper = mount(MarkupTreeView, { props });
|
|
28
|
+
await wrapper.findComponent(VisibilityBtn).trigger('click');
|
|
29
|
+
expect(spy).toHaveBeenCalled();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should focus slices', async () => {
|
|
33
|
+
const viewer3cr = useViewer3cr();
|
|
34
|
+
const spy = vi.spyOn(viewer3cr, 'sliderHandler').mockImplementation(vi.fn());
|
|
35
|
+
const props = { items };
|
|
36
|
+
const wrapper = mount(MarkupTreeView, { props });
|
|
37
|
+
await wrapper.findComponent(ObjectLabel).trigger('click');
|
|
38
|
+
await wrapper.findComponent(ObjectLabel).trigger('click');
|
|
39
|
+
expect(spy).toHaveBeenCalledTimes(3);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { faker } from '@faker-js/faker';
|
|
3
|
+
import { DataOverlayMcadFaker } from '@test/fakers/data-overlay-mcad.faker';
|
|
4
|
+
import McadObjectTreeView from '@/components/views/McadObjectTreeView.vue';
|
|
5
|
+
import VisibilityBtn from '@/components/views/shared/VisibilityBtn.vue';
|
|
6
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
7
|
+
import Opacity from '@/components/views/shared/Opacity.vue';
|
|
8
|
+
import { useViewerOptions } from '@/composables/useViewerOptions';
|
|
9
|
+
import { VListItem, VMenu } from 'vuetify/components';
|
|
10
|
+
|
|
11
|
+
describe('McadObjectTreeView tests', () => {
|
|
12
|
+
const items = faker.helpers.multiple(DataOverlayMcadFaker.random, { count: 3 });
|
|
13
|
+
|
|
14
|
+
it('should mount', () => {
|
|
15
|
+
const props = { items };
|
|
16
|
+
const wrapper = mount(McadObjectTreeView, { props });
|
|
17
|
+
expect(wrapper).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should toggle visibility', async () => {
|
|
21
|
+
const viewer3cr = useViewer3cr();
|
|
22
|
+
const spy = vi.spyOn(viewer3cr, 'setMcadObjectVisibility').mockImplementation(vi.fn());
|
|
23
|
+
const props = { items };
|
|
24
|
+
const wrapper = mount(McadObjectTreeView, { props });
|
|
25
|
+
await wrapper.findComponent(VisibilityBtn).trigger('click');
|
|
26
|
+
expect(spy).toHaveBeenCalled();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should update opacity', async () => {
|
|
30
|
+
const viewer3cr = useViewer3cr();
|
|
31
|
+
const spy = vi.spyOn(viewer3cr, 'setMcadObjectColour').mockImplementation(vi.fn());
|
|
32
|
+
const props = { items };
|
|
33
|
+
const wrapper = mount(McadObjectTreeView, { props });
|
|
34
|
+
await wrapper.findComponent(Opacity).setValue(NaN);
|
|
35
|
+
await wrapper.findComponent(Opacity).setValue(50);
|
|
36
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should download mcad', async () => {
|
|
40
|
+
const options = useViewerOptions();
|
|
41
|
+
options.value.OnDownloadMcad = vi.fn();
|
|
42
|
+
const props = { items };
|
|
43
|
+
const wrapper = mount(McadObjectTreeView, { props });
|
|
44
|
+
await wrapper.findComponentByTestId<VMenu>('menu').trigger('click');
|
|
45
|
+
await wrapper.findComponentByTestId<VListItem>('download').trigger('click');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
v-model="modalState"
|
|
4
|
+
min-width="100"
|
|
5
|
+
max-width="400"
|
|
6
|
+
persistent
|
|
7
|
+
:no-click-animation="true"
|
|
8
|
+
:target="item.target"
|
|
9
|
+
>
|
|
10
|
+
<v-card density="compact">
|
|
11
|
+
<v-card-title>{{ item.title }}</v-card-title>
|
|
12
|
+
<v-list density="compact" :lines="false">
|
|
13
|
+
<v-list-item v-for="data of item.data">
|
|
14
|
+
<template #prepend>
|
|
15
|
+
<v-icon class="mr-n4" :icon="data.icon" />
|
|
16
|
+
</template>
|
|
17
|
+
<v-list-item-title>{{ data.title }}</v-list-item-title>
|
|
18
|
+
|
|
19
|
+
<v-list-item-subtitle v-if="data.subtitle">{{ data.subtitle }}</v-list-item-subtitle>
|
|
20
|
+
|
|
21
|
+
<v-list-item-subtitle v-if="data.actions && data.actions.length > 0">
|
|
22
|
+
<template v-for="action in data.actions">
|
|
23
|
+
<a @click.stop class="text-small" :href="action.url" target="_blank">
|
|
24
|
+
{{ action.description }}
|
|
25
|
+
</a>
|
|
26
|
+
<br />
|
|
27
|
+
</template>
|
|
28
|
+
</v-list-item-subtitle>
|
|
29
|
+
</v-list-item>
|
|
30
|
+
</v-list>
|
|
31
|
+
</v-card>
|
|
32
|
+
</v-menu>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { DataOverlayInfo } from '@/types/data-overlay-info';
|
|
37
|
+
import { computed } from 'vue';
|
|
38
|
+
|
|
39
|
+
interface Props {
|
|
40
|
+
modal?: boolean;
|
|
41
|
+
item: DataOverlayInfo;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type Emits = {
|
|
45
|
+
'update:modal': [boolean];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
49
|
+
modal: false
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const emit = defineEmits<Emits>();
|
|
53
|
+
|
|
54
|
+
const modalState = computed({
|
|
55
|
+
get(): boolean {
|
|
56
|
+
return props.modal;
|
|
57
|
+
},
|
|
58
|
+
set(value: boolean): void {
|
|
59
|
+
emit('update:modal', value);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style scoped lang="scss">
|
|
65
|
+
.v-card {
|
|
66
|
+
background: rgba(var(--v-theme-surface), 0.5) !important;
|
|
67
|
+
backdrop-filter: blur(48px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.v-card-title {
|
|
71
|
+
background: none;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
padding-bottom: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.v-list {
|
|
77
|
+
background: none;
|
|
78
|
+
padding-top: 4px;
|
|
79
|
+
padding-bottom: 4px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.v-list-item-title {
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.v-list-item-subtitle {
|
|
87
|
+
font-size: 12px;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-for="[item, modal] of modals" :key="item">
|
|
3
|
+
<data-overlay-modal :modal="modal" :item="item" />
|
|
4
|
+
</template>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { ref, watch } from 'vue';
|
|
9
|
+
import { Interactiontype } from '@3cr/types-ts';
|
|
10
|
+
import { DataOverlayInfo } from '@/types/data-overlay-info';
|
|
11
|
+
import { DataOverlay } from '@/types/data-overlay';
|
|
12
|
+
import { useMouse } from '@/composables/useMouse';
|
|
13
|
+
import { useAnnotations } from '@/composables/useAnnotations';
|
|
14
|
+
import { useMarkups } from '@/composables/useMarkups';
|
|
15
|
+
import { useMcadObjects } from '@/composables/useMcadObjects';
|
|
16
|
+
import { useEventListener } from '@/composables/useEventListener';
|
|
17
|
+
import { GptService } from '@/services/gpt.service';
|
|
18
|
+
import { GptResponsePayload } from '@/types/gpt-response-payload';
|
|
19
|
+
|
|
20
|
+
useEventListener(document, 'mousedown', onMouseDown);
|
|
21
|
+
const { x, y } = useMouse(document);
|
|
22
|
+
const { annotationEvent } = useAnnotations();
|
|
23
|
+
const { markupEvent } = useMarkups();
|
|
24
|
+
const { mcadObjectEvent } = useMcadObjects();
|
|
25
|
+
|
|
26
|
+
const modals = ref<Map<DataOverlayInfo, boolean>>(new Map<DataOverlayInfo, boolean>());
|
|
27
|
+
const smartDescriptions = ref<Record<string, GptResponsePayload>>({});
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
annotationEvent,
|
|
31
|
+
async (event) => {
|
|
32
|
+
if (event?.Interaction === Interactiontype.POINTER_UP) {
|
|
33
|
+
await generateSmartDescriptions(event.DataOverlay);
|
|
34
|
+
const item = mapToDataOverlayModal(event.DataOverlay);
|
|
35
|
+
modals.value.set(item, true);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{ immediate: true }
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
watch(
|
|
42
|
+
markupEvent,
|
|
43
|
+
async (event) => {
|
|
44
|
+
if (event?.Interaction === Interactiontype.POINTER_UP) {
|
|
45
|
+
await generateSmartDescriptions(event.DataOverlay);
|
|
46
|
+
const item = mapToDataOverlayModal(event.DataOverlay);
|
|
47
|
+
modals.value.set(item, true);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{ immediate: true }
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
watch(
|
|
54
|
+
mcadObjectEvent,
|
|
55
|
+
async (event) => {
|
|
56
|
+
if (event?.Interaction === Interactiontype.POINTER_UP) {
|
|
57
|
+
await generateSmartDescriptions(event.Mcad as any);
|
|
58
|
+
const item = mapToDataOverlayModal(event.Mcad as any);
|
|
59
|
+
modals.value.set(item, true);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{ immediate: true }
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
function onMouseDown(): void {
|
|
66
|
+
for (const [key, value] of modals.value.entries()) {
|
|
67
|
+
if (value) {
|
|
68
|
+
modals.value.set(key, false);
|
|
69
|
+
setTimeout(() => modals.value.delete(key), 500); // wait for animation
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function generateSmartDescriptions(overlay: DataOverlay): Promise<void> {
|
|
75
|
+
const key = overlay.Title;
|
|
76
|
+
if (!(key in smartDescriptions.value)) {
|
|
77
|
+
const response = await GptService.Instantiate().GenerateAnnotations(key);
|
|
78
|
+
smartDescriptions.value[key] = response.data;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function mapToDataOverlayModal(overlay: DataOverlay): DataOverlayInfo {
|
|
83
|
+
return {
|
|
84
|
+
id: overlay.Id,
|
|
85
|
+
title: overlay.Title,
|
|
86
|
+
target: [x.value, y.value],
|
|
87
|
+
data: [
|
|
88
|
+
{
|
|
89
|
+
icon: overlay.Description ? 'description' : 'psychology',
|
|
90
|
+
title: overlay.Description ? 'Description' : 'Smart Description',
|
|
91
|
+
subtitle: overlay.Description || smartDescriptions.value[overlay.Title].GptResponse
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
icon: 'help',
|
|
95
|
+
title: 'Resources',
|
|
96
|
+
actions: overlay.CallToAction?.Actions.map((action) => ({
|
|
97
|
+
url: action.ActionData.Url,
|
|
98
|
+
description: action.ActionData.Description
|
|
99
|
+
}))
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import DataOverlayModal from '@/components/views/modals/DataOverlayModal.vue';
|
|
2
|
+
import { DataOverlayInfoFaker } from '@test/fakers/data-overlay-info.faker';
|
|
3
|
+
import { mount } from '@vue/test-utils';
|
|
4
|
+
import { VCard, VMenu } from 'vuetify/components';
|
|
5
|
+
|
|
6
|
+
describe('DataOverlayInfo tests', () => {
|
|
7
|
+
it('should mount', () => {
|
|
8
|
+
const item = DataOverlayInfoFaker.random();
|
|
9
|
+
const props = { item, modal: true };
|
|
10
|
+
const wrapper = mount(DataOverlayModal, { props });
|
|
11
|
+
expect(wrapper).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should open and close menu', async () => {
|
|
15
|
+
const item = DataOverlayInfoFaker.random();
|
|
16
|
+
const props = { item, modal: true };
|
|
17
|
+
const wrapper = mount(DataOverlayModal, { props });
|
|
18
|
+
const menu = wrapper.findComponent(VMenu);
|
|
19
|
+
await menu.setValue(false);
|
|
20
|
+
await wrapper.setProps({ modal: false });
|
|
21
|
+
expect(wrapper.findComponent(VCard).isVisible()).toBeFalsy();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should open link', async () => {
|
|
25
|
+
const item = DataOverlayInfoFaker.random(1);
|
|
26
|
+
const props = { item, modal: true };
|
|
27
|
+
const wrapper = mount(DataOverlayModal, { props });
|
|
28
|
+
const card = wrapper.findComponent(VCard);
|
|
29
|
+
const anchor = card.find('a');
|
|
30
|
+
await anchor.trigger('click');
|
|
31
|
+
expect(anchor.attributes('href')).toBe(item.data[0].actions![0].url);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { GptService } from '@/services/gpt.service';
|
|
2
|
+
import { DOMWrapper, flushPromises, mount } from '@vue/test-utils';
|
|
3
|
+
import { useAnnotations } from '@/composables/useAnnotations';
|
|
4
|
+
import { DataOverlayInteractionFaker } from '@test/fakers/data-overlay-interaction.faker';
|
|
5
|
+
import { Interactiontype } from '@3cr/types-ts';
|
|
6
|
+
import { useMarkups } from '@/composables/useMarkups';
|
|
7
|
+
import { McadObjectInteractionFaker } from '@test/fakers/mcad-object-interaction.faker';
|
|
8
|
+
import { useMcadObjects } from '@/composables/useMcadObjects';
|
|
9
|
+
import { VCard } from 'vuetify/components';
|
|
10
|
+
import { GptResponsePayload } from '@/types/gpt-response-payload';
|
|
11
|
+
import DataOverlayModalManager from '@/components/views/modals/DataOverlayModalManager.vue';
|
|
12
|
+
import DataOverlayModal from '@/components/views/modals/DataOverlayModal.vue';
|
|
13
|
+
|
|
14
|
+
const gpt: GptResponsePayload = {
|
|
15
|
+
GptResponse: 'Example',
|
|
16
|
+
FollowupQuestions: []
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe('DataOverlayModalManager tests', () => {
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
vi.spyOn(GptService.prototype, 'GenerateAnnotations').mockResolvedValue({ data: gpt } as any);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should mount', () => {
|
|
25
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
26
|
+
expect(wrapper).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should display annotation on pointer up', async () => {
|
|
30
|
+
const event = DataOverlayInteractionFaker.annotation(Interactiontype.POINTER_UP);
|
|
31
|
+
const { annotationEvent } = useAnnotations();
|
|
32
|
+
vi.spyOn(annotationEvent, 'value', 'get').mockReturnValue(event);
|
|
33
|
+
|
|
34
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
35
|
+
await flushPromises();
|
|
36
|
+
expect(wrapper.findComponent(DataOverlayModal).exists()).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should display markup on pointer up', async () => {
|
|
40
|
+
const event = DataOverlayInteractionFaker.polygon(Interactiontype.POINTER_UP);
|
|
41
|
+
const { markupEvent } = useMarkups();
|
|
42
|
+
vi.spyOn(markupEvent, 'value', 'get').mockReturnValue(event);
|
|
43
|
+
|
|
44
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
45
|
+
await flushPromises();
|
|
46
|
+
expect(wrapper.findComponent(DataOverlayModal).exists()).toBeTruthy();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should display mcad on pointer up', async () => {
|
|
50
|
+
const event = McadObjectInteractionFaker.random(Interactiontype.POINTER_UP);
|
|
51
|
+
const { mcadObjectEvent } = useMcadObjects();
|
|
52
|
+
vi.spyOn(mcadObjectEvent, 'value', 'get').mockReturnValue(event);
|
|
53
|
+
|
|
54
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
55
|
+
await flushPromises();
|
|
56
|
+
expect(wrapper.findComponent(DataOverlayModal).exists()).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should generate smart description if none provided', async () => {
|
|
60
|
+
const event = DataOverlayInteractionFaker.annotation(Interactiontype.POINTER_UP);
|
|
61
|
+
event.DataOverlay.Description = '';
|
|
62
|
+
const { annotationEvent } = useAnnotations();
|
|
63
|
+
vi.spyOn(annotationEvent, 'value', 'get').mockReturnValue(event);
|
|
64
|
+
|
|
65
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
66
|
+
await flushPromises();
|
|
67
|
+
expect(wrapper.findComponent(VCard).text()).toContain('Smart Description');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('timed tests', () => {
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
vi.useFakeTimers();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
afterEach(() => {
|
|
76
|
+
vi.useRealTimers();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should dismiss modal on mousedown', async () => {
|
|
80
|
+
const event = DataOverlayInteractionFaker.annotation(Interactiontype.POINTER_UP);
|
|
81
|
+
const { annotationEvent } = useAnnotations();
|
|
82
|
+
vi.spyOn(annotationEvent, 'value', 'get').mockReturnValue(event);
|
|
83
|
+
|
|
84
|
+
const wrapper = mount(DataOverlayModalManager);
|
|
85
|
+
await flushPromises();
|
|
86
|
+
|
|
87
|
+
await new DOMWrapper(document).trigger('mousedown');
|
|
88
|
+
vi.advanceTimersByTime(500);
|
|
89
|
+
await flushPromises();
|
|
90
|
+
expect(wrapper.findComponent(DataOverlayModal).exists()).toBeFalsy();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="maskStyles">
|
|
3
|
+
<div :style="backgroundStyles" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
data: string;
|
|
12
|
+
color: string;
|
|
13
|
+
size?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
+
size: 12
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const sizePx = computed(() => {
|
|
21
|
+
return `${props.size}px`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const maskStyles = computed(() => {
|
|
25
|
+
const src = `data:image/png;base64, ${props.data}`;
|
|
26
|
+
const px = sizePx.value;
|
|
27
|
+
return {
|
|
28
|
+
'display': 'inline-block',
|
|
29
|
+
'mask-size': `${px} ${px}`,
|
|
30
|
+
'mask-image': `url('${src}')`,
|
|
31
|
+
'width': px,
|
|
32
|
+
'height': px,
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const backgroundStyles = computed(() => {
|
|
37
|
+
const px = sizePx.value;
|
|
38
|
+
return {
|
|
39
|
+
'background-color': props.color,
|
|
40
|
+
'width': px,
|
|
41
|
+
'height': px,
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="styles" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from 'vue';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
color: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
size: 12
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const sizePx = computed(() => {
|
|
18
|
+
return `${props.size}px`;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const styles = computed(() => {
|
|
22
|
+
const px = sizePx.value;
|
|
23
|
+
return {
|
|
24
|
+
'display': 'inline-block',
|
|
25
|
+
'background-color': props.color,
|
|
26
|
+
'border': '1px #333333 solid',
|
|
27
|
+
'width': px,
|
|
28
|
+
'height': px,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot name="prepend">
|
|
4
|
+
<v-icon
|
|
5
|
+
class="mr-2 material-icons-filled"
|
|
6
|
+
size="16"
|
|
7
|
+
:icon="icon"
|
|
8
|
+
:color="color"
|
|
9
|
+
/>
|
|
10
|
+
</slot>
|
|
11
|
+
<span class="label text-truncate">{{ label }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
interface Props {
|
|
17
|
+
icon?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
defineProps<Props>();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style scoped lang="css">
|
|
26
|
+
.label {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
vertical-align: text-top;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-text-field
|
|
3
|
+
v-model:model-value="value"
|
|
4
|
+
density="compact"
|
|
5
|
+
hide-details
|
|
6
|
+
max="100"
|
|
7
|
+
max-width="64px"
|
|
8
|
+
min="0"
|
|
9
|
+
suffix="%"
|
|
10
|
+
type="number"
|
|
11
|
+
variant="outlined"
|
|
12
|
+
@input="onInputOpacity"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { clamp } from '@/functions/clamp';
|
|
18
|
+
import { computed, ref } from 'vue';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
modelValue?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type Emits = {
|
|
25
|
+
'update:modelValue': [number];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
29
|
+
modelValue: 0
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const emit = defineEmits<Emits>();
|
|
33
|
+
|
|
34
|
+
const value_ = ref<number>(props.modelValue);
|
|
35
|
+
|
|
36
|
+
const value = computed({
|
|
37
|
+
get(): number {
|
|
38
|
+
return value_.value;
|
|
39
|
+
},
|
|
40
|
+
set(val: number): void {
|
|
41
|
+
value_.value = clamp(val, 0, 100);
|
|
42
|
+
emit('update:modelValue', value_.value);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function onInputOpacity(event: InputEvent): void {
|
|
47
|
+
const input = event.target as HTMLInputElement;
|
|
48
|
+
const value = input.value ? parseInt(input.value) : 0;
|
|
49
|
+
input.value = clamp(value, parseInt(input.min), parseInt(input.max)).toString();
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style scoped lang="css">
|
|
54
|
+
:deep(.v-text-field__suffix) {
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
color: rgba(255, 255, 255, 0.8);
|
|
57
|
+
padding: 4px 8px 4px 2px;
|
|
58
|
+
min-height: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:deep(.v-field__input) {
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
padding: 4px 0 4px 8px;
|
|
64
|
+
min-height: 0;
|
|
65
|
+
}
|
|
66
|
+
</style>
|