@configuratorware/configurator-frontendgui 1.41.2 → 1.42.2
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/App/Constant.js +2 -3
- package/App/Error/DevelopmentErrorPage/index.js +4 -19
- package/App/Error/ErrorBoundary.js +13 -43
- package/App/Error/ProductionErrorPage/index.js +2 -11
- package/App/Error/ProductionErrorPage/index.story.js +0 -4
- package/App/Frame.js +10 -43
- package/App/Modules/Creator/Components/ConfigurationvariantItem/index.js +15 -58
- package/App/Modules/Creator/Components/ConfigurationvariantSelection/index.js +20 -60
- package/App/Modules/Creator/Components/CustomTitleEditor/index.js +15 -64
- package/App/Modules/Creator/Components/ExternalVisualization/index.js +19 -47
- package/App/Modules/Creator/Components/FastConfiguration/SelectableRow.js +10 -37
- package/App/Modules/Creator/Components/FastConfiguration/index.js +37 -101
- package/App/Modules/Creator/Components/FastConfigurationRow/index.js +12 -38
- package/App/Modules/Creator/Components/FastConfigurationSelect/index.js +29 -85
- package/App/Modules/Creator/Components/FormattedNumber/index.js +1 -17
- package/App/Modules/Creator/Components/FormattedPrice/index.js +1 -19
- package/App/Modules/Creator/Components/FullScreenView/FullScreenView.js +17 -36
- package/App/Modules/Creator/Components/Incompatibility/OptionExclusionRule/index.js +24 -61
- package/App/Modules/Creator/Components/Incompatibility/OptionRule/index.js +24 -60
- package/App/Modules/Creator/Components/Incompatibility/RuleComponent.js +12 -45
- package/App/Modules/Creator/Components/Incompatibility/index.js +28 -89
- package/App/Modules/Creator/Components/InvalidConfigurationNotice/index.js +14 -53
- package/App/Modules/Creator/Components/LoginForm/index.js +14 -52
- package/App/Modules/Creator/Components/Option/index.js +53 -155
- package/App/Modules/Creator/Components/Option/index.story.js +6 -17
- package/App/Modules/Creator/Components/OptionAmount/index.js +33 -74
- package/App/Modules/Creator/Components/OptionGroup/index.js +10 -23
- package/App/Modules/Creator/Components/Optiondetail/ZoomImage/index.js +26 -68
- package/App/Modules/Creator/Components/Optiondetail/index.js +44 -129
- package/App/Modules/Creator/Components/Optiondetail/index.story.js +11 -72
- package/App/Modules/Creator/Components/Optiondetail/index.test.mocks.js +56 -0
- package/App/Modules/Creator/Components/OptionsList/index.js +31 -81
- package/App/Modules/Creator/Components/Price/index.js +12 -40
- package/App/Modules/Creator/Components/ProductPart/index.js +14 -46
- package/App/Modules/Creator/Components/ProductPart/index.story.js +6 -17
- package/App/Modules/Creator/Components/ProductPartsList/index.js +25 -68
- package/App/Modules/Creator/Components/ProductPartsList/index.story.js +6 -21
- package/App/Modules/Creator/Components/SavedConfiguration/index.js +13 -45
- package/App/Modules/Creator/Components/ShareConfiguration/index.js +31 -90
- package/App/Modules/Creator/Components/StockInformation/index.js +13 -44
- package/App/Modules/Creator/Components/StoreConfigurationForm/index.js +15 -52
- package/App/Modules/Creator/Components/Tools/index.js +11 -45
- package/App/Modules/Creator/Components/ValidationResult/index.js +16 -62
- package/App/Modules/Creator/Components/index.js +2 -29
- package/App/Modules/Creator/Containers/AmountPrice/index.js +3 -12
- package/App/Modules/Creator/Containers/ConfigurationvariantSelection/index.js +5 -19
- package/App/Modules/Creator/Containers/CustomTitleEditor/index.js +4 -19
- package/App/Modules/Creator/Containers/FastConfiguration/index.js +6 -20
- package/App/Modules/Creator/Containers/FormattedPrice/index.js +4 -13
- package/App/Modules/Creator/Containers/Incompatibility/index.js +2 -12
- package/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +8 -31
- package/App/Modules/Creator/Containers/LoadingOverlay/index.js +2 -9
- package/App/Modules/Creator/Containers/Optiondetail/index.js +7 -18
- package/App/Modules/Creator/Containers/OptionsList/index.js +3 -15
- package/App/Modules/Creator/Containers/ProductPart/index.js +1 -9
- package/App/Modules/Creator/Containers/ProductPartsList/index.js +3 -16
- package/App/Modules/Creator/Containers/SavedConfigurationContainer/index.js +1 -8
- package/App/Modules/Creator/Containers/ShareConfiguration/index.js +2 -10
- package/App/Modules/Creator/Containers/StockInformation/index.js +2 -10
- package/App/Modules/Creator/Containers/Tools/index.js +1 -10
- package/App/Modules/Creator/Containers/ValidationResult/index.js +2 -10
- package/App/Modules/Creator/Containers/index.js +42 -64
- package/App/Modules/Creator/CreatorScreen.js +45 -121
- package/App/Modules/Creator/Layouts/DefaultLayout.js +21 -50
- package/App/Modules/Designer/Components/AddGalleryImage/index.js +31 -92
- package/App/Modules/Designer/Components/AddGalleryImage/index.story.js +9 -22
- package/App/Modules/Designer/Components/AddGalleryImage/index.test.js +13 -35
- package/App/Modules/Designer/Components/AddVisualElement/index.js +30 -86
- package/App/Modules/Designer/Components/AddVisualElement/index.story.js +0 -5
- package/App/Modules/Designer/Components/AddVisualElement/index.test.js +12 -15
- package/App/Modules/Designer/Components/CloseDesignEditor/index.js +18 -51
- package/App/Modules/Designer/Components/CloseGraphicsEditorButton/index.js +7 -17
- package/App/Modules/Designer/Components/ColorPalettes/ColorPalettesSearch.js +20 -57
- package/App/Modules/Designer/Components/ColorPalettes/index.js +62 -178
- package/App/Modules/Designer/Components/ColorPalettes/index.story.js +0 -8
- package/App/Modules/Designer/Components/ColorPalettes/index.test.js +7 -11
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.js +35 -108
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.story.js +0 -8
- package/App/Modules/Designer/Components/DesignAreaControlbox/index.test.js +15 -23
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/CustomFontOverlay.js +18 -51
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +53 -150
- package/App/Modules/Designer/Components/DesignerSelectionToolbox/fontItemUtils.js +10 -20
- package/App/Modules/Designer/Components/Dialog/index.js +21 -63
- package/App/Modules/Designer/Components/EditDesignButton/index.js +20 -43
- package/App/Modules/Designer/Components/FeedbackNotice/index.js +17 -53
- package/App/Modules/Designer/Components/FeedbackNotice/index.test.js +0 -4
- package/App/Modules/Designer/Components/FullScreenView/FullScreenView.js +6 -14
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.dev.js +5 -14
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +42 -137
- package/App/Modules/Designer/Components/ImageColorize/index.js +54 -177
- package/App/Modules/Designer/Components/ImageColorize/index.story.js +2 -6
- package/App/Modules/Designer/Components/ImageControlbox/index.js +27 -90
- package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +26 -71
- package/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +138 -170
- package/App/Modules/Designer/Components/ImageEditDialog/index.js +55 -168
- package/App/Modules/Designer/Components/ImageLibraryFilter/index.js +20 -61
- package/App/Modules/Designer/Components/ImageLibraryThumbnail/index.js +24 -66
- package/App/Modules/Designer/Components/ObjectTools/index.js +18 -56
- package/App/Modules/Designer/Components/Select/index.js +21 -65
- package/App/Modules/Designer/Components/TextControlbox/TextFormatIcon.js +5 -20
- package/App/Modules/Designer/Components/TextControlbox/index.js +58 -176
- package/App/Modules/Designer/Components/TextControlbox/index.story.js +0 -10
- package/App/Modules/Designer/Components/TextControlbox/index.test.js +34 -41
- package/App/Modules/Designer/Containers/AddGalleryImage.js +8 -24
- package/App/Modules/Designer/Containers/AddVisualElement.js +28 -87
- package/App/Modules/Designer/Containers/CloseDesignEditor.js +1 -10
- package/App/Modules/Designer/Containers/CloseGraphicsEditorButton.js +1 -10
- package/App/Modules/Designer/Containers/ColorPalettes.js +22 -61
- package/App/Modules/Designer/Containers/DesignAreaControlbox.js +5 -17
- package/App/Modules/Designer/Containers/Designer.js +1 -10
- package/App/Modules/Designer/Containers/DesignerSelectionToolbox.js +7 -30
- package/App/Modules/Designer/Containers/EditDesignButton.js +1 -11
- package/App/Modules/Designer/Containers/ImageEditDialog.js +400 -658
- package/App/Modules/Designer/Designer.js +28 -84
- package/App/Modules/Designer/DesignerScreen.js +45 -100
- package/App/Modules/Designer/DesignerUI.js +31 -87
- package/App/Modules/Designer/Layouts/DefaultLayout.js +20 -45
- package/App/Modules/Designer/Layouts/Mobile/TwoSideBottomBar.js +4 -16
- package/App/Modules/Designer/Layouts/PopupAreaProvider.js +20 -67
- package/App/Modules/Designer/MultilayerComponents/DesignerClickAwayListener.js +5 -23
- package/App/Modules/Designer/MultilayerComponents/InlineToolboxPortal.js +19 -52
- package/App/Modules/Designer/MultilayerComponents/StandardToolboxPortal.js +9 -25
- package/App/Modules/Designer/Utils/FontFaceRepository.js +8 -30
- package/App/Modules/Designer/Utils/ImageEditUtils.js +14 -38
- package/App/Modules/Designer/Utils/SvgFixers.js +8 -26
- package/App/Modules/Designer/Utils/Transformers.js +54 -112
- package/App/Modules/Designer/setupDesigner.js +50 -72
- package/App/Modules/Designer/withActiveCanvas.js +22 -70
- package/App/Modules/Visualization/AlignTargetContainer.js +8 -19
- package/App/Modules/Visualization/CreatorAlignTarget.js +9 -20
- package/App/Modules/Visualization/DefaultVisualizationProvider.js +18 -50
- package/App/Modules/Visualization/DesignerAlignTarget.js +7 -13
- package/App/Modules/Visualization/Utils/getFirstDataURLFromScreenshotsObj.js +0 -3
- package/App/Reducers/Actions.js +81 -145
- package/App/Reducers/ConfigurationMode/Actions.js +4 -9
- package/App/Reducers/ConfigurationMode/Reducer.js +6 -23
- package/App/Reducers/ConfigurationMode/Selectors.js +22 -41
- package/App/Reducers/Configurator/Actions.js +386 -760
- package/App/Reducers/Configurator/AttributeSelectors.js +5 -17
- package/App/Reducers/Configurator/Modifiers.js +8 -15
- package/App/Reducers/Configurator/Reducer.js +107 -202
- package/App/Reducers/Configurator/Selectors.js +46 -119
- package/App/Reducers/Confirm/Actions.js +28 -49
- package/App/Reducers/Confirm/Reducer.js +1 -9
- package/App/Reducers/DesignArea/Actions.js +8 -29
- package/App/Reducers/DesignArea/DesignElementSelectors.js +18 -41
- package/App/Reducers/DesignArea/MaskSelectors.js +12 -35
- package/App/Reducers/DesignArea/Reducer.js +8 -40
- package/App/Reducers/DesignArea/Selectors.js +148 -413
- package/App/Reducers/DesignArea/Transformers.js +22 -87
- package/App/Reducers/DesignData/Actions.js +31 -93
- package/App/Reducers/DesignData/Modifiers.js +34 -114
- package/App/Reducers/DesignData/Reducer.js +9 -38
- package/App/Reducers/DesignData/Selectors.js +17 -50
- package/App/Reducers/DesignData/Transformers.js +2 -6
- package/App/Reducers/DesignView/Actions.js +3 -7
- package/App/Reducers/DesignView/Reducer.js +13 -47
- package/App/Reducers/DesignView/Selectors.js +17 -49
- package/App/Reducers/DesignView/Transformers.js +0 -3
- package/App/Reducers/Device/Actions.js +3 -7
- package/App/Reducers/Device/Reducer.js +9 -16
- package/App/Reducers/Fonts/Actions.js +12 -45
- package/App/Reducers/Fonts/Reducer.js +2 -11
- package/App/Reducers/Fonts/Selectors.js +9 -25
- package/App/Reducers/GeneralActions.js +3 -7
- package/App/Reducers/ImageGallery/Actions.js +97 -189
- package/App/Reducers/ImageGallery/Modifiers.js +13 -24
- package/App/Reducers/ImageGallery/Reducer.js +29 -98
- package/App/Reducers/ImageGallery/Selectors.js +21 -79
- package/App/Reducers/Reducer.js +10 -26
- package/App/Reducers/UI/Actions.js +73 -113
- package/App/Reducers/UI/Reducer.js +17 -26
- package/App/Reducers/UI/Selectors.js +3 -12
- package/App/Reducers.js +7 -21
- package/App/Routing.js +30 -107
- package/App/Screens/Configurator/CalculationWidgetScreen.js +10 -39
- package/App/Screens/Configurator/Components/AmountSelection/index.js +25 -77
- package/App/Screens/Configurator/Components/AmountSelection/index.story.js +0 -8
- package/App/Screens/Configurator/Components/CalculationWidget/index.js +53 -154
- package/App/Screens/Configurator/Components/CalculationWidget/index.story.js +6 -19
- package/App/Screens/Configurator/Components/CalculationWidget/index.test.js +39 -38
- package/App/Screens/Configurator/Components/ConfigurationModeSwitch/ConfigurationModeSwitch.js +7 -30
- package/App/Screens/Configurator/Components/ConfigurationModeSwitch/index.js +0 -2
- package/App/Screens/Configurator/Components/Confirm/index.js +13 -50
- package/App/Screens/Configurator/Components/Error/index.js +11 -48
- package/App/Screens/Configurator/Components/FallbackVisualization/FallbackVisualization.js +13 -25
- package/App/Screens/Configurator/Components/FullScreenView/index.js +37 -116
- package/App/Screens/Configurator/Components/FullScreenView/index.test.js +1 -4
- package/App/Screens/Configurator/Components/ImageLoader/ImageLoader.js +11 -42
- package/App/Screens/Configurator/Components/ItemTile/ItemTile.js +89 -33
- package/App/Screens/Configurator/Components/LandscapeInformation/index.js +3 -19
- package/App/Screens/Configurator/Components/NoVisualization/NoVisualization.js +3 -11
- package/App/Screens/Configurator/Components/PreviewPortal/index.js +29 -81
- package/App/Screens/Configurator/Components/Thumbnail/index.js +36 -102
- package/App/Screens/Configurator/Components/Thumbnail/index.test.js +0 -4
- package/App/Screens/Configurator/Components/TotalPrice/TotalPrice.js +9 -24
- package/App/Screens/Configurator/Containers/AmountPrice.js +12 -36
- package/App/Screens/Configurator/Containers/CalculationWidget.js +24 -85
- package/App/Screens/Configurator/Containers/ConfigurationModeSwitch.js +22 -43
- package/App/Screens/Configurator/Containers/Confirm.js +1 -10
- package/App/Screens/Configurator/Containers/FallbackVisualization.js +1 -11
- package/App/Screens/Configurator/Containers/FullScreenView.js +1 -14
- package/App/Screens/Configurator/Containers/Thumbnail.js +1 -13
- package/App/Screens/Configurator/Containers/Visualization.js +1 -5
- package/App/Screens/Configurator/DynamicComponents.js +8 -22
- package/App/Screens/Configurator/Screen.js +31 -70
- package/App/Screens/Configurator/ScreenPropTypes.js +2 -6
- package/App/Screens/Configurator/ThemeProvider.js +8 -42
- package/App/Screens/DesignerProductPreview/Constants.js +4 -7
- package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +204 -289
- package/App/Screens/DesignerProductPreview/Screen.js +58 -139
- package/App/Screens/ItemOverview.js +156 -191
- package/App/Screens.js +12 -20
- package/App/ServiceLocator.js +26 -51
- package/App/Services/AdminareaCommunicationService.js +33 -69
- package/App/Services/AnalyticsService.js +13 -40
- package/App/Services/ConfiguratorService.js +381 -567
- package/App/Services/DesignDataService.js +1448 -2001
- package/App/Services/DesignerService.js +290 -350
- package/App/Services/InteractionService.js +349 -502
- package/App/Services/UIService.js +12 -39
- package/App/Services/VisualizationService.js +246 -336
- package/App/Shared/Components/AcceptDesign/index.js +27 -70
- package/App/Shared/Components/AcceptPrivacy/index.js +21 -58
- package/App/Shared/Components/AddToBasket/index.js +31 -81
- package/App/Shared/Components/AddToBasket/index.story.js +0 -9
- package/App/Shared/Components/AlertDialog/index.js +15 -57
- package/App/Shared/Components/AmountInput/index.js +34 -107
- package/App/Shared/Components/AmountInput/index.story.js +0 -6
- package/App/Shared/Components/AmountPrice/index.js +220 -382
- package/App/Shared/Components/AmountPrice/index.story.js +1 -10
- package/App/Shared/Components/AmountPrice/index.test.js +6 -12
- package/App/Shared/Components/Analytics/AnalyticsWrapper.js +9 -21
- package/App/Shared/Components/BulkNames/index.js +28 -92
- package/App/Shared/Components/CallToAction/index.js +18 -42
- package/App/Shared/Components/ConfigurationOverview/index.js +14 -47
- package/App/Shared/Components/Header/Header.js +18 -46
- package/App/Shared/Components/Header/index.js +0 -2
- package/App/Shared/Components/Header/index.story.js +0 -13
- package/App/Shared/Components/InformationTag/InformationTag.js +20 -55
- package/App/Shared/Components/LicenseNotice/LicenseNotice.js +20 -54
- package/App/Shared/Components/LicenseNotice/index.js +0 -2
- package/App/Shared/Components/LoadConfiguration/index.js +47 -82
- package/App/Shared/Components/MessageBox/index.js +2 -19
- package/App/Shared/Components/MessageBox/index.story.js +0 -7
- package/App/Shared/Components/Notification/index.js +18 -53
- package/App/Shared/Components/Notification/index.story.js +0 -4
- package/App/Shared/Components/PdfDownload/index.js +19 -59
- package/App/Shared/Components/PlusMinusInput/index.js +13 -37
- package/App/Shared/Components/PriceList/index.js +27 -78
- package/App/Shared/Components/PriceList/index.story.js +6 -15
- package/App/Shared/Components/PriceOverview/index.js +29 -74
- package/App/Shared/Components/PriceOverview/index.story.js +1 -18
- package/App/Shared/Components/ProductVariant/Image.js +13 -35
- package/App/Shared/Components/ProductVariant/index.js +34 -123
- package/App/Shared/Components/ProductVariant/index.story.js +9 -22
- package/App/Shared/Components/Progress/Progress.js +6 -15
- package/App/Shared/Components/ReceiveOfferForm/index.js +26 -80
- package/App/Shared/Components/ReceiveOfferForm/index.story.js +0 -6
- package/App/Shared/Components/ReceiveOfferForm/index.test.js +1 -6
- package/App/Shared/Components/SaveConfiguration/index.js +26 -83
- package/App/Shared/Components/SendEmail/index.js +8 -30
- package/App/Shared/Components/Stepper/index.js +19 -56
- package/App/Shared/Components/Stepper/index.story.js +0 -5
- package/App/Shared/Components/ToolbarList/index.js +23 -69
- package/App/Shared/Components/ToolbarList/index.story.js +0 -4
- package/App/Shared/Components/VariantChooser/index.js +25 -68
- package/App/Shared/Components/VariantChooser/index.story.js +0 -13
- package/App/Shared/Containers/AlertMessages.js +1 -11
- package/App/Shared/Containers/AmountPrice/AmountPriceAdminareaWrapper.js +4 -17
- package/App/Shared/Containers/AmountPrice/index.js +29 -74
- package/App/Shared/Containers/BulkNames.js +26 -117
- package/App/Shared/Containers/Error.js +1 -11
- package/App/Shared/Containers/GlobalLoader.js +1 -9
- package/App/Shared/Containers/Header/index.js +22 -57
- package/App/Shared/Containers/LicenseNotice/LicenseNotice.js +2 -9
- package/App/Shared/Containers/LicenseNotice/index.js +0 -2
- package/App/Shared/Containers/LoadConfiguration/LoadConfiguration.js +36 -79
- package/App/Shared/Containers/LoadConfiguration/index.js +0 -2
- package/App/Shared/Containers/PdfDownload/index.js +2 -11
- package/App/Shared/Containers/ProductVariant/ProductVariant.js +59 -144
- package/App/Shared/Containers/ProductVariant/index.js +0 -2
- package/App/Shared/Containers/SaveConfiguration.js +3 -14
- package/App/Shared/Containers/SendEmail/SendEmail.js +3 -15
- package/App/Shared/Containers/SendEmail/index.js +0 -2
- package/App/Shared/Providers/DefaultCanvasProvider.js +5 -25
- package/App/Storage.js +3 -7
- package/App/Store.js +17 -38
- package/App/Translations.js +29 -43
- package/App/Utils/Request/lazyFetch.js +29 -45
- package/App/Utils/Request/pathParams.js +2 -7
- package/App/Utils/createMessageInterface.js +10 -21
- package/App/Utils/customClassName.js +0 -2
- package/App/Utils/getContrastText.js +5 -7
- package/App/Utils/getImageUrl.js +0 -8
- package/App/configuration.js +74 -104
- package/App/index.js +7 -29
- package/App/initServices.js +9 -32
- package/App/setup.js +2 -6
- package/Framework/Api.js +19 -41
- package/Framework/ComponentContainer.js +28 -76
- package/Framework/Components/Carousel/index.js +40 -104
- package/Framework/Components/Dialog/index.js +101 -237
- package/Framework/Components/DialogSelect/index.js +38 -132
- package/Framework/Components/Input/index.js +16 -58
- package/Framework/Components/LoadingOverlay/index.js +1 -12
- package/Framework/Components/Markdown/index.js +5 -26
- package/Framework/Components/Mobile/index.js +5 -13
- package/Framework/CustomError.js +13 -29
- package/Framework/Helpers/TransitionDetect.js +10 -29
- package/Framework/Helpers/isLandscapeMobile.js +0 -3
- package/Framework/Helpers/isMobileDevice.js +3 -8
- package/Framework/Helpers/isMobileSize.js +1 -4
- package/Framework/Services/AbstractAdminareaCommunicationService.js +8 -15
- package/Framework/Services/AbstractAsyncService.js +7 -14
- package/Framework/Services/AbstractConfiguratorService.js +9 -15
- package/Framework/Services/AbstractInteractionService.js +7 -14
- package/Framework/Services/AbstractStoreService.js +9 -15
- package/Framework/Services/AbstractUIService.js +7 -14
- package/Framework/Services/AbstractVisualizationService.js +7 -14
- package/Framework/Services/AsyncService.js +11 -33
- package/Framework/Services/StoreService.js +43 -92
- package/Framework/bindDecorator.js +24 -54
- package/Framework/i18n.js +57 -142
- package/Resources/Icons/MaterialUI/Icons/AddCircle.js +1 -5
- package/Resources/Icons/MaterialUI/Icons/RemoveCircle.js +1 -5
- package/Shared/Components/CustomDialog.js +21 -36
- package/Shared/Components/CustomDialogSelect.js +17 -47
- package/Shared/Components/MainButton.js +14 -33
- package/Shared/ErrorTypes/DeferredError.js +13 -31
- package/Shared/HOCs/ResizeDetect/ResizeDetect.dev.js +9 -18
- package/Shared/HOCs/ResizeDetect/ResizeDetect.js +28 -87
- package/Shared/HOCs/getDisplayName.js +0 -1
- package/Shared/HOCs/withFixedChangeHandler.js +11 -25
- package/Shared/PropTypes/ReactComponent.js +1 -5
- package/Shared/Styles/absoluteCenter.js +2 -5
- package/Utils/Array/isIdentical.js +3 -12
- package/Utils/Async/AsyncManager.js +51 -75
- package/Utils/Async/Deferred.js +12 -40
- package/Utils/Async/ObjectLock.js +3 -7
- package/Utils/Decorators/Observable.js +17 -34
- package/Utils/Dev/HOCs/withFilePicker.js +13 -41
- package/Utils/Dev/isDev.js +0 -2
- package/Utils/Events/pointerEvent.js +14 -47
- package/Utils/Events/preventEventDoubling.js +2 -7
- package/Utils/Function/cached.js +1 -9
- package/Utils/Function/createDebounceManager.js +3 -18
- package/Utils/Function/createSelector.js +7 -18
- package/Utils/Function/memoize.js +3 -12
- package/Utils/Function/sendMessage.js +3 -8
- package/Utils/Helper/createSelectionRangeMemo.js +4 -12
- package/Utils/Immutable/set.js +12 -35
- package/Utils/Math/conversions.js +2 -5
- package/Utils/Math/isPositiveNumber.js +2 -5
- package/Utils/Redux/createActionWithGlobalState.js +8 -11
- package/Utils/Styles/combineMediaQueries.js +2 -6
- package/Utils/Styles/createCheckerBoardBackground.js +5 -6
- package/Utils/Test/CallOrderChecker.js +0 -3
- package/Utils/Test/createStoreProvider.js +1 -7
- package/Utils/Test/formDataToJSON.js +0 -1
- package/Utils/Test/mountWithState.js +3 -9
- package/index.js +2 -2
- package/package.json +36 -33
- package/public/translations/de_DE.json +3 -27
- package/public/translations/en_GB.json +2 -26
- package/scripts/getDefaultWebpackConfig.js +25 -14
- package/src/App/Error/ProductionErrorPage/index.js +1 -1
- package/src/App/Modules/Creator/Components/ConfigurationvariantItem/index.js +3 -4
- package/src/App/Modules/Creator/Components/ConfigurationvariantSelection/index.js +2 -1
- package/src/App/Modules/Creator/Components/FastConfiguration/SelectableRow.js +1 -1
- package/src/App/Modules/Creator/Components/FastConfiguration/index.js +6 -5
- package/src/App/Modules/Creator/Components/FastConfigurationSelect/index.js +8 -6
- package/src/App/Modules/Creator/Components/FullScreenView/FullScreenView.js +3 -1
- package/src/App/Modules/Creator/Components/Incompatibility/OptionExclusionRule/index.js +2 -2
- package/src/App/Modules/Creator/Components/Incompatibility/OptionRule/index.js +2 -2
- package/src/App/Modules/Creator/Components/Incompatibility/index.js +2 -2
- package/src/App/Modules/Creator/Components/InvalidConfigurationNotice/index.js +1 -1
- package/src/App/Modules/Creator/Components/Option/__snapshots__/index.test.js.snap +0 -13
- package/src/App/Modules/Creator/Components/Option/index.js +9 -6
- package/src/App/Modules/Creator/Components/Option/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/OptionAmount/index.js +2 -1
- package/src/App/Modules/Creator/Components/OptionAmount/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/Optiondetail/ZoomImage/index.js +1 -1
- package/src/App/Modules/Creator/Components/Optiondetail/index.js +9 -7
- package/src/App/Modules/Creator/Components/Optiondetail/index.story.js +1 -48
- package/src/App/Modules/Creator/Components/Optiondetail/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/Optiondetail/index.test.mocks.js +49 -0
- package/src/App/Modules/Creator/Components/OptionsList/index.js +3 -2
- package/src/App/Modules/Creator/Components/ProductPart/index.test.js +1 -1
- package/src/App/Modules/Creator/Components/ProductPartsList/index.js +1 -1
- package/src/App/Modules/Creator/Components/SavedConfiguration/index.js +3 -3
- package/src/App/Modules/Creator/Components/StoreConfigurationForm/index.js +2 -2
- package/src/App/Modules/Creator/Containers/CustomTitleEditor/index.js +1 -1
- package/src/App/Modules/Creator/Containers/FastConfiguration/index.js +1 -1
- package/src/App/Modules/Creator/Containers/FormattedPrice/index.js +1 -1
- package/src/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +1 -1
- package/src/App/Modules/Creator/Containers/Optiondetail/index.js +1 -1
- package/src/App/Modules/Designer/Components/AddGalleryImage/__snapshots__/index.test.jsx.snap +0 -8
- package/src/App/Modules/Designer/Components/AddGalleryImage/index.js +4 -4
- package/src/App/Modules/Designer/Components/AddGalleryImage/index.test.jsx +0 -27
- package/src/App/Modules/Designer/Components/AddVisualElement/index.js +6 -6
- package/src/App/Modules/Designer/Components/AddVisualElement/index.test.jsx +3 -2
- package/src/App/Modules/Designer/Components/CloseDesignEditor/index.js +3 -3
- package/src/App/Modules/Designer/Components/ColorPalettes/ColorPalettesSearch.js +6 -6
- package/src/App/Modules/Designer/Components/ColorPalettes/index.js +14 -14
- package/src/App/Modules/Designer/Components/ColorPalettes/index.test.jsx +1 -1
- package/src/App/Modules/Designer/Components/DesignAreaControlbox/index.js +8 -8
- package/src/App/Modules/Designer/Components/DesignAreaControlbox/index.test.jsx +1 -1
- package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/CustomFontOverlay.js +5 -5
- package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +2 -2
- package/src/App/Modules/Designer/Components/Dialog/index.js +1 -1
- package/src/App/Modules/Designer/Components/EditDesignButton/index.js +3 -2
- package/src/App/Modules/Designer/Components/FeedbackNotice/index.js +3 -3
- package/src/App/Modules/Designer/Components/ImageColorize/index.js +1 -1
- package/src/App/Modules/Designer/Components/ImageControlbox/index.js +6 -6
- package/src/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +32 -6
- package/src/App/Modules/Designer/Components/ImageEditDialog/index.js +16 -12
- package/src/App/Modules/Designer/Components/ImageLibraryFilter/index.js +6 -6
- package/src/App/Modules/Designer/Components/ImageLibraryThumbnail/index.js +11 -7
- package/src/App/Modules/Designer/Components/ObjectTools/index.js +2 -2
- package/src/App/Modules/Designer/Components/Select/index.js +3 -3
- package/src/App/Modules/Designer/Components/TextControlbox/TextFormatIcon.js +1 -1
- package/src/App/Modules/Designer/Components/TextControlbox/index.js +11 -11
- package/src/App/Modules/Designer/Components/TextControlbox/index.test.jsx +3 -2
- package/src/App/Modules/Designer/Containers/AddGalleryImage.js +1 -1
- package/src/App/Modules/Designer/Designer.js +1 -1
- package/src/App/Modules/Designer/DesignerUI.js +7 -2
- package/src/App/Modules/Designer/Layouts/Mobile/TwoSideBottomBar.js +1 -1
- package/src/App/Modules/Designer/Layouts/PopupAreaProvider.js +1 -1
- package/src/App/Modules/Designer/MultilayerComponents/DesignerClickAwayListener.js +1 -1
- package/src/App/Modules/Designer/MultilayerComponents/InlineToolboxPortal.js +1 -1
- package/src/App/Modules/Designer/MultilayerComponents/StandardToolboxPortal.js +1 -1
- package/src/App/Modules/Designer/setupDesigner.js +22 -19
- package/src/App/Modules/Visualization/AlignTargetContainer.js +1 -1
- package/src/App/Modules/Visualization/CreatorAlignTarget.js +1 -1
- package/src/App/Modules/Visualization/DefaultVisualizationProvider.js +7 -2
- package/src/App/Modules/Visualization/DesignerAlignTarget.js +1 -1
- package/src/App/Reducers/Actions.js +5 -5
- package/src/App/Reducers/ConfigurationMode/Selectors.js +6 -0
- package/src/App/Reducers/Configurator/Actions.js +8 -1
- package/src/App/Reducers/Configurator/Reducer.js +27 -21
- package/src/App/Reducers/Configurator/Selectors.js +4 -1
- package/src/App/Reducers/DesignArea/Selectors.js +10 -0
- package/src/App/Reducers/Reducer.js +4 -3
- package/src/App/Reducers/UI/Actions.js +15 -1
- package/src/App/Reducers/UI/Reducer.js +20 -0
- package/src/App/Routing.js +12 -29
- package/src/App/Screens/Configurator/CalculationWidgetScreen.js +1 -4
- package/src/App/Screens/Configurator/Components/AmountSelection/index.js +4 -4
- package/src/App/Screens/Configurator/Components/CalculationWidget/index.js +3 -3
- package/src/App/Screens/Configurator/Components/CalculationWidget/index.test.jsx +5 -2
- package/src/App/Screens/Configurator/Components/ConfigurationModeSwitch/ConfigurationModeSwitch.js +1 -1
- package/src/App/Screens/Configurator/Components/FallbackVisualization/FallbackVisualization.js +1 -1
- package/src/App/Screens/Configurator/Components/FullScreenView/index.js +4 -4
- package/src/App/Screens/Configurator/Components/ItemTile/ItemTile.js +55 -17
- package/src/App/Screens/Configurator/Components/LandscapeInformation/index.js +1 -1
- package/src/App/Screens/Configurator/Components/NoVisualization/NoVisualization.js +1 -1
- package/src/App/Screens/Configurator/Components/PreviewPortal/index.js +7 -5
- package/src/App/Screens/Configurator/Components/Thumbnail/index.js +5 -4
- package/src/App/Screens/Configurator/Components/TotalPrice/TotalPrice.js +3 -3
- package/src/App/Screens/Configurator/Containers/AmountPrice.js +1 -1
- package/src/App/Screens/Configurator/Containers/__tests__/CalculationWidget.test.js +4 -1
- package/src/App/Screens/Configurator/Screen.js +13 -5
- package/src/App/Screens/Configurator/__tests__/Screen.test.js +6 -0
- package/src/App/Screens/DesignerProductPreview/Screen.js +2 -3
- package/src/App/Screens/DesignerProductPreview/__tests__/__snapshots__/Screen.test.js.snap +11 -11
- package/src/App/Screens/ItemOverview.js +74 -57
- package/src/App/Screens.js +1 -1
- package/src/App/Services/AnalyticsService.js +2 -1
- package/src/App/Services/DesignDataService.js +53 -7
- package/src/App/Services/DesignerService.js +22 -13
- package/src/App/Services/UIService.js +1 -1
- package/src/App/Services/VisualizationService.js +41 -2
- package/src/App/Services/__tests__/DesignDataService.test.js +1 -0
- package/src/App/Shared/Components/AcceptDesign/index.js +7 -6
- package/src/App/Shared/Components/AcceptPrivacy/index.js +4 -3
- package/src/App/Shared/Components/AddToBasket/index.js +4 -4
- package/src/App/Shared/Components/AmountInput/index.js +1 -1
- package/src/App/Shared/Components/AmountPrice/__snapshots__/index.test.jsx.snap +0 -125
- package/src/App/Shared/Components/AmountPrice/index.js +40 -17
- package/src/App/Shared/Components/AmountPrice/index.test.jsx +1 -1
- package/src/App/Shared/Components/Analytics/AnalyticsWrapper.test.js +2 -1
- package/src/App/Shared/Components/BulkNames/index.js +3 -3
- package/src/App/Shared/Components/CallToAction/__snapshots__/index.test.js.snap +4 -4
- package/src/App/Shared/Components/CallToAction/index.js +3 -3
- package/src/App/Shared/Components/CallToAction/index.test.js +1 -1
- package/src/App/Shared/Components/ConfigurationOverview/index.js +1 -1
- package/src/App/Shared/Components/Header/Header.js +3 -3
- package/src/App/Shared/Components/InformationTag/InformationTag.js +4 -2
- package/src/App/Shared/Components/LicenseNotice/LicenseNotice.js +3 -1
- package/src/App/Shared/Components/LoadConfiguration/index.js +27 -13
- package/src/App/Shared/Components/Notification/index.js +3 -3
- package/src/App/Shared/Components/PdfDownload/index.js +3 -3
- package/src/App/Shared/Components/PlusMinusInput/index.js +4 -4
- package/src/App/Shared/Components/PriceList/index.js +9 -9
- package/src/App/Shared/Components/PriceList/index.test.js +2 -2
- package/src/App/Shared/Components/PriceOverview/index.js +4 -4
- package/src/App/Shared/Components/PriceOverview/index.story.js +1 -1
- package/src/App/Shared/Components/ProductVariant/Image.js +1 -1
- package/src/App/Shared/Components/ProductVariant/index.js +5 -5
- package/src/App/Shared/Components/Progress/Progress.js +3 -3
- package/src/App/Shared/Components/ReceiveOfferForm/index.js +4 -4
- package/src/App/Shared/Components/SaveConfiguration/index.js +3 -3
- package/src/App/Shared/Components/SendEmail/index.js +3 -3
- package/src/App/Shared/Components/Stepper/index.js +4 -4
- package/src/App/Shared/Components/ToolbarList/index.js +6 -6
- package/src/App/Shared/Components/VariantChooser/index.js +7 -7
- package/src/App/Shared/Containers/AmountPrice/index.js +7 -1
- package/src/App/Shared/Containers/SaveConfiguration.js +1 -1
- package/src/App/Utils/Request/lazyFetch.js +2 -3
- package/src/App/configuration.js +20 -15
- package/src/App/index.js +2 -2
- package/src/Framework/Api.js +3 -3
- package/src/Framework/Components/Carousel/index.js +2 -2
- package/src/Framework/Components/Dialog/index.js +13 -10
- package/src/Framework/Components/DialogSelect/index.js +6 -5
- package/src/Framework/i18n.js +15 -8
- package/src/Shared/Components/CustomDialog.js +2 -1
- package/src/Shared/Components/CustomDialogSelect.js +2 -2
- package/src/Shared/Components/MainButton.js +2 -2
- package/src/Shared/Components/__tests__/index.test.jsx +6 -1
- package/src/Shared/HOCs/ResizeDetect/ResizeDetect.dev.js +1 -1
- package/src/Utils/Decorators/Observable.js +1 -0
- package/src/Utils/Test/mountWithState.js +1 -1
- package/App/Modules/Designer/Components/ImageEditDialog/res/checkers_tile.png +0 -0
- package/src/App/Modules/Designer/Components/ImageEditDialog/res/checkers_tile.png +0 -0
|
@@ -1,104 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports.updateColorAmountOnDesignProductionMethodChange = exports.rgbStrToHex = exports.makeOperationsCompatible = exports.isWidget = exports.isTextColorChange = exports.isColorTooBright = exports.getSvgContent = exports.getSvgColors = exports.getRgbValuesFromString = exports.getMissingColorPalettesColors = exports.getColorsDistance = exports.getColorPalettesIndex = exports.getClosestColorPaletteColor = exports["default"] = exports.checkColorUsage = exports.calculateImageBrightness = exports.applySvgContentOperations = exports.EventTypes = void 0;
|
|
8
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
-
|
|
10
9
|
var _first = _interopRequireDefault(require("lodash/first"));
|
|
11
|
-
|
|
12
10
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
13
|
-
|
|
14
11
|
var _find = _interopRequireDefault(require("lodash/find"));
|
|
15
|
-
|
|
16
12
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
17
|
-
|
|
18
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
19
|
-
|
|
20
14
|
var _i18n = require("../../Framework/i18n");
|
|
21
|
-
|
|
22
15
|
var _ServiceLocator = require("../ServiceLocator");
|
|
23
|
-
|
|
24
16
|
var _configuration = require("../configuration");
|
|
25
|
-
|
|
26
17
|
var _Observable = _interopRequireDefault(require("../../Utils/Decorators/Observable"));
|
|
27
|
-
|
|
28
18
|
var _setupDesigner = _interopRequireDefault(require("../Modules/Designer/setupDesigner"));
|
|
29
|
-
|
|
30
19
|
var _Actions = require("../Reducers/DesignData/Actions");
|
|
31
|
-
|
|
32
20
|
var _Actions2 = require("../Reducers/ImageGallery/Actions");
|
|
33
|
-
|
|
34
21
|
var _Modifiers = require("../Reducers/DesignData/Modifiers");
|
|
35
|
-
|
|
36
22
|
var _Actions3 = require("../Reducers/DesignArea/Actions");
|
|
37
|
-
|
|
38
23
|
var _Actions4 = require("../Reducers/DesignView/Actions");
|
|
39
|
-
|
|
40
24
|
var _Selectors = require("../Reducers/DesignArea/Selectors");
|
|
41
|
-
|
|
42
25
|
var _Selectors2 = require("../Reducers/ImageGallery/Selectors");
|
|
43
|
-
|
|
44
26
|
var _Selectors3 = require("../Reducers/Configurator/Selectors");
|
|
45
|
-
|
|
46
27
|
var _Selectors4 = require("../Reducers/Fonts/Selectors");
|
|
47
|
-
|
|
48
28
|
var _Actions5 = require("../Reducers/Confirm/Actions");
|
|
49
|
-
|
|
29
|
+
var _Actions6 = require("../Reducers/ConfigurationMode/Actions");
|
|
50
30
|
var _ObjectLock = require("../../Utils/Async/ObjectLock");
|
|
51
|
-
|
|
52
31
|
var _Transformers = require("../Reducers/DesignData/Transformers");
|
|
53
|
-
|
|
54
32
|
var _Modifiers2 = require("../Reducers/ImageGallery/Modifiers");
|
|
55
|
-
|
|
56
33
|
var _FontFaceRepository = require("../Modules/Designer/Utils/FontFaceRepository");
|
|
57
|
-
|
|
58
34
|
var _Selectors5 = require("../Reducers/DesignData/Selectors");
|
|
59
|
-
|
|
60
35
|
var _ImageEditUtils = require("../Modules/Designer/Utils/ImageEditUtils");
|
|
61
|
-
|
|
62
36
|
var _DesignElementSelectors = require("../Reducers/DesignArea/DesignElementSelectors");
|
|
63
|
-
|
|
64
37
|
var _designer_placeholder_logo = _interopRequireDefault(require("../../Resources/Images/designer_placeholder_logo.svg"));
|
|
65
|
-
|
|
66
38
|
var _this = void 0;
|
|
67
|
-
|
|
68
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
69
|
-
|
|
70
|
-
function _extends() { _extends = Object.assign
|
|
71
|
-
|
|
40
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
41
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
72
42
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
73
|
-
|
|
74
43
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
75
|
-
|
|
76
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
77
|
-
|
|
44
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
78
45
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
79
|
-
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
83
|
-
|
|
46
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
47
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
84
48
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
85
|
-
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
function
|
|
91
|
-
|
|
49
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
50
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
51
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
52
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
53
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
54
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
92
55
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
93
|
-
|
|
94
56
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
95
|
-
|
|
96
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
97
|
-
|
|
57
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
98
58
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
99
|
-
|
|
100
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
101
|
-
|
|
59
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
102
60
|
/**
|
|
103
61
|
* Preload all fonts for the given canvasData
|
|
104
62
|
* @param {object} canvasData The canvas data object
|
|
@@ -113,19 +71,16 @@ var preloadFonts = function preloadFonts(canvasData) {
|
|
|
113
71
|
return _FontFaceRepository.FontFaceRepository.collectFromHTML(content);
|
|
114
72
|
}));
|
|
115
73
|
};
|
|
116
|
-
|
|
117
|
-
var checkColorUsage = function () {
|
|
74
|
+
var checkColorUsage = exports.checkColorUsage = function () {
|
|
118
75
|
var alreadyAlertedColorCountState = {};
|
|
119
76
|
return function (canvasDataJSON, changeEvent) {
|
|
120
77
|
var _getSelectedDesignAre = (0, _Selectors.getSelectedDesignAreaProperties)(_ServiceLocator.Services.store.state),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
78
|
+
maxColorCount = _getSelectedDesignAre.maxColorAmount,
|
|
79
|
+
designAreaIdentifier = _getSelectedDesignAre.selectedDesignArea.identifier,
|
|
80
|
+
currentColorCount = _getSelectedDesignAre.colorAmount;
|
|
125
81
|
if (!designAreaIdentifier) {
|
|
126
82
|
return;
|
|
127
83
|
}
|
|
128
|
-
|
|
129
84
|
var changedObjectColorCount = (0, _Selectors.getColorsFromCanvasData)({
|
|
130
85
|
objects: [changeEvent.target.toObject()]
|
|
131
86
|
}).length;
|
|
@@ -134,49 +89,36 @@ var checkColorUsage = function () {
|
|
|
134
89
|
colorCount: changedObjectColorCount,
|
|
135
90
|
maxColorCount: maxColorCount
|
|
136
91
|
};
|
|
137
|
-
|
|
138
92
|
if (colorCount !== currentColorCount) {
|
|
139
93
|
_ServiceLocator.Services.store.dispatch((0, _Actions.setColorAmount)(colorCount));
|
|
140
94
|
}
|
|
141
|
-
|
|
142
95
|
var showAlert = maxColorCount && isTextColorChange(changeEvent) && changedObjectColorCount > maxColorCount && alreadyAlertedColorCountState[designAreaIdentifier].colorCount !== colorCountState.colorCount;
|
|
143
96
|
alreadyAlertedColorCountState[designAreaIdentifier] = colorCountState;
|
|
144
97
|
return showAlert;
|
|
145
98
|
};
|
|
146
99
|
}();
|
|
147
|
-
|
|
148
|
-
exports.checkColorUsage = checkColorUsage;
|
|
149
|
-
|
|
150
|
-
var isTextColorChange = function isTextColorChange(changeEvent) {
|
|
100
|
+
var isTextColorChange = exports.isTextColorChange = function isTextColorChange(changeEvent) {
|
|
151
101
|
if (changeEvent.target.type !== 'Text') {
|
|
152
102
|
return false;
|
|
153
103
|
}
|
|
154
|
-
|
|
155
104
|
var prevStyles = (0, _get2["default"])(changeEvent, 'eventData.prevState.style', {});
|
|
156
|
-
|
|
157
105
|
if ((0, _isEmpty["default"])(prevStyles)) {
|
|
158
106
|
return false;
|
|
159
107
|
}
|
|
160
|
-
|
|
161
108
|
var prevColors = (0, _get2["default"])(prevStyles, 'colors', []);
|
|
162
109
|
var colors = (0, _get2["default"])(changeEvent.target.toObject(), 'style.colors', []);
|
|
163
110
|
return !(0, _isEqual["default"])(prevColors, colors);
|
|
164
111
|
};
|
|
165
|
-
|
|
166
|
-
exports.isTextColorChange = isTextColorChange;
|
|
167
|
-
|
|
168
|
-
var getRgbValuesFromString = function getRgbValuesFromString(str) {
|
|
112
|
+
var getRgbValuesFromString = exports.getRgbValuesFromString = function getRgbValuesFromString(str) {
|
|
169
113
|
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
170
114
|
r: 0,
|
|
171
115
|
g: 0,
|
|
172
116
|
b: 0
|
|
173
117
|
};
|
|
174
118
|
var matches = str.match(/rgb\((.*)\)/);
|
|
175
|
-
|
|
176
119
|
if (!matches) {
|
|
177
120
|
return defaultValue;
|
|
178
121
|
}
|
|
179
|
-
|
|
180
122
|
var values = matches[1].split(',').map(function (number) {
|
|
181
123
|
return parseInt(number);
|
|
182
124
|
});
|
|
@@ -186,48 +128,32 @@ var getRgbValuesFromString = function getRgbValuesFromString(str) {
|
|
|
186
128
|
b: values[2]
|
|
187
129
|
};
|
|
188
130
|
};
|
|
189
|
-
|
|
190
|
-
exports.getRgbValuesFromString = getRgbValuesFromString;
|
|
191
|
-
|
|
192
|
-
var rgbStrToHex = function rgbStrToHex(str) {
|
|
131
|
+
var rgbStrToHex = exports.rgbStrToHex = function rgbStrToHex(str) {
|
|
193
132
|
return (0, _Selectors.rgbObjToHex)(getRgbValuesFromString(str));
|
|
194
133
|
};
|
|
195
|
-
|
|
196
|
-
exports.rgbStrToHex = rgbStrToHex;
|
|
197
|
-
|
|
198
|
-
var getColorsDistance = function getColorsDistance(color1, color2) {
|
|
134
|
+
var getColorsDistance = exports.getColorsDistance = function getColorsDistance(color1, color2) {
|
|
199
135
|
return Math.pow(color1.r - color2.r, 2) + Math.pow(color1.g - color2.g, 2) + Math.pow(color1.b - color2.b, 2);
|
|
200
136
|
};
|
|
201
|
-
|
|
202
|
-
exports.getColorsDistance = getColorsDistance;
|
|
203
|
-
|
|
204
|
-
var isColorTooBright = function isColorTooBright(rgbColors) {
|
|
137
|
+
var isColorTooBright = exports.isColorTooBright = function isColorTooBright(rgbColors) {
|
|
205
138
|
if (!rgbColors) {
|
|
206
139
|
return false;
|
|
207
140
|
}
|
|
208
|
-
|
|
209
141
|
var red = rgbColors.r,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
142
|
+
green = rgbColors.g,
|
|
143
|
+
blue = rgbColors.b;
|
|
213
144
|
if (typeof red !== 'number' || typeof green !== 'number' || typeof blue !== 'number' || red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255) {
|
|
214
145
|
return false;
|
|
215
146
|
}
|
|
216
|
-
|
|
217
147
|
var maxBrightness = 210;
|
|
218
148
|
var luma = 0.2126 * red + 0.7152 * green + 0.0722 * blue; // see https://bit.ly/2BXPOld
|
|
219
149
|
|
|
220
150
|
return luma > maxBrightness;
|
|
221
151
|
};
|
|
222
|
-
|
|
223
|
-
exports.isColorTooBright = isColorTooBright;
|
|
224
|
-
|
|
225
|
-
var calculateImageBrightness = function calculateImageBrightness(image) {
|
|
152
|
+
var calculateImageBrightness = exports.calculateImageBrightness = function calculateImageBrightness(image) {
|
|
226
153
|
if (!image) {
|
|
227
154
|
return;
|
|
228
155
|
}
|
|
229
|
-
|
|
230
|
-
var imageUrl = "".concat((0, _configuration.getConf)('network.host')).concat(image.data.thumbnail.url);
|
|
156
|
+
var imageUrl = image.data && image.data.thumbnail ? "".concat((0, _configuration.getConf)('network.host')).concat(image.data.thumbnail.url) : null;
|
|
231
157
|
var fuzzy = 0.1;
|
|
232
158
|
return new Promise(function (resolve, reject) {
|
|
233
159
|
var downloadedImg = new Image(200, 200);
|
|
@@ -241,46 +167,35 @@ var calculateImageBrightness = function calculateImageBrightness(image) {
|
|
|
241
167
|
var imageData = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
242
168
|
var data = imageData.data;
|
|
243
169
|
var light = 0,
|
|
244
|
-
|
|
245
|
-
|
|
170
|
+
dark = 0;
|
|
246
171
|
for (var x = 0; x < data.length; x += 4) {
|
|
247
172
|
var red = data[x];
|
|
248
173
|
var green = data[x + 1];
|
|
249
174
|
var blue = data[x + 2];
|
|
250
175
|
var alpha = data[x + 3];
|
|
251
|
-
|
|
252
176
|
if (alpha === 0) {
|
|
253
177
|
continue;
|
|
254
178
|
}
|
|
255
|
-
|
|
256
179
|
var maxRgb = Math.max(Math.max(red, green), blue);
|
|
257
180
|
if (maxRgb < 128) dark++;else light++;
|
|
258
181
|
}
|
|
259
|
-
|
|
260
182
|
var dlDiff = (light - dark) / (canvas.width * canvas.height);
|
|
261
|
-
image.data.thumbnail.isThumbnailBright = dlDiff + fuzzy > 0;
|
|
183
|
+
image.data && image.data.thumbnail ? image.data.thumbnail.isThumbnailBright = dlDiff + fuzzy > 0 : image.isBright = dlDiff + fuzzy > 0;
|
|
262
184
|
resolve(image);
|
|
263
185
|
}, false);
|
|
264
186
|
downloadedImg.addEventListener('error', reject);
|
|
265
|
-
downloadedImg.src = imageUrl;
|
|
187
|
+
downloadedImg.src = imageUrl || image.src;
|
|
266
188
|
});
|
|
267
189
|
};
|
|
268
|
-
|
|
269
|
-
exports.calculateImageBrightness = calculateImageBrightness;
|
|
270
|
-
|
|
271
|
-
var getColorPalettesIndex = function getColorPalettesIndex(colorPalettes) {
|
|
190
|
+
var getColorPalettesIndex = exports.getColorPalettesIndex = function getColorPalettesIndex(colorPalettes) {
|
|
272
191
|
var colorPalettesIndexes = [];
|
|
273
|
-
|
|
274
192
|
var _iterator = _createForOfIteratorHelper(colorPalettes),
|
|
275
|
-
|
|
276
|
-
|
|
193
|
+
_step;
|
|
277
194
|
try {
|
|
278
195
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
279
196
|
var colorPalette = _step.value;
|
|
280
|
-
|
|
281
197
|
var _iterator2 = _createForOfIteratorHelper(colorPalette.colors),
|
|
282
|
-
|
|
283
|
-
|
|
198
|
+
_step2;
|
|
284
199
|
try {
|
|
285
200
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
286
201
|
var colorPaletteColor = _step2.value;
|
|
@@ -303,24 +218,17 @@ var getColorPalettesIndex = function getColorPalettesIndex(colorPalettes) {
|
|
|
303
218
|
} finally {
|
|
304
219
|
_iterator.f();
|
|
305
220
|
}
|
|
306
|
-
|
|
307
221
|
return colorPalettesIndexes;
|
|
308
222
|
};
|
|
309
|
-
|
|
310
|
-
exports.getColorPalettesIndex = getColorPalettesIndex;
|
|
311
|
-
|
|
312
|
-
var getClosestColorPaletteColor = function getClosestColorPaletteColor(colorValueObject, colorPalettesIndexes) {
|
|
223
|
+
var getClosestColorPaletteColor = exports.getClosestColorPaletteColor = function getClosestColorPaletteColor(colorValueObject, colorPalettesIndexes) {
|
|
313
224
|
var closestDistance = null;
|
|
314
225
|
var closestColor = null;
|
|
315
|
-
|
|
316
226
|
var _iterator3 = _createForOfIteratorHelper(colorPalettesIndexes),
|
|
317
|
-
|
|
318
|
-
|
|
227
|
+
_step3;
|
|
319
228
|
try {
|
|
320
229
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
321
230
|
var colorPalettesIndex = _step3.value;
|
|
322
231
|
var distance = getColorsDistance(colorValueObject, colorPalettesIndex.valueObject);
|
|
323
|
-
|
|
324
232
|
if (closestDistance === null || distance < closestDistance) {
|
|
325
233
|
closestDistance = distance;
|
|
326
234
|
var rgb = colorPalettesIndex.valueObject;
|
|
@@ -333,36 +241,28 @@ var getClosestColorPaletteColor = function getClosestColorPaletteColor(colorValu
|
|
|
333
241
|
} finally {
|
|
334
242
|
_iterator3.f();
|
|
335
243
|
}
|
|
336
|
-
|
|
337
244
|
return closestColor;
|
|
338
245
|
};
|
|
339
|
-
|
|
340
|
-
exports.getClosestColorPaletteColor = getClosestColorPaletteColor;
|
|
341
|
-
|
|
342
|
-
var getMissingColorPalettesColors = function getMissingColorPalettesColors(colors, colorPalettes, replaceCustomColors) {
|
|
246
|
+
var getMissingColorPalettesColors = exports.getMissingColorPalettesColors = function getMissingColorPalettesColors(colors, colorPalettes, replaceCustomColors) {
|
|
343
247
|
var availableColorPalettes = colorPalettes.map(function (colorPalette) {
|
|
344
248
|
return colorPalette.identifier;
|
|
345
|
-
});
|
|
249
|
+
});
|
|
346
250
|
|
|
251
|
+
// skip if no available color palettes (most likely a data issue)
|
|
347
252
|
if (!availableColorPalettes.length) {
|
|
348
253
|
return [];
|
|
349
254
|
}
|
|
350
|
-
|
|
351
255
|
var colorsToReplace = colors.filter(function (color) {
|
|
352
256
|
var _parseColorData = (0, _Selectors.parseColorData)(color.identifier),
|
|
353
|
-
|
|
354
|
-
|
|
257
|
+
palette = _parseColorData.palette;
|
|
355
258
|
if (replaceCustomColors && palette === null) {
|
|
356
259
|
return true;
|
|
357
260
|
}
|
|
358
|
-
|
|
359
261
|
return palette && availableColorPalettes.indexOf(palette) === -1;
|
|
360
262
|
});
|
|
361
|
-
|
|
362
263
|
if (!colorsToReplace.length) {
|
|
363
264
|
return [];
|
|
364
265
|
}
|
|
365
|
-
|
|
366
266
|
var colorPalettesIndexes = getColorPalettesIndex(colorPalettes);
|
|
367
267
|
return colorsToReplace.map(function (color) {
|
|
368
268
|
var closestColor = getClosestColorPaletteColor(getRgbValuesFromString(color.value.startsWith('#') ? (0, _Selectors.hexToRgb)(color.value) : color.value), colorPalettesIndexes);
|
|
@@ -372,19 +272,13 @@ var getMissingColorPalettesColors = function getMissingColorPalettesColors(color
|
|
|
372
272
|
};
|
|
373
273
|
});
|
|
374
274
|
};
|
|
375
|
-
|
|
376
|
-
exports.getMissingColorPalettesColors = getMissingColorPalettesColors;
|
|
377
|
-
|
|
378
|
-
var makeOperationsCompatible = function makeOperationsCompatible(operations, compatibilityInfo, colorPalettes) {
|
|
275
|
+
var makeOperationsCompatible = exports.makeOperationsCompatible = function makeOperationsCompatible(operations, compatibilityInfo, colorPalettes) {
|
|
379
276
|
if (!operations) {
|
|
380
277
|
return operations;
|
|
381
278
|
}
|
|
382
|
-
|
|
383
279
|
var missingColorPalettesColors = getMissingColorPalettesColors(Object.values(operations.vectorizeColorsMap || {}), colorPalettes, !operations.vectorize && compatibilityInfo.vectorsRequired);
|
|
384
|
-
|
|
385
280
|
var _iterator4 = _createForOfIteratorHelper(missingColorPalettesColors),
|
|
386
|
-
|
|
387
|
-
|
|
281
|
+
_step4;
|
|
388
282
|
try {
|
|
389
283
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
390
284
|
var missingColor = _step4.value;
|
|
@@ -395,45 +289,34 @@ var makeOperationsCompatible = function makeOperationsCompatible(operations, com
|
|
|
395
289
|
} finally {
|
|
396
290
|
_iterator4.f();
|
|
397
291
|
}
|
|
398
|
-
|
|
399
292
|
return operations;
|
|
400
293
|
};
|
|
401
|
-
|
|
402
|
-
exports.makeOperationsCompatible = makeOperationsCompatible;
|
|
403
|
-
|
|
404
|
-
var getSvgContent = function () {
|
|
294
|
+
var getSvgContent = exports.getSvgContent = function () {
|
|
405
295
|
var svgContentMap = new Map();
|
|
406
296
|
return function getSvgContent(url) {
|
|
407
297
|
var absolute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
408
298
|
var forceFetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
409
299
|
var absUrl = absolute ? url : "".concat((0, _configuration.getConf)('network.host')).concat(url);
|
|
410
|
-
|
|
411
300
|
if (!forceFetch && svgContentMap.has(absUrl)) {
|
|
412
301
|
return svgContentMap.get(absUrl);
|
|
413
302
|
}
|
|
414
|
-
|
|
415
303
|
try {
|
|
416
|
-
var promise = _asyncToGenerator( /*#__PURE__*/
|
|
304
|
+
var promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
417
305
|
var result;
|
|
418
|
-
return
|
|
419
|
-
while (1) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
case 4:
|
|
430
|
-
case "end":
|
|
431
|
-
return _context.stop();
|
|
432
|
-
}
|
|
306
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
307
|
+
while (1) switch (_context.prev = _context.next) {
|
|
308
|
+
case 0:
|
|
309
|
+
_context.next = 2;
|
|
310
|
+
return _axios["default"].get(absUrl);
|
|
311
|
+
case 2:
|
|
312
|
+
result = _context.sent;
|
|
313
|
+
return _context.abrupt("return", (0, _Transformers.initDefaultColor)(result.data));
|
|
314
|
+
case 4:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context.stop();
|
|
433
317
|
}
|
|
434
318
|
}, _callee);
|
|
435
319
|
}))();
|
|
436
|
-
|
|
437
320
|
svgContentMap.set(absUrl, promise);
|
|
438
321
|
return promise;
|
|
439
322
|
} catch (e) {
|
|
@@ -441,42 +324,32 @@ var getSvgContent = function () {
|
|
|
441
324
|
}
|
|
442
325
|
};
|
|
443
326
|
}();
|
|
444
|
-
|
|
445
|
-
exports.getSvgContent = getSvgContent;
|
|
446
|
-
|
|
447
|
-
var applySvgContentOperations = function applySvgContentOperations(preview, operations, svgContent) {
|
|
327
|
+
var applySvgContentOperations = exports.applySvgContentOperations = function applySvgContentOperations(preview, operations, svgContent) {
|
|
448
328
|
// add missing attributes to svg tag if needed
|
|
449
|
-
var svgTags = svgContent.match(/<svg
|
|
450
|
-
|
|
329
|
+
var svgTags = svgContent.match(/<svg[^>]*>/);
|
|
451
330
|
if (svgTags && svgTags[0]) {
|
|
452
331
|
var svgTag = svgTags[0];
|
|
453
332
|
var percentageHeight = /height=["']\d+%["']/;
|
|
454
333
|
var percentageWidth = /width=["']\d+%["']/;
|
|
455
|
-
|
|
456
334
|
if (svgTag.indexOf('viewBox=') === -1) {
|
|
457
335
|
svgContent = svgContent.replace('<svg', "<svg viewBox=\"0 0 ".concat(preview.width, " ").concat(preview.height, "\""));
|
|
458
336
|
}
|
|
459
|
-
|
|
460
337
|
if (svgTag.indexOf('height=') === -1) {
|
|
461
338
|
svgContent = svgContent.replace('<svg', "<svg height=\"".concat(preview.height, "px\""));
|
|
462
339
|
}
|
|
463
|
-
|
|
464
340
|
if (svgTag.indexOf('width=') === -1) {
|
|
465
341
|
svgContent = svgContent.replace('<svg', "<svg width=\"".concat(preview.width, "px\""));
|
|
466
342
|
}
|
|
467
|
-
|
|
468
343
|
if (percentageHeight.test(svgTag)) {
|
|
469
344
|
svgContent = svgContent.replace(percentageHeight, "height=\"".concat(preview.height, "px\""));
|
|
470
345
|
}
|
|
471
|
-
|
|
472
346
|
if (percentageWidth.test(svgTag)) {
|
|
473
347
|
svgContent = svgContent.replace(percentageWidth, "width=\"".concat(preview.width, "px\""));
|
|
474
348
|
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
svgContent = svgContent.replace(/<!DOCTYPE(?:(?!>)[\s\S])*>/gi, '');
|
|
349
|
+
}
|
|
479
350
|
|
|
351
|
+
// remove doctype if present
|
|
352
|
+
svgContent = svgContent.replace(/<!DOCTYPE[^>]*>/gi, '');
|
|
480
353
|
if (operations && operations.vectorize && operations.vectorizeColorsMap && Object.keys(operations.vectorizeColorsMap).length) {
|
|
481
354
|
var colorRegex = new RegExp("(".concat(Object.keys(operations.vectorizeColorsMap).join('|'), ")"), 'ig');
|
|
482
355
|
svgContent = svgContent.replace(colorRegex, function (match) {
|
|
@@ -484,26 +357,18 @@ var applySvgContentOperations = function applySvgContentOperations(preview, oper
|
|
|
484
357
|
return (0, _Selectors.isValidHex)(value) ? value : '#000000';
|
|
485
358
|
});
|
|
486
359
|
}
|
|
487
|
-
|
|
488
360
|
return 'data:image/svg+xml;base64,' + btoa(svgContent);
|
|
489
361
|
};
|
|
490
|
-
|
|
491
|
-
exports.applySvgContentOperations = applySvgContentOperations;
|
|
492
|
-
|
|
493
|
-
var getSvgColors = function getSvgColors(svgContent, designProductionMethod) {
|
|
362
|
+
var getSvgColors = exports.getSvgColors = function getSvgColors(svgContent, designProductionMethod) {
|
|
494
363
|
var colors = svgContent.toLowerCase().match(/#[0-9a-f]{3,6}/g);
|
|
495
364
|
var colorsMap = [];
|
|
496
|
-
|
|
497
365
|
var _iterator5 = _createForOfIteratorHelper(designProductionMethod.colorPalettes),
|
|
498
|
-
|
|
499
|
-
|
|
366
|
+
_step5;
|
|
500
367
|
try {
|
|
501
368
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
502
369
|
var colorPalette = _step5.value;
|
|
503
|
-
|
|
504
370
|
var _iterator6 = _createForOfIteratorHelper(colorPalette.colors),
|
|
505
|
-
|
|
506
|
-
|
|
371
|
+
_step6;
|
|
507
372
|
try {
|
|
508
373
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
509
374
|
var color = _step6.value;
|
|
@@ -524,45 +389,39 @@ var getSvgColors = function getSvgColors(svgContent, designProductionMethod) {
|
|
|
524
389
|
} finally {
|
|
525
390
|
_iterator5.f();
|
|
526
391
|
}
|
|
527
|
-
|
|
528
392
|
var colorPalettesIndexes = getColorPalettesIndex(designProductionMethod.colorPalettes);
|
|
529
393
|
return colors.map(function (color) {
|
|
530
394
|
var paletteColor = (0, _find["default"])(colorsMap, function (colorsMapColor) {
|
|
531
395
|
return colorsMapColor.value === color;
|
|
532
|
-
});
|
|
396
|
+
});
|
|
533
397
|
|
|
398
|
+
// the color has a matching palette color
|
|
534
399
|
if (paletteColor) {
|
|
535
400
|
return {
|
|
536
401
|
key: color,
|
|
537
402
|
color: (0, _Selectors.createColorData)(paletteColor.identifier, paletteColor.paletteIdentifier, false, paletteColor.value)
|
|
538
403
|
};
|
|
539
|
-
}
|
|
540
|
-
|
|
404
|
+
}
|
|
541
405
|
|
|
406
|
+
// find the closest color in the palettes
|
|
542
407
|
if (colorPalettesIndexes.length) {
|
|
543
408
|
return {
|
|
544
409
|
key: color,
|
|
545
410
|
color: getClosestColorPaletteColor(getRgbValuesFromString((0, _Selectors.hexToRgb)(color)), colorPalettesIndexes)
|
|
546
411
|
};
|
|
547
|
-
}
|
|
548
|
-
|
|
412
|
+
}
|
|
549
413
|
|
|
414
|
+
// treat it as a custom color (fallback case)
|
|
550
415
|
return {
|
|
551
416
|
key: color,
|
|
552
417
|
color: (0, _Selectors.createColorData)(color, null, true, color)
|
|
553
418
|
};
|
|
554
419
|
});
|
|
555
420
|
};
|
|
556
|
-
|
|
557
|
-
exports.getSvgColors = getSvgColors;
|
|
558
|
-
|
|
559
|
-
var isWidget = function isWidget(pathname) {
|
|
421
|
+
var isWidget = exports.isWidget = function isWidget(pathname) {
|
|
560
422
|
return /\/widget\//.test(pathname);
|
|
561
423
|
};
|
|
562
|
-
|
|
563
|
-
exports.isWidget = isWidget;
|
|
564
|
-
|
|
565
|
-
var updateColorAmountOnDesignProductionMethodChange = function updateColorAmountOnDesignProductionMethodChange(selectedDesignProductionMethod) {
|
|
424
|
+
var updateColorAmountOnDesignProductionMethodChange = exports.updateColorAmountOnDesignProductionMethodChange = function updateColorAmountOnDesignProductionMethodChange(selectedDesignProductionMethod) {
|
|
566
425
|
var state = _ServiceLocator.Services.store.state;
|
|
567
426
|
var selectedProductionMethod = (0, _Selectors.getDesignProductionMethodByIdentifier)(state, selectedDesignProductionMethod);
|
|
568
427
|
var designAreaData = (0, _Selectors.getDesignDataForSelectedDesignArea)(state);
|
|
@@ -571,398 +430,385 @@ var updateColorAmountOnDesignProductionMethodChange = function updateColorAmount
|
|
|
571
430
|
var maxColorAmount = Number((0, _get2["default"])(selectedProductionMethod, 'options.maxColorAmount') || 0);
|
|
572
431
|
var activeDesignAreas = (0, _Selectors.getActiveDesignAreas)(state);
|
|
573
432
|
var isDesignAreaSelected = activeDesignAreas[selectedDesignArea.identifier];
|
|
574
|
-
|
|
575
433
|
if (colorAmount !== 1 && colorAmount > maxColorAmount) {
|
|
576
434
|
_ServiceLocator.Services.designData.getSampleCanvasEditorForDesignArea().setColorAmount(1);
|
|
577
|
-
|
|
578
435
|
isDesignAreaSelected && _this.getSampleCanvasEditorForDesignArea().setColorAmount(1);
|
|
579
436
|
}
|
|
580
437
|
};
|
|
581
|
-
|
|
582
|
-
exports.updateColorAmountOnDesignProductionMethodChange = updateColorAmountOnDesignProductionMethodChange;
|
|
583
|
-
var EventTypes = {
|
|
438
|
+
var EventTypes = exports.EventTypes = {
|
|
584
439
|
DesignAreaListChange: 'DesignDataService/DesignAreaListChange',
|
|
585
440
|
DesignViewListChange: 'DesignDataService/DesignViewListChange'
|
|
586
441
|
};
|
|
587
|
-
exports
|
|
588
|
-
|
|
589
|
-
var DesignDataService = /*#__PURE__*/function () {
|
|
442
|
+
var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
590
443
|
function DesignDataService() {
|
|
591
444
|
var _this2 = this;
|
|
592
|
-
|
|
593
445
|
_classCallCheck(this, DesignDataService);
|
|
594
|
-
|
|
595
446
|
_defineProperty(this, "observable", new _Observable["default"](this));
|
|
596
|
-
|
|
597
447
|
_defineProperty(this, "isInPreviewMode", false);
|
|
598
|
-
|
|
448
|
+
/**
|
|
449
|
+
*
|
|
450
|
+
* @type {function|null}
|
|
451
|
+
* @private
|
|
452
|
+
*/
|
|
599
453
|
_defineProperty(this, "_loadCanvasData", null);
|
|
600
|
-
|
|
454
|
+
/**
|
|
455
|
+
* A function that returns the canvas object associated to the given design area
|
|
456
|
+
* @type {function|null}
|
|
457
|
+
* @private
|
|
458
|
+
*/
|
|
601
459
|
_defineProperty(this, "_getCanvas", null);
|
|
602
|
-
|
|
460
|
+
/**
|
|
461
|
+
*
|
|
462
|
+
* @type {function|null}
|
|
463
|
+
* @private
|
|
464
|
+
*/
|
|
603
465
|
_defineProperty(this, "_serializeCanvas", null);
|
|
604
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Use this function to sync debounced canvas change handlers
|
|
468
|
+
* @type {function|null}
|
|
469
|
+
* @private
|
|
470
|
+
*/
|
|
605
471
|
_defineProperty(this, "_syncCanvasChange", null);
|
|
606
|
-
|
|
607
472
|
_defineProperty(this, "_isCanvasDataUpdateEnabled", true);
|
|
608
|
-
|
|
609
473
|
_defineProperty(this, "handleDesignProductionMethodChangeFromVectorizationToNonVectorization", /*#__PURE__*/function () {
|
|
610
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/
|
|
474
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(designProductionMethodIdentifier) {
|
|
611
475
|
var state, _getVectorizeForDesig, currentVectorsRequired, newVectorsRequired, designArea, images;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
case 7:
|
|
631
|
-
return _context2.abrupt("return", true);
|
|
632
|
-
|
|
633
|
-
case 8:
|
|
634
|
-
case "end":
|
|
635
|
-
return _context2.stop();
|
|
636
|
-
}
|
|
476
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
477
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
478
|
+
case 0:
|
|
479
|
+
state = _ServiceLocator.Services.store.state;
|
|
480
|
+
_getVectorizeForDesig = (0, _Selectors.getVectorizeForDesignProductionMethods)(state, designProductionMethodIdentifier), currentVectorsRequired = _getVectorizeForDesig.currentVectorsRequired, newVectorsRequired = _getVectorizeForDesig.newVectorsRequired;
|
|
481
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
482
|
+
images = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier);
|
|
483
|
+
if (!(currentVectorsRequired && !newVectorsRequired && images.length)) {
|
|
484
|
+
_context2.next = 8;
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
_context2.next = 7;
|
|
488
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showSwitchToProductionMethodWithoutVectorization)());
|
|
489
|
+
case 7:
|
|
490
|
+
return _context2.abrupt("return", true);
|
|
491
|
+
case 8:
|
|
492
|
+
case "end":
|
|
493
|
+
return _context2.stop();
|
|
637
494
|
}
|
|
638
495
|
}, _callee2);
|
|
639
496
|
}));
|
|
640
|
-
|
|
641
497
|
return function (_x) {
|
|
642
498
|
return _ref4.apply(this, arguments);
|
|
643
499
|
};
|
|
644
500
|
}());
|
|
645
|
-
|
|
646
501
|
_defineProperty(this, "handleDesignProductionMethodChangeFromNonVectorizationToVectorization", /*#__PURE__*/function () {
|
|
647
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/
|
|
502
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(designProductionMethodIdentifier) {
|
|
648
503
|
var state, _getVectorizeForDesig2, currentVectorsRequired, newVectorsRequired, designArea, nonVectorizedImages;
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
case 7:
|
|
670
|
-
return _context3.abrupt("return", true);
|
|
671
|
-
|
|
672
|
-
case 8:
|
|
673
|
-
case "end":
|
|
674
|
-
return _context3.stop();
|
|
675
|
-
}
|
|
504
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
505
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
506
|
+
case 0:
|
|
507
|
+
state = _ServiceLocator.Services.store.state;
|
|
508
|
+
_getVectorizeForDesig2 = (0, _Selectors.getVectorizeForDesignProductionMethods)(state, designProductionMethodIdentifier), currentVectorsRequired = _getVectorizeForDesig2.currentVectorsRequired, newVectorsRequired = _getVectorizeForDesig2.newVectorsRequired;
|
|
509
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
510
|
+
nonVectorizedImages = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier).filter(function (obj) {
|
|
511
|
+
return !(0, _get2["default"])(obj, 'imageData.operations.vectorize');
|
|
512
|
+
});
|
|
513
|
+
if (!(nonVectorizedImages.length === 1 && (!currentVectorsRequired && newVectorsRequired || !(0, _Selectors2.isColorPreviewCompatible)(state, nonVectorizedImages[0].imageData, designProductionMethodIdentifier)))) {
|
|
514
|
+
_context3.next = 8;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
_context3.next = 7;
|
|
518
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showSwitchToProductionMethodWithVectorization)());
|
|
519
|
+
case 7:
|
|
520
|
+
return _context3.abrupt("return", true);
|
|
521
|
+
case 8:
|
|
522
|
+
case "end":
|
|
523
|
+
return _context3.stop();
|
|
676
524
|
}
|
|
677
525
|
}, _callee3);
|
|
678
526
|
}));
|
|
679
|
-
|
|
680
527
|
return function (_x2) {
|
|
681
528
|
return _ref5.apply(this, arguments);
|
|
682
529
|
};
|
|
683
530
|
}());
|
|
684
|
-
|
|
685
531
|
_defineProperty(this, "handleDesignProductionMethodChangeToMandatoryVectorization", /*#__PURE__*/function () {
|
|
686
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/
|
|
532
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(designProductionMethodIdentifier) {
|
|
687
533
|
var state, _getMandatoryVectoriz, currentVectorsMandatory, newVectorsMandatory, designArea, nonColorizedImages;
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
case 7:
|
|
709
|
-
return _context4.abrupt("return", true);
|
|
710
|
-
|
|
711
|
-
case 8:
|
|
712
|
-
case "end":
|
|
713
|
-
return _context4.stop();
|
|
714
|
-
}
|
|
534
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
535
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
536
|
+
case 0:
|
|
537
|
+
state = _ServiceLocator.Services.store.state;
|
|
538
|
+
_getMandatoryVectoriz = (0, _Selectors.getMandatoryVectorizationForDesignProductionMethods)(state, designProductionMethodIdentifier), currentVectorsMandatory = _getMandatoryVectoriz.currentVectorsMandatory, newVectorsMandatory = _getMandatoryVectoriz.newVectorsMandatory;
|
|
539
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
540
|
+
nonColorizedImages = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier).filter(function (obj) {
|
|
541
|
+
return !(0, _get2["default"])(obj, 'imageData.gallery') && !(0, _get2["default"])(obj, 'imageData.displayColorPreview');
|
|
542
|
+
});
|
|
543
|
+
if (!(nonColorizedImages.length === 1 && (!currentVectorsMandatory && newVectorsMandatory || !(0, _Selectors2.isColorPreviewCompatible)(state, nonColorizedImages[0].imageData, designProductionMethodIdentifier)))) {
|
|
544
|
+
_context4.next = 8;
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
_context4.next = 7;
|
|
548
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showSwitchToProductionMethodWithVectorization)());
|
|
549
|
+
case 7:
|
|
550
|
+
return _context4.abrupt("return", true);
|
|
551
|
+
case 8:
|
|
552
|
+
case "end":
|
|
553
|
+
return _context4.stop();
|
|
715
554
|
}
|
|
716
555
|
}, _callee4);
|
|
717
556
|
}));
|
|
718
|
-
|
|
719
557
|
return function (_x3) {
|
|
720
558
|
return _ref6.apply(this, arguments);
|
|
721
559
|
};
|
|
722
560
|
}());
|
|
723
|
-
|
|
724
561
|
_defineProperty(this, "checkColorUsageForDesignProductionMethod", /*#__PURE__*/function () {
|
|
725
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/
|
|
562
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(designProductionMethodIdentifier) {
|
|
726
563
|
var state, _getSelectedDesignAre2, maxColorAmount, designProductionMethod, newProductionMethod, newMaxColorAmount, currentVectorsRequired, newVectorsRequired, designArea, colorPreviewRequired, canvas, images, missingColorPalettesColors;
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
colorPreviewRequired = (0, _Selectors.designProductionMethodHasEmbroideryVisualizationEffect)(newProductionMethod) || (0, _Selectors.isVectorizedLogoMandatory)(newProductionMethod);
|
|
740
|
-
|
|
741
|
-
if (!(newMaxColorAmount !== 0 && newMaxColorAmount < maxColorAmount || !currentVectorsRequired && newVectorsRequired || colorPreviewRequired)) {
|
|
742
|
-
_context5.next = 17;
|
|
743
|
-
break;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
canvas = _this2._getCanvas(designArea);
|
|
747
|
-
images = canvas ? canvas.objects.filter(function (obj) {
|
|
748
|
-
if (obj.type !== 'Image') {
|
|
749
|
-
return false;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
return !(0, _get2["default"])(obj, 'imageData.operations.vectorize') || !(0, _Selectors2.isColorPreviewCompatible)(state, obj.imageData, designProductionMethodIdentifier);
|
|
753
|
-
}) : [];
|
|
754
|
-
|
|
755
|
-
if (!(images.length > 1)) {
|
|
756
|
-
_context5.next = 17;
|
|
757
|
-
break;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
_context5.next = 14;
|
|
761
|
-
return _ServiceLocator.Services.store.dispatch((0, _Actions.showProductionMethodRemoveImagesConfirm)());
|
|
762
|
-
|
|
763
|
-
case 14:
|
|
764
|
-
images.forEach(function (object) {
|
|
765
|
-
object.remove();
|
|
766
|
-
});
|
|
564
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
565
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
566
|
+
case 0:
|
|
567
|
+
state = _ServiceLocator.Services.store.state;
|
|
568
|
+
_getSelectedDesignAre2 = (0, _Selectors.getSelectedDesignAreaProperties)(state), maxColorAmount = _getSelectedDesignAre2.maxColorAmount, designProductionMethod = _getSelectedDesignAre2.designProductionMethod;
|
|
569
|
+
newProductionMethod = (0, _Selectors.getDesignProductionMethodByIdentifier)(state, designProductionMethodIdentifier);
|
|
570
|
+
newMaxColorAmount = parseInt((0, _get2["default"])(newProductionMethod, 'options.maxColorAmount', 0));
|
|
571
|
+
currentVectorsRequired = !!(0, _get2["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
572
|
+
newVectorsRequired = !!(0, _get2["default"])(newProductionMethod, 'options.vectorsRequired');
|
|
573
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
574
|
+
colorPreviewRequired = (0, _Selectors.designProductionMethodHasEmbroideryVisualizationEffect)(newProductionMethod) || (0, _Selectors.isVectorizedLogoMandatory)(newProductionMethod);
|
|
575
|
+
if (!(newMaxColorAmount !== 0 && newMaxColorAmount < maxColorAmount || !currentVectorsRequired && newVectorsRequired || colorPreviewRequired)) {
|
|
767
576
|
_context5.next = 17;
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
_context5.next = 24;
|
|
775
|
-
break;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
if ((0, _Selectors.isColoringDisabled)(state, newProductionMethod.identifier)) {
|
|
779
|
-
_context5.next = 24;
|
|
780
|
-
break;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
canvas = _this2._getCanvas(designArea);
|
|
580
|
+
images = canvas ? canvas.objects.filter(function (obj) {
|
|
581
|
+
if (obj.type !== 'Image') {
|
|
582
|
+
return false;
|
|
781
583
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
584
|
+
return !(0, _get2["default"])(obj, 'imageData.operations.vectorize') || !(0, _Selectors2.isColorPreviewCompatible)(state, obj.imageData, designProductionMethodIdentifier);
|
|
585
|
+
}) : [];
|
|
586
|
+
if (!(images.length > 1)) {
|
|
587
|
+
_context5.next = 17;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
_context5.next = 14;
|
|
591
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showProductionMethodRemoveImagesConfirm)());
|
|
592
|
+
case 14:
|
|
593
|
+
images.forEach(function (object) {
|
|
594
|
+
object.remove();
|
|
595
|
+
});
|
|
596
|
+
_context5.next = 17;
|
|
597
|
+
return _this2.updateCanvasData(canvas);
|
|
598
|
+
case 17:
|
|
599
|
+
missingColorPalettesColors = getMissingColorPalettesColors((0, _Selectors.getColorsWithPalette)(state), newProductionMethod.colorPalettes, !currentVectorsRequired && newVectorsRequired);
|
|
600
|
+
if (!missingColorPalettesColors.length) {
|
|
787
601
|
_context5.next = 24;
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
if ((0, _Selectors.isColoringDisabled)(state, newProductionMethod.identifier)) {
|
|
605
|
+
_context5.next = 24;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
_context5.next = 22;
|
|
609
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showProductionMethodChangeColorsConfirm)());
|
|
610
|
+
case 22:
|
|
611
|
+
_context5.next = 24;
|
|
612
|
+
return _this2.replaceSelectedDesignAreaElementsColor(missingColorPalettesColors, newProductionMethod);
|
|
613
|
+
case 24:
|
|
614
|
+
case "end":
|
|
615
|
+
return _context5.stop();
|
|
794
616
|
}
|
|
795
617
|
}, _callee5);
|
|
796
618
|
}));
|
|
797
|
-
|
|
798
619
|
return function (_x4) {
|
|
799
620
|
return _ref7.apply(this, arguments);
|
|
800
621
|
};
|
|
801
622
|
}());
|
|
802
|
-
|
|
803
623
|
_defineProperty(this, "replaceSelectedDesignAreaElementsColor", /*#__PURE__*/function () {
|
|
804
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/
|
|
624
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(missingColorPalettesColors, designProductionMethod) {
|
|
805
625
|
var state, designArea, designData, objects, _iterator7, _step7, missingColor;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
_iterator7 =
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
missingColor
|
|
842
|
-
|
|
843
|
-
_ServiceLocator.Services.store.dispatch((0, _Actions.replaceDesignAreaTextsColor)(designArea.identifier, missingColor.color.identifier, {
|
|
844
|
-
rgb: missingColor.color.value,
|
|
845
|
-
hex: rgbStrToHex(missingColor.color.value)
|
|
846
|
-
}, missingColor.closestColor.identifier, missingColor.closestColor.value));
|
|
847
|
-
}
|
|
848
|
-
} catch (err) {
|
|
849
|
-
_iterator7.e(err);
|
|
850
|
-
} finally {
|
|
851
|
-
_iterator7.f();
|
|
626
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
627
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
628
|
+
case 0:
|
|
629
|
+
state = _ServiceLocator.Services.store.state;
|
|
630
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
631
|
+
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designArea.identifier);
|
|
632
|
+
objects = (0, _get2["default"])(designData, 'canvasData.objects', []);
|
|
633
|
+
_context6.next = 6;
|
|
634
|
+
return Promise.all(objects.filter(function (_ref9) {
|
|
635
|
+
var type = _ref9.type;
|
|
636
|
+
return type === 'Image';
|
|
637
|
+
}).map(function (_ref10) {
|
|
638
|
+
var imageData = _ref10.imageData;
|
|
639
|
+
return (0, _Selectors2.getUserImage)(state, imageData.identifier);
|
|
640
|
+
}).filter(function (image, idx, arr) {
|
|
641
|
+
return arr.indexOf(image) === idx &&
|
|
642
|
+
// uniq
|
|
643
|
+
!(0, _Selectors2.isColorMappingCompatible)(designProductionMethod.colorPalettes, (0, _get2["default"])(image, 'operations.vectorizeColorsMap'));
|
|
644
|
+
}).map(function (image) {
|
|
645
|
+
var operations = missingColorPalettesColors.reduce(function (currentOperations, missingColor) {
|
|
646
|
+
return (0, _Modifiers.replaceColorOnOperations)(currentOperations, missingColor.color, missingColor.closestColor);
|
|
647
|
+
}, image.operations);
|
|
648
|
+
return _ServiceLocator.Services.designData.editFile(operations, image, {
|
|
649
|
+
immediateCommit: true,
|
|
650
|
+
forceUpdate: true,
|
|
651
|
+
designProductionMethod: designProductionMethod
|
|
652
|
+
});
|
|
653
|
+
}));
|
|
654
|
+
case 6:
|
|
655
|
+
_iterator7 = _createForOfIteratorHelper(missingColorPalettesColors);
|
|
656
|
+
try {
|
|
657
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
658
|
+
missingColor = _step7.value;
|
|
659
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions.replaceDesignAreaTextsColor)(designArea.identifier, missingColor.color.identifier, {
|
|
660
|
+
rgb: missingColor.color.value,
|
|
661
|
+
hex: rgbStrToHex(missingColor.color.value)
|
|
662
|
+
}, missingColor.closestColor.identifier, missingColor.closestColor.value));
|
|
852
663
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
664
|
+
} catch (err) {
|
|
665
|
+
_iterator7.e(err);
|
|
666
|
+
} finally {
|
|
667
|
+
_iterator7.f();
|
|
668
|
+
}
|
|
669
|
+
_context6.next = 10;
|
|
670
|
+
return _this2.loadCanvasDataFromState([designArea]);
|
|
671
|
+
case 10:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context6.stop();
|
|
861
674
|
}
|
|
862
675
|
}, _callee6);
|
|
863
676
|
}));
|
|
864
|
-
|
|
865
677
|
return function (_x5, _x6) {
|
|
866
678
|
return _ref8.apply(this, arguments);
|
|
867
679
|
};
|
|
868
680
|
}());
|
|
869
681
|
}
|
|
870
|
-
|
|
871
682
|
_createClass(DesignDataService, [{
|
|
872
683
|
key: "init",
|
|
873
684
|
value: function init() {
|
|
874
685
|
var _this3 = this;
|
|
875
|
-
|
|
876
686
|
_ServiceLocator.Services.store.observeStore(function (state) {
|
|
877
687
|
return state.designArea.filteredDesignAreas;
|
|
878
688
|
}, /*#__PURE__*/function () {
|
|
879
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/
|
|
689
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(filteredDesignAreas, prevDesignAreas) {
|
|
880
690
|
var initList, areasToLoad;
|
|
881
|
-
return
|
|
882
|
-
while (1) {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
_context7.t0 = !(0, _Selectors3.isDesignerProductPreviewMode)() && areasToLoad.length;
|
|
902
|
-
|
|
903
|
-
if (!_context7.t0) {
|
|
904
|
-
_context7.next = 9;
|
|
905
|
-
break;
|
|
906
|
-
}
|
|
907
|
-
|
|
691
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
692
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
693
|
+
case 0:
|
|
694
|
+
_context7.prev = 0;
|
|
695
|
+
_context7.next = 3;
|
|
696
|
+
return _this3.initCanvases(filteredDesignAreas, prevDesignAreas);
|
|
697
|
+
case 3:
|
|
698
|
+
initList = _context7.sent;
|
|
699
|
+
// only the newly initialized canvases has to be loaded
|
|
700
|
+
areasToLoad = initList.filter(function (_ref12) {
|
|
701
|
+
var isNew = _ref12.isNew;
|
|
702
|
+
return isNew;
|
|
703
|
+
}).map(function (_ref13) {
|
|
704
|
+
var designArea = _ref13.designArea;
|
|
705
|
+
return designArea;
|
|
706
|
+
}); // the canvas data is there first with the configuration, but since the canvas instances are
|
|
707
|
+
// associated with the design areas the data can be loaded only when the design areas are available
|
|
708
|
+
_context7.t0 = !(0, _Selectors3.isDesignerProductPreviewMode)() && areasToLoad.length;
|
|
709
|
+
if (!_context7.t0) {
|
|
908
710
|
_context7.next = 9;
|
|
909
|
-
return _this3.loadCanvasDataFromState(areasToLoad);
|
|
910
|
-
|
|
911
|
-
case 9:
|
|
912
|
-
_this3.selectInitialDesignView();
|
|
913
|
-
|
|
914
|
-
_this3.designAreaListChangeListener(filteredDesignAreas, prevDesignAreas);
|
|
915
|
-
|
|
916
|
-
_context7.next = 16;
|
|
917
711
|
break;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
712
|
+
}
|
|
713
|
+
_context7.next = 9;
|
|
714
|
+
return _this3.loadCanvasDataFromState(areasToLoad);
|
|
715
|
+
case 9:
|
|
716
|
+
_this3.selectInitialDesignView();
|
|
717
|
+
_this3.designAreaListChangeListener(filteredDesignAreas, prevDesignAreas);
|
|
718
|
+
_this3.openDesignAreaEditorIfEditingParamIsSet();
|
|
719
|
+
_context7.next = 17;
|
|
720
|
+
break;
|
|
721
|
+
case 14:
|
|
722
|
+
_context7.prev = 14;
|
|
723
|
+
_context7.t1 = _context7["catch"](0);
|
|
724
|
+
// eslint-disable-next-line no-console
|
|
725
|
+
console.error('Error occurred in processing design area list change:', _context7.t1);
|
|
726
|
+
case 17:
|
|
727
|
+
case "end":
|
|
728
|
+
return _context7.stop();
|
|
929
729
|
}
|
|
930
|
-
}, _callee7, null, [[0,
|
|
730
|
+
}, _callee7, null, [[0, 14]]);
|
|
931
731
|
}));
|
|
932
|
-
|
|
933
732
|
return function (_x7, _x8) {
|
|
934
733
|
return _ref11.apply(this, arguments);
|
|
935
734
|
};
|
|
936
735
|
}());
|
|
937
|
-
|
|
938
736
|
_ServiceLocator.Services.store.observeStore(function (state) {
|
|
939
737
|
return state.designArea.maxZoom2d;
|
|
940
738
|
}, function (maxZoom2d) {
|
|
941
739
|
_ServiceLocator.Services.visualization.update2DMaxZoom(maxZoom2d);
|
|
942
|
-
});
|
|
740
|
+
});
|
|
741
|
+
// in calculation widget mode the canvas events should be disabled,
|
|
943
742
|
// the update is done directly after the modifications
|
|
944
|
-
|
|
945
|
-
|
|
946
743
|
if (isWidget(location.pathname)) {
|
|
947
744
|
this.toggleCanvasDataUpdate(false);
|
|
948
|
-
|
|
949
745
|
_ServiceLocator.Services.store.observeStore(_Selectors.getSelectedDesignProductionMethodIdentifier, function (selectedDesignProductionMethod) {
|
|
950
746
|
updateColorAmountOnDesignProductionMethodChange(selectedDesignProductionMethod);
|
|
951
747
|
});
|
|
952
748
|
}
|
|
953
|
-
|
|
954
749
|
_ServiceLocator.Services.store.observeStore(function (_ref14) {
|
|
955
750
|
var selectedoptionclassification = _ref14.configurator.selectedoptionclassification;
|
|
956
751
|
return selectedoptionclassification;
|
|
957
752
|
}, this.componentChangeHandler.bind(this));
|
|
958
|
-
|
|
959
753
|
(0, _setupDesigner["default"])(this);
|
|
960
754
|
}
|
|
755
|
+
}, {
|
|
756
|
+
key: "openDesignAreaEditorIfEditingParamIsSet",
|
|
757
|
+
value: function () {
|
|
758
|
+
var _openDesignAreaEditorIfEditingParamIsSet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
759
|
+
var query, isDesignerModeAvailable, selectedMode, viewChangedPromise;
|
|
760
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
761
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
762
|
+
case 0:
|
|
763
|
+
if (!this._editingHandlerDone) {
|
|
764
|
+
_context8.next = 2;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
return _context8.abrupt("return");
|
|
768
|
+
case 2:
|
|
769
|
+
query = new URLSearchParams(location.search);
|
|
770
|
+
if (query.has('_editing')) {
|
|
771
|
+
_context8.next = 5;
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
return _context8.abrupt("return");
|
|
775
|
+
case 5:
|
|
776
|
+
isDesignerModeAvailable = (0, _get2["default"])(_ServiceLocator.Services.store.state, 'configurationMode.availableModes.designer');
|
|
777
|
+
if (isDesignerModeAvailable) {
|
|
778
|
+
_context8.next = 8;
|
|
779
|
+
break;
|
|
780
|
+
}
|
|
781
|
+
return _context8.abrupt("return");
|
|
782
|
+
case 8:
|
|
783
|
+
selectedMode = (0, _get2["default"])(_ServiceLocator.Services.store.state, 'configurationMode.selectedMode');
|
|
784
|
+
if (selectedMode !== 'designer') {
|
|
785
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions6.selectConfigurationMode)('designer'));
|
|
786
|
+
}
|
|
787
|
+
viewChangedPromise = _ServiceLocator.Services.visualization.getViewChangedPromise();
|
|
788
|
+
if (!viewChangedPromise) {
|
|
789
|
+
_context8.next = 16;
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
_context8.next = 14;
|
|
793
|
+
return viewChangedPromise;
|
|
794
|
+
case 14:
|
|
795
|
+
this.openDesignAreaEditor();
|
|
796
|
+
this._editingHandlerDone = true;
|
|
797
|
+
case 16:
|
|
798
|
+
case "end":
|
|
799
|
+
return _context8.stop();
|
|
800
|
+
}
|
|
801
|
+
}, _callee8, this);
|
|
802
|
+
}));
|
|
803
|
+
function openDesignAreaEditorIfEditingParamIsSet() {
|
|
804
|
+
return _openDesignAreaEditorIfEditingParamIsSet.apply(this, arguments);
|
|
805
|
+
}
|
|
806
|
+
return openDesignAreaEditorIfEditingParamIsSet;
|
|
807
|
+
}()
|
|
961
808
|
}, {
|
|
962
809
|
key: "componentChangeHandler",
|
|
963
810
|
value: function componentChangeHandler(component, prevComponent) {
|
|
964
811
|
var identifier = (0, _get2["default"])(component, 'identifier');
|
|
965
|
-
|
|
966
812
|
if (identifier && identifier !== (0, _get2["default"])(prevComponent, 'identifier')) {
|
|
967
813
|
this.selectViewForComponent(component);
|
|
968
814
|
}
|
|
@@ -970,13 +816,16 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
970
816
|
}, {
|
|
971
817
|
key: "selectViewForComponent",
|
|
972
818
|
value: function selectViewForComponent(component) {
|
|
973
|
-
var designViewIdentifier =
|
|
974
|
-
|
|
975
|
-
(0, _get2["default"])(
|
|
976
|
-
|
|
819
|
+
var designViewIdentifier =
|
|
820
|
+
// use the view linked to the component
|
|
821
|
+
(0, _get2["default"])(component, 'creatorView.identifier') ||
|
|
822
|
+
// if no linked view, use the last selected view
|
|
823
|
+
(0, _get2["default"])(_ServiceLocator.Services.store.state, 'designView.lastSelectedDesignView.identifier') ||
|
|
824
|
+
// if nothing was selected, use the initial design view
|
|
825
|
+
this.getInitialDesignViewIdentifier() ||
|
|
826
|
+
// if no initial design view, use the first view from the list
|
|
977
827
|
(0, _get2["default"])(_ServiceLocator.Services.store.state, 'designView.designViews[0].identifier');
|
|
978
828
|
var currentDesignViewIdentifier = (0, _get2["default"])(_ServiceLocator.Services.store.state, 'designView.selectedDesignView.identifier');
|
|
979
|
-
|
|
980
829
|
if (currentDesignViewIdentifier !== designViewIdentifier) {
|
|
981
830
|
var switchViewOnComponentSelection = (0, _configuration.getConf)('switchViewOnComponentSelection', true);
|
|
982
831
|
this.selectDesignView(designViewIdentifier, {
|
|
@@ -984,6 +833,7 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
984
833
|
});
|
|
985
834
|
}
|
|
986
835
|
}
|
|
836
|
+
|
|
987
837
|
/**
|
|
988
838
|
* Register a function to be called to load the canvas data into the active canvas
|
|
989
839
|
* or into the one that's related to the provided design area.
|
|
@@ -991,12 +841,12 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
991
841
|
* @see loadCanvasDataFromState
|
|
992
842
|
* @see createCanvasChangeListener
|
|
993
843
|
*/
|
|
994
|
-
|
|
995
844
|
}, {
|
|
996
845
|
key: "registerLoadCanvasData",
|
|
997
846
|
value: function registerLoadCanvasData(fn) {
|
|
998
847
|
this._loadCanvasData = fn;
|
|
999
848
|
}
|
|
849
|
+
|
|
1000
850
|
/**
|
|
1001
851
|
* Register a function to be called to load the canvas data into the active canvas
|
|
1002
852
|
* or into the one that's related to the provided design area.
|
|
@@ -1004,173 +854,153 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1004
854
|
* @see updateCanvasData
|
|
1005
855
|
* @see createCanvasChangeListener
|
|
1006
856
|
*/
|
|
1007
|
-
|
|
1008
857
|
}, {
|
|
1009
858
|
key: "registerUpdateCanvasData",
|
|
1010
859
|
value: function registerUpdateCanvasData(fn) {
|
|
1011
860
|
this._updateCanvasData = fn;
|
|
1012
861
|
}
|
|
862
|
+
|
|
1013
863
|
/**
|
|
1014
864
|
* Register a function to be called to get the canvas that is associated with the given design area
|
|
1015
865
|
* @param {function} fn
|
|
1016
866
|
* @see redrawAllDesignAreas
|
|
1017
867
|
*/
|
|
1018
|
-
|
|
1019
868
|
}, {
|
|
1020
869
|
key: "registerGetCanvas",
|
|
1021
870
|
value: function registerGetCanvas(fn) {
|
|
1022
871
|
this._getCanvas = fn;
|
|
1023
872
|
}
|
|
873
|
+
|
|
1024
874
|
/**
|
|
1025
875
|
* Register a function to be called to initialize a canvas
|
|
1026
876
|
* @param {function} fn
|
|
1027
877
|
* @see initCanvases
|
|
1028
878
|
*/
|
|
1029
|
-
|
|
1030
879
|
}, {
|
|
1031
880
|
key: "registerInitCanvas",
|
|
1032
881
|
value: function registerInitCanvas(fn) {
|
|
1033
882
|
this._initCanvas = fn;
|
|
1034
883
|
}
|
|
884
|
+
|
|
1035
885
|
/**
|
|
1036
886
|
* Register a function to be called to remove a canvas
|
|
1037
887
|
* @param {function} fn
|
|
1038
888
|
* @see initCanvases
|
|
1039
889
|
*/
|
|
1040
|
-
|
|
1041
890
|
}, {
|
|
1042
891
|
key: "registerRemoveCanvas",
|
|
1043
892
|
value: function registerRemoveCanvas(fn) {
|
|
1044
893
|
this._removeCanvas = fn;
|
|
1045
894
|
}
|
|
895
|
+
|
|
1046
896
|
/**
|
|
1047
897
|
* Calls the registered _initCanvas function for all design areas
|
|
1048
898
|
* @param designAreas
|
|
1049
899
|
* @param prevDesignAreas
|
|
1050
900
|
*/
|
|
1051
|
-
|
|
1052
901
|
}, {
|
|
1053
902
|
key: "initCanvases",
|
|
1054
903
|
value: function () {
|
|
1055
|
-
var _initCanvases = _asyncToGenerator( /*#__PURE__*/
|
|
904
|
+
var _initCanvases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(designAreas, prevDesignAreas) {
|
|
1056
905
|
var _this4 = this;
|
|
1057
|
-
|
|
1058
906
|
var state;
|
|
1059
|
-
return
|
|
1060
|
-
while (1) {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
return
|
|
1066
|
-
return prevArea.identifier === area.identifier;
|
|
1067
|
-
});
|
|
1068
|
-
}).forEach(function (prevArea) {
|
|
1069
|
-
return _this4._removeCanvas(prevArea);
|
|
907
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
908
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
909
|
+
case 0:
|
|
910
|
+
// clean up first: remove canvases that are not mapped to any design areas
|
|
911
|
+
this._removeCanvas && prevDesignAreas.filter(function (prevArea) {
|
|
912
|
+
return !designAreas.some(function (area) {
|
|
913
|
+
return prevArea.identifier === area.identifier;
|
|
1070
914
|
});
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
915
|
+
}).forEach(function (prevArea) {
|
|
916
|
+
return _this4._removeCanvas(prevArea);
|
|
917
|
+
});
|
|
918
|
+
state = _ServiceLocator.Services.store.state;
|
|
919
|
+
_context9.next = 4;
|
|
920
|
+
return Promise.all(designAreas.map(function (designArea) {
|
|
921
|
+
var maskData = (0, _Selectors.getMaskDataForDesignArea)(state, designArea);
|
|
922
|
+
var canvasSize = (0, _Selectors.getCanvasSizeFromDesignArea)(state, designArea);
|
|
923
|
+
var prevDesignArea = (0, _find["default"])(prevDesignAreas, {
|
|
924
|
+
identifier: designArea.identifier
|
|
925
|
+
});
|
|
926
|
+
var colorOverlayData = (0, _Selectors.getColorOverlayData)(state, designArea);
|
|
927
|
+
return _this4._initCanvas && _this4._initCanvas({
|
|
928
|
+
designArea: designArea,
|
|
929
|
+
prevDesignArea: prevDesignArea,
|
|
930
|
+
canvasSize: canvasSize,
|
|
931
|
+
maskData: maskData,
|
|
932
|
+
colorOverlayData: colorOverlayData
|
|
933
|
+
});
|
|
934
|
+
}));
|
|
935
|
+
case 4:
|
|
936
|
+
return _context9.abrupt("return", _context9.sent);
|
|
937
|
+
case 5:
|
|
938
|
+
case "end":
|
|
939
|
+
return _context9.stop();
|
|
1094
940
|
}
|
|
1095
|
-
},
|
|
941
|
+
}, _callee9, this);
|
|
1096
942
|
}));
|
|
1097
|
-
|
|
1098
943
|
function initCanvases(_x9, _x10) {
|
|
1099
944
|
return _initCanvases.apply(this, arguments);
|
|
1100
945
|
}
|
|
1101
|
-
|
|
1102
946
|
return initCanvases;
|
|
1103
947
|
}()
|
|
1104
948
|
/**
|
|
1105
949
|
* Calls syncCanvases with the registered _loadCanvasData function
|
|
1106
950
|
* @param {array} designAreas
|
|
1107
951
|
*/
|
|
1108
|
-
|
|
1109
952
|
}, {
|
|
1110
953
|
key: "updateCanvasDataFromState",
|
|
1111
954
|
value: function () {
|
|
1112
|
-
var _updateCanvasDataFromState = _asyncToGenerator( /*#__PURE__*/
|
|
955
|
+
var _updateCanvasDataFromState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1113
956
|
var designAreas,
|
|
1114
|
-
|
|
1115
|
-
return
|
|
1116
|
-
while (1) {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
case 4:
|
|
1127
|
-
case "end":
|
|
1128
|
-
return _context9.stop();
|
|
1129
|
-
}
|
|
957
|
+
_args10 = arguments;
|
|
958
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
959
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
960
|
+
case 0:
|
|
961
|
+
designAreas = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : this.getDesignAreas();
|
|
962
|
+
_context10.next = 3;
|
|
963
|
+
return this.syncCanvases(this._updateCanvasData, designAreas);
|
|
964
|
+
case 3:
|
|
965
|
+
return _context10.abrupt("return", _context10.sent);
|
|
966
|
+
case 4:
|
|
967
|
+
case "end":
|
|
968
|
+
return _context10.stop();
|
|
1130
969
|
}
|
|
1131
|
-
},
|
|
970
|
+
}, _callee10, this);
|
|
1132
971
|
}));
|
|
1133
|
-
|
|
1134
972
|
function updateCanvasDataFromState() {
|
|
1135
973
|
return _updateCanvasDataFromState.apply(this, arguments);
|
|
1136
974
|
}
|
|
1137
|
-
|
|
1138
975
|
return updateCanvasDataFromState;
|
|
1139
976
|
}()
|
|
1140
977
|
/**
|
|
1141
978
|
* Calls syncCanvases with the registered _loadCanvasData function
|
|
1142
979
|
* @param {array} designAreas
|
|
1143
980
|
*/
|
|
1144
|
-
|
|
1145
981
|
}, {
|
|
1146
982
|
key: "loadCanvasDataFromState",
|
|
1147
983
|
value: function () {
|
|
1148
|
-
var _loadCanvasDataFromState = _asyncToGenerator( /*#__PURE__*/
|
|
984
|
+
var _loadCanvasDataFromState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1149
985
|
var designAreas,
|
|
1150
|
-
|
|
1151
|
-
return
|
|
1152
|
-
while (1) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
case 4:
|
|
1163
|
-
case "end":
|
|
1164
|
-
return _context10.stop();
|
|
1165
|
-
}
|
|
986
|
+
_args11 = arguments;
|
|
987
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
988
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
989
|
+
case 0:
|
|
990
|
+
designAreas = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : this.getDesignAreas();
|
|
991
|
+
_context11.next = 3;
|
|
992
|
+
return this.syncCanvases(this._loadCanvasData, designAreas);
|
|
993
|
+
case 3:
|
|
994
|
+
return _context11.abrupt("return", _context11.sent);
|
|
995
|
+
case 4:
|
|
996
|
+
case "end":
|
|
997
|
+
return _context11.stop();
|
|
1166
998
|
}
|
|
1167
|
-
},
|
|
999
|
+
}, _callee11, this);
|
|
1168
1000
|
}));
|
|
1169
|
-
|
|
1170
1001
|
function loadCanvasDataFromState() {
|
|
1171
1002
|
return _loadCanvasDataFromState.apply(this, arguments);
|
|
1172
1003
|
}
|
|
1173
|
-
|
|
1174
1004
|
return loadCanvasDataFromState;
|
|
1175
1005
|
}()
|
|
1176
1006
|
/**
|
|
@@ -1180,72 +1010,57 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1180
1010
|
* @param {array} designAreas
|
|
1181
1011
|
* @return {Promise<void>}
|
|
1182
1012
|
*/
|
|
1183
|
-
|
|
1184
1013
|
}, {
|
|
1185
1014
|
key: "syncCanvases",
|
|
1186
1015
|
value: function () {
|
|
1187
|
-
var _syncCanvases = _asyncToGenerator( /*#__PURE__*/
|
|
1016
|
+
var _syncCanvases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(updateFn, designAreas) {
|
|
1188
1017
|
var _this5 = this;
|
|
1189
|
-
|
|
1190
1018
|
var state;
|
|
1191
|
-
return
|
|
1192
|
-
while (1) {
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
var
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
if (!canvasData) {
|
|
1208
|
-
_context11.next = 7;
|
|
1209
|
-
break;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
_context11.next = 5;
|
|
1213
|
-
return preloadFonts(canvasData);
|
|
1214
|
-
|
|
1215
|
-
case 5:
|
|
1216
|
-
canvasSize = (0, _Selectors.getCanvasSizeFromDesignArea)(state, designArea);
|
|
1217
|
-
return _context11.abrupt("return", updateFn && updateFn(canvasData, designArea, canvasSize));
|
|
1218
|
-
|
|
1219
|
-
case 7:
|
|
1220
|
-
case "end":
|
|
1221
|
-
return _context11.stop();
|
|
1019
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1020
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1021
|
+
case 0:
|
|
1022
|
+
state = _ServiceLocator.Services.store.state;
|
|
1023
|
+
_context13.next = 3;
|
|
1024
|
+
return Promise.all(designAreas.map( /*#__PURE__*/function () {
|
|
1025
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(designArea) {
|
|
1026
|
+
var designData, canvasData, canvasSize;
|
|
1027
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1028
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1029
|
+
case 0:
|
|
1030
|
+
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designArea.identifier);
|
|
1031
|
+
canvasData = (0, _get2["default"])(designData, 'canvasData');
|
|
1032
|
+
if (!canvasData) {
|
|
1033
|
+
_context12.next = 7;
|
|
1034
|
+
break;
|
|
1222
1035
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1036
|
+
_context12.next = 5;
|
|
1037
|
+
return preloadFonts(canvasData);
|
|
1038
|
+
case 5:
|
|
1039
|
+
canvasSize = (0, _Selectors.getCanvasSizeFromDesignArea)(state, designArea);
|
|
1040
|
+
return _context12.abrupt("return", updateFn && updateFn(canvasData, designArea, canvasSize));
|
|
1041
|
+
case 7:
|
|
1042
|
+
case "end":
|
|
1043
|
+
return _context12.stop();
|
|
1044
|
+
}
|
|
1045
|
+
}, _callee12);
|
|
1046
|
+
}));
|
|
1047
|
+
return function (_x13) {
|
|
1048
|
+
return _ref15.apply(this, arguments);
|
|
1049
|
+
};
|
|
1050
|
+
}()));
|
|
1051
|
+
case 3:
|
|
1052
|
+
window.setTimeout(function () {
|
|
1053
|
+
_this5.updateVisualization();
|
|
1054
|
+
}, 100);
|
|
1055
|
+
case 4:
|
|
1056
|
+
case "end":
|
|
1057
|
+
return _context13.stop();
|
|
1241
1058
|
}
|
|
1242
|
-
},
|
|
1059
|
+
}, _callee13);
|
|
1243
1060
|
}));
|
|
1244
|
-
|
|
1245
1061
|
function syncCanvases(_x11, _x12) {
|
|
1246
1062
|
return _syncCanvases.apply(this, arguments);
|
|
1247
1063
|
}
|
|
1248
|
-
|
|
1249
1064
|
return syncCanvases;
|
|
1250
1065
|
}()
|
|
1251
1066
|
}, {
|
|
@@ -1268,11 +1083,9 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1268
1083
|
value: function removeBulkNameItems(designData) {
|
|
1269
1084
|
var designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
1270
1085
|
var canvasData = designData.canvasData;
|
|
1271
|
-
|
|
1272
1086
|
if (!canvasData) {
|
|
1273
1087
|
return;
|
|
1274
1088
|
}
|
|
1275
|
-
|
|
1276
1089
|
var objects = canvasData ? canvasData.objects.filter(function (obj) {
|
|
1277
1090
|
return !obj.isBulkName;
|
|
1278
1091
|
}) : [];
|
|
@@ -1288,7 +1101,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1288
1101
|
if (filteredDesignAreas.length && !prevDesignAreas.length) {
|
|
1289
1102
|
this.applyDesignAreaPreSelection(filteredDesignAreas);
|
|
1290
1103
|
}
|
|
1291
|
-
|
|
1292
1104
|
_ServiceLocator.Services.visualization.updateDesignAreaList(filteredDesignAreas);
|
|
1293
1105
|
}
|
|
1294
1106
|
}, {
|
|
@@ -1299,84 +1111,65 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1299
1111
|
}, {
|
|
1300
1112
|
key: "updateCanvasData",
|
|
1301
1113
|
value: function () {
|
|
1302
|
-
var _updateCanvasData = _asyncToGenerator( /*#__PURE__*/
|
|
1114
|
+
var _updateCanvasData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(canvas, eventData) {
|
|
1303
1115
|
var canvasDataJSON, showAlert, _getDesignDataForSele, canvasData;
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
_getDesignDataForSele = (0, _Selectors.getDesignDataForSelectedDesignArea)(_ServiceLocator.Services.store.state), canvasData = _getDesignDataForSele.canvasData; // Restore Graphics Editor state
|
|
1332
|
-
|
|
1333
|
-
this._loadCanvasData && this._loadCanvasData(canvasData);
|
|
1334
|
-
return _context13.abrupt("return");
|
|
1335
|
-
|
|
1336
|
-
case 9:
|
|
1337
|
-
this.setCanvasData(canvasDataJSON);
|
|
1338
|
-
|
|
1339
|
-
case 10:
|
|
1340
|
-
case "end":
|
|
1341
|
-
return _context13.stop();
|
|
1342
|
-
}
|
|
1116
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1117
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1118
|
+
case 0:
|
|
1119
|
+
if (this._serializeCanvas) {
|
|
1120
|
+
_context14.next = 2;
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
throw new TypeError("The registerCanvasSerializer method has to be called first with a valid function!");
|
|
1124
|
+
case 2:
|
|
1125
|
+
canvasDataJSON = this._serializeCanvas(canvas); // check the color usage before storing the canvas data, so the user can decide to
|
|
1126
|
+
// 1. proceed with more colors than the allowed or
|
|
1127
|
+
// 2. undo the changes
|
|
1128
|
+
//added check to avoid the checkColorUsage in Widget view(as evenData is undefined)
|
|
1129
|
+
showAlert = eventData ? checkColorUsage(canvasDataJSON, eventData.changeEvent) : false;
|
|
1130
|
+
if (!(showAlert && (0, _configuration.getConf)('displayColorAmountWarnings', true))) {
|
|
1131
|
+
_context14.next = 9;
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
_ServiceLocator.Services.ui.reportError((0, _i18n.t)('colorAmountAlert.colorChangeReverted'));
|
|
1135
|
+
_getDesignDataForSele = (0, _Selectors.getDesignDataForSelectedDesignArea)(_ServiceLocator.Services.store.state), canvasData = _getDesignDataForSele.canvasData; // Restore Graphics Editor state
|
|
1136
|
+
this._loadCanvasData && this._loadCanvasData(canvasData);
|
|
1137
|
+
return _context14.abrupt("return");
|
|
1138
|
+
case 9:
|
|
1139
|
+
this.setCanvasData(canvasDataJSON);
|
|
1140
|
+
case 10:
|
|
1141
|
+
case "end":
|
|
1142
|
+
return _context14.stop();
|
|
1343
1143
|
}
|
|
1344
|
-
},
|
|
1144
|
+
}, _callee14, this);
|
|
1345
1145
|
}));
|
|
1346
|
-
|
|
1347
1146
|
function updateCanvasData(_x14, _x15) {
|
|
1348
1147
|
return _updateCanvasData.apply(this, arguments);
|
|
1349
1148
|
}
|
|
1350
|
-
|
|
1351
1149
|
return updateCanvasData;
|
|
1352
1150
|
}()
|
|
1353
1151
|
}, {
|
|
1354
1152
|
key: "createCanvasChangeListener",
|
|
1355
1153
|
value: function createCanvasChangeListener(_ref17) {
|
|
1356
1154
|
var _this6 = this;
|
|
1357
|
-
|
|
1358
1155
|
var syncCanvasChange = _ref17.syncCanvasChange;
|
|
1359
1156
|
this._syncCanvasChange = syncCanvasChange;
|
|
1360
|
-
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1361
|
-
var
|
|
1362
|
-
return
|
|
1363
|
-
while (1) {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
case 3:
|
|
1375
|
-
case "end":
|
|
1376
|
-
return _context14.stop();
|
|
1377
|
-
}
|
|
1157
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1158
|
+
var _args15 = arguments;
|
|
1159
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1160
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1161
|
+
case 0:
|
|
1162
|
+
if (!_this6._isCanvasDataUpdateEnabled) {
|
|
1163
|
+
_context15.next = 3;
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
_context15.next = 3;
|
|
1167
|
+
return _this6.updateCanvasData.apply(_this6, _args15);
|
|
1168
|
+
case 3:
|
|
1169
|
+
case "end":
|
|
1170
|
+
return _context15.stop();
|
|
1378
1171
|
}
|
|
1379
|
-
},
|
|
1172
|
+
}, _callee15);
|
|
1380
1173
|
}));
|
|
1381
1174
|
}
|
|
1382
1175
|
}, {
|
|
@@ -1390,12 +1183,12 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1390
1183
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !this._isCanvasDataUpdateEnabled;
|
|
1391
1184
|
this._isCanvasDataUpdateEnabled = value;
|
|
1392
1185
|
}
|
|
1186
|
+
|
|
1393
1187
|
/**
|
|
1394
1188
|
* Call the registered listener function when the design area changes
|
|
1395
1189
|
* Passes the selected design area and the canvas size to the listener function
|
|
1396
1190
|
* @param listenerFn
|
|
1397
1191
|
*/
|
|
1398
|
-
|
|
1399
1192
|
}, {
|
|
1400
1193
|
key: "registerDesignAreaChangeListener",
|
|
1401
1194
|
value: function registerDesignAreaChangeListener(listenerFn) {
|
|
@@ -1418,7 +1211,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1418
1211
|
key: "getDesignAreaCanvases",
|
|
1419
1212
|
value: function getDesignAreaCanvases() {
|
|
1420
1213
|
var _this7 = this;
|
|
1421
|
-
|
|
1422
1214
|
return this.getDesignAreas().map(function (designArea) {
|
|
1423
1215
|
return {
|
|
1424
1216
|
designArea: designArea,
|
|
@@ -1431,13 +1223,11 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1431
1223
|
value: function removeAllDesignAreaPlaceholders(configuration) {
|
|
1432
1224
|
var state = _ServiceLocator.Services.store.state;
|
|
1433
1225
|
var updatedConfiguration = configuration;
|
|
1434
|
-
|
|
1435
1226
|
if (!isWidget(location.pathname)) {
|
|
1436
1227
|
var designAreas = (0, _get2["default"])(state, 'designArea.filteredDesignAreas', []);
|
|
1437
1228
|
designAreas.forEach(function (designArea) {
|
|
1438
1229
|
var _get = (0, _get2["default"])(updatedConfiguration, "designdata.".concat(designArea.identifier), {}),
|
|
1439
|
-
|
|
1440
|
-
|
|
1230
|
+
canvasData = _get.canvasData;
|
|
1441
1231
|
if (canvasData) {
|
|
1442
1232
|
var objects = canvasData.objects.filter(function (obj) {
|
|
1443
1233
|
if (!(0, _Selectors5.isPlaceholderObject)(obj)) {
|
|
@@ -1454,7 +1244,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1454
1244
|
}
|
|
1455
1245
|
});
|
|
1456
1246
|
}
|
|
1457
|
-
|
|
1458
1247
|
return updatedConfiguration;
|
|
1459
1248
|
}
|
|
1460
1249
|
}, {
|
|
@@ -1465,30 +1254,25 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1465
1254
|
var designArea = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
1466
1255
|
this.syncCanvasChange();
|
|
1467
1256
|
var state = _ServiceLocator.Services.store.state;
|
|
1468
|
-
|
|
1469
1257
|
if (!designArea.identifier) {
|
|
1470
1258
|
return;
|
|
1471
1259
|
}
|
|
1472
|
-
|
|
1473
1260
|
var _getDesignDataByDesig = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designArea.identifier),
|
|
1474
|
-
|
|
1475
|
-
|
|
1261
|
+
canvasData = _getDesignDataByDesig.canvasData;
|
|
1476
1262
|
if (!canvasData) {
|
|
1477
1263
|
return;
|
|
1478
1264
|
}
|
|
1479
|
-
|
|
1480
1265
|
var objects = canvasData.objects.filter(function (obj) {
|
|
1481
1266
|
if (removeTextPlaceholders && obj.type === 'Text') {
|
|
1482
1267
|
return !(0, _Selectors.isPlaceholderContent)(obj.content) && (0, _Selectors.contentHasText)(obj.content);
|
|
1483
1268
|
}
|
|
1484
|
-
|
|
1485
1269
|
if (removeImagePlaceholders && obj.type === 'Image') {
|
|
1486
1270
|
return !obj.imageData.isPlaceHolderImage;
|
|
1487
1271
|
}
|
|
1488
|
-
|
|
1489
1272
|
return true;
|
|
1490
|
-
});
|
|
1273
|
+
});
|
|
1491
1274
|
|
|
1275
|
+
// replace objects and sync canvas if something was removed
|
|
1492
1276
|
if (objects.length !== canvasData.objects.length) {
|
|
1493
1277
|
this.setCanvasData(_objectSpread(_objectSpread({}, canvasData), {}, {
|
|
1494
1278
|
objects: objects
|
|
@@ -1500,9 +1284,7 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1500
1284
|
key: "selectDesignArea",
|
|
1501
1285
|
value: function selectDesignArea(identifier) {
|
|
1502
1286
|
_ServiceLocator.Services.ui.show('designer');
|
|
1503
|
-
|
|
1504
1287
|
_ServiceLocator.Services.store.dispatch((0, _Actions3.selectDesignArea)(identifier));
|
|
1505
|
-
|
|
1506
1288
|
if (!this.isInPreviewMode) {
|
|
1507
1289
|
_ServiceLocator.Services.visualization.disableUserMovement();
|
|
1508
1290
|
}
|
|
@@ -1517,21 +1299,17 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1517
1299
|
value: function getInitialDesignViewIdentifier() {
|
|
1518
1300
|
var designAreaToShow;
|
|
1519
1301
|
var preselectedDesignArea = (0, _get2["default"])((0, _configuration.getConf)('designerPreSelection', {}), 'designAreas[0].identifier');
|
|
1520
|
-
|
|
1521
1302
|
if (preselectedDesignArea) {
|
|
1522
1303
|
designAreaToShow = this.getDesignAreaByIdentifier(preselectedDesignArea);
|
|
1523
1304
|
}
|
|
1524
|
-
|
|
1525
1305
|
if (!designAreaToShow) {
|
|
1526
1306
|
var state = _ServiceLocator.Services.store.state;
|
|
1527
1307
|
var designAreaIdentifier = (0, _Selectors.getSelectedDesignArea)(state).identifier || (0, _Selectors.getDefaultDesignAreaIdentifierFromProductionMethod)(state);
|
|
1528
1308
|
designAreaToShow = this.getDesignAreaByIdentifier(designAreaIdentifier) || (0, _first["default"])(state.designArea.filteredDesignAreas);
|
|
1529
1309
|
}
|
|
1530
|
-
|
|
1531
1310
|
if (designAreaToShow) {
|
|
1532
1311
|
return designAreaToShow.designView.identifier;
|
|
1533
1312
|
}
|
|
1534
|
-
|
|
1535
1313
|
return false;
|
|
1536
1314
|
}
|
|
1537
1315
|
}, {
|
|
@@ -1544,7 +1322,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1544
1322
|
key: "selectFirstDesignArea",
|
|
1545
1323
|
value: function selectFirstDesignArea() {
|
|
1546
1324
|
var firstDesignAreaIdentifier = (0, _get2["default"])(_ServiceLocator.Services.store.state, 'designArea.filteredDesignAreas[0].identifier');
|
|
1547
|
-
|
|
1548
1325
|
if (firstDesignAreaIdentifier) {
|
|
1549
1326
|
this.selectDesignArea(firstDesignAreaIdentifier);
|
|
1550
1327
|
} else {
|
|
@@ -1556,25 +1333,20 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1556
1333
|
key: "clearDesignAreaSelection",
|
|
1557
1334
|
value: function clearDesignAreaSelection() {
|
|
1558
1335
|
this.removeDesignAreaPlaceholders();
|
|
1559
|
-
var hasActiveDesignArea = !(0, _isEmpty["default"])(_ServiceLocator.Services.visualization.getActiveDesignArea());
|
|
1336
|
+
var hasActiveDesignArea = !(0, _isEmpty["default"])(_ServiceLocator.Services.visualization.getActiveDesignArea());
|
|
1337
|
+
// If default Design Area is set then the clear would skip as there will be no selected designArea
|
|
1560
1338
|
// So forcing clearDesignAreaSelection when there is ActiveDesignArea(Default).
|
|
1561
|
-
|
|
1562
1339
|
_ServiceLocator.Services.store.dispatch((0, _Actions3.clearDesignAreaSelection)(hasActiveDesignArea));
|
|
1563
|
-
|
|
1564
1340
|
_ServiceLocator.Services.visualization.enableUserMovement();
|
|
1565
|
-
|
|
1566
1341
|
_ServiceLocator.Services.visualization.freeUserMovement();
|
|
1567
1342
|
}
|
|
1568
1343
|
}, {
|
|
1569
1344
|
key: "openDesignAreaEditor",
|
|
1570
1345
|
value: function openDesignAreaEditor() {
|
|
1571
1346
|
var state = _ServiceLocator.Services.store.state;
|
|
1572
|
-
|
|
1573
1347
|
_ServiceLocator.Services.ui.show('designer');
|
|
1574
|
-
|
|
1575
1348
|
var designAreaIdentifier = (0, _Selectors.getDesignAreaIdentifierToOpen)(state);
|
|
1576
1349
|
this.clearDesignAreaSelection();
|
|
1577
|
-
|
|
1578
1350
|
if (designAreaIdentifier) {
|
|
1579
1351
|
this.selectDesignArea(designAreaIdentifier);
|
|
1580
1352
|
} else {
|
|
@@ -1586,277 +1358,219 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1586
1358
|
value: function closeDesignAreaEditor() {
|
|
1587
1359
|
if (_ServiceLocator.Services.ui.isVisible('designer')) {
|
|
1588
1360
|
_ServiceLocator.Services.ui.hide('designer');
|
|
1589
|
-
|
|
1590
1361
|
_ServiceLocator.Services.visualization.enableUserMovement();
|
|
1591
|
-
|
|
1592
1362
|
_ServiceLocator.Services.visualization.restrictUserMovement();
|
|
1363
|
+
_ServiceLocator.Services.designData.clearSelectionOnCurrentDesignArea();
|
|
1593
1364
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1365
|
+
// the canvases should be drawn on the textures to see the changes that were made in the editor
|
|
1597
1366
|
_ServiceLocator.Services.designData.updateVisualization();
|
|
1598
1367
|
}
|
|
1599
1368
|
}
|
|
1369
|
+
|
|
1600
1370
|
/**
|
|
1601
1371
|
* General close handler for design area editor, that calls the correct actions based on the state
|
|
1602
1372
|
* @return {boolean}
|
|
1603
1373
|
*/
|
|
1604
|
-
|
|
1605
1374
|
}, {
|
|
1606
1375
|
key: "handleCloseIfNeeded",
|
|
1607
1376
|
value: function handleCloseIfNeeded() {
|
|
1608
|
-
var state = _ServiceLocator.Services.store.state;
|
|
1609
|
-
// this lets the user see the visualization in the same view, but without the design area editor
|
|
1377
|
+
var state = _ServiceLocator.Services.store.state;
|
|
1610
1378
|
|
|
1379
|
+
// if it's 3D and the editor is open, then close it, so we can enter into the "closer look" mode
|
|
1380
|
+
// this lets the user see the visualization in the same view, but without the design area editor
|
|
1611
1381
|
if ((0, _Selectors3.visualizationModeCheck)(state).is3D() && _ServiceLocator.Services.ui.isVisible('designer')) {
|
|
1612
1382
|
_ServiceLocator.Services.designData.closeDesignAreaEditor();
|
|
1613
|
-
|
|
1614
1383
|
return true;
|
|
1615
|
-
}
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// in this case it's 2D, or the design area was already closed by the previous block
|
|
1616
1387
|
// so the second "click away" should clear the selection (which will trigger switching to default view)
|
|
1617
1388
|
// if a design area was selected, clear the selection
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
1389
|
if ((0, _Selectors.isAnyDesignAreaSelected)(state)) {
|
|
1621
1390
|
_ServiceLocator.Services.designData.clearDesignAreaSelection();
|
|
1622
|
-
|
|
1623
1391
|
return true;
|
|
1624
1392
|
}
|
|
1625
|
-
|
|
1626
1393
|
return false;
|
|
1627
1394
|
}
|
|
1628
1395
|
}, {
|
|
1629
1396
|
key: "vectorizeSingleImageAndShowEditDialog",
|
|
1630
1397
|
value: function () {
|
|
1631
|
-
var _vectorizeSingleImageAndShowEditDialog = _asyncToGenerator( /*#__PURE__*/
|
|
1398
|
+
var _vectorizeSingleImageAndShowEditDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(identifier) {
|
|
1632
1399
|
var showImageEditDialog, state, designArea, canvas, images, firstNonVectorizedImage, operations, imageData, imageToSelect;
|
|
1633
|
-
return
|
|
1634
|
-
while (1) {
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
imageToSelect.selected = true;
|
|
1697
|
-
_context15.next = 26;
|
|
1698
|
-
return _ServiceLocator.Services.designer.openImageEditDialog(firstNonVectorizedImage.imageData.identifier, canvas, {
|
|
1699
|
-
placeholderImageUpdate: false,
|
|
1700
|
-
submitOnExitClick: true
|
|
1701
|
-
});
|
|
1702
|
-
|
|
1703
|
-
case 26:
|
|
1704
|
-
_context15.prev = 26;
|
|
1705
|
-
|
|
1706
|
-
_ServiceLocator.Services.ui.hide('globalLoader');
|
|
1707
|
-
|
|
1708
|
-
return _context15.finish(26);
|
|
1709
|
-
|
|
1710
|
-
case 29:
|
|
1711
|
-
case "end":
|
|
1712
|
-
return _context15.stop();
|
|
1713
|
-
}
|
|
1400
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1401
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1402
|
+
case 0:
|
|
1403
|
+
_context16.next = 2;
|
|
1404
|
+
return this.handleDesignProductionMethodChangeFromNonVectorizationToVectorization(identifier);
|
|
1405
|
+
case 2:
|
|
1406
|
+
_context16.t0 = _context16.sent;
|
|
1407
|
+
if (_context16.t0) {
|
|
1408
|
+
_context16.next = 7;
|
|
1409
|
+
break;
|
|
1410
|
+
}
|
|
1411
|
+
_context16.next = 6;
|
|
1412
|
+
return this.handleDesignProductionMethodChangeToMandatoryVectorization(identifier);
|
|
1413
|
+
case 6:
|
|
1414
|
+
_context16.t0 = _context16.sent;
|
|
1415
|
+
case 7:
|
|
1416
|
+
showImageEditDialog = _context16.t0;
|
|
1417
|
+
if (!showImageEditDialog) {
|
|
1418
|
+
_context16.next = 29;
|
|
1419
|
+
break;
|
|
1420
|
+
}
|
|
1421
|
+
_ServiceLocator.Services.ui.show('globalLoader');
|
|
1422
|
+
state = _ServiceLocator.Services.store.state;
|
|
1423
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
1424
|
+
canvas = this._getCanvas(designArea);
|
|
1425
|
+
images = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier);
|
|
1426
|
+
firstNonVectorizedImage = images.find(function (obj) {
|
|
1427
|
+
return !(0, _get2["default"])(obj, 'imageData.gallery') && (!(0, _get2["default"])(obj, 'imageData.operations.vectorize') || !(0, _get2["default"])(obj, 'imageData.displayColorPreview'));
|
|
1428
|
+
});
|
|
1429
|
+
_context16.prev = 15;
|
|
1430
|
+
operations = _objectSpread(_objectSpread({}, firstNonVectorizedImage.imageData.operations), {}, {
|
|
1431
|
+
vectorize: true
|
|
1432
|
+
});
|
|
1433
|
+
imageData = firstNonVectorizedImage.imageData; //returing if placeHolderImage, from executing edit operations
|
|
1434
|
+
if (!imageData.isPlaceHolderImage) {
|
|
1435
|
+
_context16.next = 20;
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
return _context16.abrupt("return");
|
|
1439
|
+
case 20:
|
|
1440
|
+
_context16.next = 22;
|
|
1441
|
+
return _ServiceLocator.Services.designData.editFile(operations, imageData, {
|
|
1442
|
+
immediateCommit: true
|
|
1443
|
+
});
|
|
1444
|
+
case 22:
|
|
1445
|
+
imageToSelect = canvas.objects.filter(function (object) {
|
|
1446
|
+
return object.type === 'Image';
|
|
1447
|
+
}).find(function (obj) {
|
|
1448
|
+
return obj._imageData.identifier === imageData.identifier;
|
|
1449
|
+
});
|
|
1450
|
+
imageToSelect.selected = true;
|
|
1451
|
+
_context16.next = 26;
|
|
1452
|
+
return _ServiceLocator.Services.designer.openImageEditDialog(firstNonVectorizedImage.imageData.identifier, canvas, {
|
|
1453
|
+
placeholderImageUpdate: false,
|
|
1454
|
+
submitOnExitClick: true
|
|
1455
|
+
});
|
|
1456
|
+
case 26:
|
|
1457
|
+
_context16.prev = 26;
|
|
1458
|
+
_ServiceLocator.Services.ui.hide('globalLoader');
|
|
1459
|
+
return _context16.finish(26);
|
|
1460
|
+
case 29:
|
|
1461
|
+
case "end":
|
|
1462
|
+
return _context16.stop();
|
|
1714
1463
|
}
|
|
1715
|
-
},
|
|
1464
|
+
}, _callee16, this, [[15,, 26, 29]]);
|
|
1716
1465
|
}));
|
|
1717
|
-
|
|
1718
1466
|
function vectorizeSingleImageAndShowEditDialog(_x16) {
|
|
1719
1467
|
return _vectorizeSingleImageAndShowEditDialog.apply(this, arguments);
|
|
1720
1468
|
}
|
|
1721
|
-
|
|
1722
1469
|
return vectorizeSingleImageAndShowEditDialog;
|
|
1723
1470
|
}()
|
|
1724
1471
|
}, {
|
|
1725
1472
|
key: "restoreVectorizedImages",
|
|
1726
1473
|
value: function () {
|
|
1727
|
-
var _restoreVectorizedImages = _asyncToGenerator( /*#__PURE__*/
|
|
1474
|
+
var _restoreVectorizedImages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(identifier) {
|
|
1728
1475
|
var displayImagesAsUnVectorized, state, designArea, images, _iterator8, _step8, image, operations;
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
displayImagesAsUnVectorized = _context16.sent;
|
|
1739
|
-
|
|
1740
|
-
if (!displayImagesAsUnVectorized) {
|
|
1741
|
-
_context16.next = 28;
|
|
1742
|
-
break;
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
state = _ServiceLocator.Services.store.state;
|
|
1746
|
-
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
1747
|
-
images = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier);
|
|
1748
|
-
images = images.filter(function (img) {
|
|
1749
|
-
return !(0, _get2["default"])(img, 'imageData.isPlaceHolderImage', false);
|
|
1750
|
-
}); //excluding placeHolderImage from executing edit operations
|
|
1751
|
-
|
|
1752
|
-
_iterator8 = _createForOfIteratorHelper(images);
|
|
1753
|
-
_context16.prev = 9;
|
|
1754
|
-
|
|
1755
|
-
_iterator8.s();
|
|
1756
|
-
|
|
1757
|
-
case 11:
|
|
1758
|
-
if ((_step8 = _iterator8.n()).done) {
|
|
1759
|
-
_context16.next = 18;
|
|
1760
|
-
break;
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
image = _step8.value;
|
|
1764
|
-
operations = (0, _Modifiers.removeVectorizeFromOperations)(image.imageData.operations);
|
|
1765
|
-
_context16.next = 16;
|
|
1766
|
-
return _ServiceLocator.Services.designData.editFile(operations, image.imageData, {
|
|
1767
|
-
immediateCommit: true,
|
|
1768
|
-
displayColorPreview: (0, _configuration.getConf)('autoPreviewVectorization', true)
|
|
1769
|
-
});
|
|
1770
|
-
|
|
1771
|
-
case 16:
|
|
1772
|
-
_context16.next = 11;
|
|
1476
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1477
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1478
|
+
case 0:
|
|
1479
|
+
_context17.next = 2;
|
|
1480
|
+
return this.handleDesignProductionMethodChangeFromVectorizationToNonVectorization(identifier);
|
|
1481
|
+
case 2:
|
|
1482
|
+
displayImagesAsUnVectorized = _context17.sent;
|
|
1483
|
+
if (!displayImagesAsUnVectorized) {
|
|
1484
|
+
_context17.next = 28;
|
|
1773
1485
|
break;
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1486
|
+
}
|
|
1487
|
+
state = _ServiceLocator.Services.store.state;
|
|
1488
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
1489
|
+
images = (0, _Selectors.getImagesByDesignArea)(state, designArea.identifier);
|
|
1490
|
+
images = images.filter(function (img) {
|
|
1491
|
+
return !(0, _get2["default"])(img, 'imageData.isPlaceHolderImage', false);
|
|
1492
|
+
}); //excluding placeHolderImage from executing edit operations
|
|
1493
|
+
_iterator8 = _createForOfIteratorHelper(images);
|
|
1494
|
+
_context17.prev = 9;
|
|
1495
|
+
_iterator8.s();
|
|
1496
|
+
case 11:
|
|
1497
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
1498
|
+
_context17.next = 18;
|
|
1777
1499
|
break;
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1500
|
+
}
|
|
1501
|
+
image = _step8.value;
|
|
1502
|
+
operations = (0, _Modifiers.removeVectorizeFromOperations)(image.imageData.operations);
|
|
1503
|
+
_context17.next = 16;
|
|
1504
|
+
return _ServiceLocator.Services.designData.editFile(operations, image.imageData, {
|
|
1505
|
+
immediateCommit: true,
|
|
1506
|
+
displayColorPreview: (0, _configuration.getConf)('autoPreviewVectorization', true)
|
|
1507
|
+
});
|
|
1508
|
+
case 16:
|
|
1509
|
+
_context17.next = 11;
|
|
1510
|
+
break;
|
|
1511
|
+
case 18:
|
|
1512
|
+
_context17.next = 23;
|
|
1513
|
+
break;
|
|
1514
|
+
case 20:
|
|
1515
|
+
_context17.prev = 20;
|
|
1516
|
+
_context17.t0 = _context17["catch"](9);
|
|
1517
|
+
_iterator8.e(_context17.t0);
|
|
1518
|
+
case 23:
|
|
1519
|
+
_context17.prev = 23;
|
|
1520
|
+
_iterator8.f();
|
|
1521
|
+
return _context17.finish(23);
|
|
1522
|
+
case 26:
|
|
1523
|
+
_context17.next = 28;
|
|
1524
|
+
return this.loadCanvasDataFromState([designArea]);
|
|
1525
|
+
case 28:
|
|
1526
|
+
case "end":
|
|
1527
|
+
return _context17.stop();
|
|
1800
1528
|
}
|
|
1801
|
-
},
|
|
1529
|
+
}, _callee17, this, [[9, 20, 23, 26]]);
|
|
1802
1530
|
}));
|
|
1803
|
-
|
|
1804
1531
|
function restoreVectorizedImages(_x17) {
|
|
1805
1532
|
return _restoreVectorizedImages.apply(this, arguments);
|
|
1806
1533
|
}
|
|
1807
|
-
|
|
1808
1534
|
return restoreVectorizedImages;
|
|
1809
1535
|
}()
|
|
1810
1536
|
}, {
|
|
1811
1537
|
key: "updateObjectsAfterProductionMethodChange",
|
|
1812
1538
|
value: function () {
|
|
1813
|
-
var _updateObjectsAfterProductionMethodChange = _asyncToGenerator( /*#__PURE__*/
|
|
1539
|
+
var _updateObjectsAfterProductionMethodChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(oldProductionMethod, newProductionMethod) {
|
|
1814
1540
|
var _getDesignDataForSele2, canvasData, objects, newObjects, designArea;
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
objects: newObjects
|
|
1843
|
-
}));
|
|
1844
|
-
designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
1845
|
-
_context17.next = 11;
|
|
1846
|
-
return this.updateCanvasDataFromState([designArea]);
|
|
1847
|
-
|
|
1848
|
-
case 11:
|
|
1849
|
-
case "end":
|
|
1850
|
-
return _context17.stop();
|
|
1851
|
-
}
|
|
1541
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1542
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1543
|
+
case 0:
|
|
1544
|
+
_getDesignDataForSele2 = (0, _Selectors.getDesignDataForSelectedDesignArea)(_ServiceLocator.Services.store.state), canvasData = _getDesignDataForSele2.canvasData;
|
|
1545
|
+
if (canvasData) {
|
|
1546
|
+
_context18.next = 3;
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
return _context18.abrupt("return");
|
|
1550
|
+
case 3:
|
|
1551
|
+
objects = canvasData.objects;
|
|
1552
|
+
newObjects = (0, _Modifiers.applyProductionMethodChangeToCanvasObjects)(newProductionMethod, oldProductionMethod, objects);
|
|
1553
|
+
if (!(newObjects === objects)) {
|
|
1554
|
+
_context18.next = 7;
|
|
1555
|
+
break;
|
|
1556
|
+
}
|
|
1557
|
+
return _context18.abrupt("return");
|
|
1558
|
+
case 7:
|
|
1559
|
+
this.setCanvasData(_objectSpread(_objectSpread({}, canvasData), {}, {
|
|
1560
|
+
objects: newObjects
|
|
1561
|
+
}));
|
|
1562
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
1563
|
+
_context18.next = 11;
|
|
1564
|
+
return this.updateCanvasDataFromState([designArea]);
|
|
1565
|
+
case 11:
|
|
1566
|
+
case "end":
|
|
1567
|
+
return _context18.stop();
|
|
1852
1568
|
}
|
|
1853
|
-
},
|
|
1569
|
+
}, _callee18, this);
|
|
1854
1570
|
}));
|
|
1855
|
-
|
|
1856
1571
|
function updateObjectsAfterProductionMethodChange(_x18, _x19) {
|
|
1857
1572
|
return _updateObjectsAfterProductionMethodChange.apply(this, arguments);
|
|
1858
1573
|
}
|
|
1859
|
-
|
|
1860
1574
|
return updateObjectsAfterProductionMethodChange;
|
|
1861
1575
|
}()
|
|
1862
1576
|
}, {
|
|
@@ -1866,169 +1580,138 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
1866
1580
|
var designData = (0, _Selectors.getDesignDataForSelectedDesignArea)(state);
|
|
1867
1581
|
var designProductionMethod = (0, _Selectors.getDesignProductionMethodByIdentifier)(state, targetDesignProductionMethodIdentifier);
|
|
1868
1582
|
var result = (0, _DesignElementSelectors.checkDesignElementRestrictionsWithRemovalCount)(designData, designProductionMethod);
|
|
1869
|
-
|
|
1870
1583
|
if (result) {
|
|
1871
1584
|
_ServiceLocator.Services.ui.reportError((0, _i18n.t)("designElementRestrictions.productionMethodSwitchMessages.".concat(result.type).concat(result.max === 0 ? '_0' : result.toBeRemovedCount === 1 ? '_1' : ''), result));
|
|
1872
|
-
|
|
1873
1585
|
return false;
|
|
1874
1586
|
}
|
|
1875
|
-
|
|
1876
1587
|
return true;
|
|
1877
1588
|
}
|
|
1878
1589
|
}, {
|
|
1879
1590
|
key: "setDesignProductionMethod",
|
|
1880
1591
|
value: function () {
|
|
1881
|
-
var _setDesignProductionMethod2 = _asyncToGenerator( /*#__PURE__*/
|
|
1592
|
+
var _setDesignProductionMethod2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identifier) {
|
|
1882
1593
|
var state, designData, selectedDesignProduction, bulkNameSelected, fontSizeMin, smallestFontSize, oldDesignProductionMethod;
|
|
1883
|
-
return
|
|
1884
|
-
while (1) {
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
_context18.next = 2;
|
|
1889
|
-
break;
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
return _context18.abrupt("return");
|
|
1893
|
-
|
|
1894
|
-
case 2:
|
|
1895
|
-
this.clearSelectionOnCurrentDesignArea(); // check if the selected design production method has a higher minimum font size
|
|
1896
|
-
// than any of the text elements on the canvas
|
|
1897
|
-
|
|
1898
|
-
state = _ServiceLocator.Services.store.state;
|
|
1899
|
-
designData = (0, _Selectors.getDesignDataForSelectedDesignArea)(state);
|
|
1900
|
-
selectedDesignProduction = (0, _Selectors.getDesignProductionMethodByIdentifier)(state, identifier);
|
|
1901
|
-
bulkNameSelected = (0, _Selectors.hasSelectedBulkName)(designData);
|
|
1902
|
-
|
|
1903
|
-
if (isWidget(location.pathname)) {
|
|
1904
|
-
_context18.next = 44;
|
|
1905
|
-
break;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
fontSizeMin = (0, _Selectors.getFontSizeMin)(state, identifier);
|
|
1909
|
-
smallestFontSize = (0, _Selectors.findSmallestFontSizeInCanvasData)(designData.canvasData);
|
|
1910
|
-
_context18.prev = 10;
|
|
1911
|
-
_context18.t0 = smallestFontSize < fontSizeMin;
|
|
1912
|
-
|
|
1913
|
-
if (!_context18.t0) {
|
|
1914
|
-
_context18.next = 15;
|
|
1915
|
-
break;
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
_context18.next = 15;
|
|
1919
|
-
return _ServiceLocator.Services.store.dispatch((0, _Actions.showMinFontSizeConfirm)(fontSizeMin));
|
|
1920
|
-
|
|
1921
|
-
case 15:
|
|
1922
|
-
_context18.next = 20;
|
|
1594
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1595
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1596
|
+
case 0:
|
|
1597
|
+
if (this.checkDesignElementRestrictions(identifier)) {
|
|
1598
|
+
_context19.next = 2;
|
|
1923
1599
|
break;
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
_context18.next = 25;
|
|
1937
|
-
return this.vectorizeSingleImageAndShowEditDialog(identifier);
|
|
1938
|
-
|
|
1939
|
-
case 25:
|
|
1940
|
-
_context18.next = 27;
|
|
1941
|
-
return this.restoreVectorizedImages(identifier);
|
|
1942
|
-
|
|
1943
|
-
case 27:
|
|
1944
|
-
_context18.next = 34;
|
|
1600
|
+
}
|
|
1601
|
+
return _context19.abrupt("return");
|
|
1602
|
+
case 2:
|
|
1603
|
+
this.clearSelectionOnCurrentDesignArea();
|
|
1604
|
+
// check if the selected design production method has a higher minimum font size
|
|
1605
|
+
// than any of the text elements on the canvas
|
|
1606
|
+
state = _ServiceLocator.Services.store.state;
|
|
1607
|
+
designData = (0, _Selectors.getDesignDataForSelectedDesignArea)(state);
|
|
1608
|
+
selectedDesignProduction = (0, _Selectors.getDesignProductionMethodByIdentifier)(state, identifier);
|
|
1609
|
+
bulkNameSelected = (0, _Selectors.hasSelectedBulkName)(designData);
|
|
1610
|
+
if (isWidget(location.pathname)) {
|
|
1611
|
+
_context19.next = 44;
|
|
1945
1612
|
break;
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
break;
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
return _context18.abrupt("return");
|
|
1957
|
-
|
|
1958
|
-
case 33:
|
|
1959
|
-
throw _context18.t2;
|
|
1960
|
-
|
|
1961
|
-
case 34:
|
|
1962
|
-
_context18.prev = 34;
|
|
1963
|
-
_context18.t3 = bulkNameSelected && !selectedDesignProduction.allowBulkNames;
|
|
1964
|
-
|
|
1965
|
-
if (!_context18.t3) {
|
|
1966
|
-
_context18.next = 39;
|
|
1967
|
-
break;
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
_context18.next = 39;
|
|
1971
|
-
return _ServiceLocator.Services.store.dispatch((0, _Actions.showProductionMethodChangeConfirm)());
|
|
1972
|
-
|
|
1973
|
-
case 39:
|
|
1974
|
-
_context18.next = 44;
|
|
1613
|
+
}
|
|
1614
|
+
fontSizeMin = (0, _Selectors.getFontSizeMin)(state, identifier);
|
|
1615
|
+
smallestFontSize = (0, _Selectors.findSmallestFontSizeInCanvasData)(designData.canvasData);
|
|
1616
|
+
_context19.prev = 10;
|
|
1617
|
+
_context19.t0 = smallestFontSize < fontSizeMin;
|
|
1618
|
+
if (!_context19.t0) {
|
|
1619
|
+
_context19.next = 15;
|
|
1975
1620
|
break;
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1621
|
+
}
|
|
1622
|
+
_context19.next = 15;
|
|
1623
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showMinFontSizeConfirm)(fontSizeMin));
|
|
1624
|
+
case 15:
|
|
1625
|
+
_context19.next = 20;
|
|
1626
|
+
break;
|
|
1627
|
+
case 17:
|
|
1628
|
+
_context19.prev = 17;
|
|
1629
|
+
_context19.t1 = _context19["catch"](10);
|
|
1630
|
+
return _context19.abrupt("return");
|
|
1631
|
+
case 20:
|
|
1632
|
+
_context19.prev = 20;
|
|
1633
|
+
_context19.next = 23;
|
|
1634
|
+
return this.checkColorUsageForDesignProductionMethod(identifier);
|
|
1635
|
+
case 23:
|
|
1636
|
+
_context19.next = 25;
|
|
1637
|
+
return this.vectorizeSingleImageAndShowEditDialog(identifier);
|
|
1638
|
+
case 25:
|
|
1639
|
+
_context19.next = 27;
|
|
1640
|
+
return this.restoreVectorizedImages(identifier);
|
|
1641
|
+
case 27:
|
|
1642
|
+
_context19.next = 34;
|
|
1643
|
+
break;
|
|
1644
|
+
case 29:
|
|
1645
|
+
_context19.prev = 29;
|
|
1646
|
+
_context19.t2 = _context19["catch"](20);
|
|
1647
|
+
if (!(0, _Actions5.isConfirmResult)(_context19.t2)) {
|
|
1648
|
+
_context19.next = 33;
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
return _context19.abrupt("return");
|
|
1652
|
+
case 33:
|
|
1653
|
+
throw _context19.t2;
|
|
1654
|
+
case 34:
|
|
1655
|
+
_context19.prev = 34;
|
|
1656
|
+
_context19.t3 = bulkNameSelected && !selectedDesignProduction.allowBulkNames;
|
|
1657
|
+
if (!_context19.t3) {
|
|
1658
|
+
_context19.next = 39;
|
|
1659
|
+
break;
|
|
1660
|
+
}
|
|
1661
|
+
_context19.next = 39;
|
|
1662
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showProductionMethodChangeConfirm)());
|
|
1663
|
+
case 39:
|
|
1664
|
+
_context19.next = 44;
|
|
1665
|
+
break;
|
|
1666
|
+
case 41:
|
|
1667
|
+
_context19.prev = 41;
|
|
1668
|
+
_context19.t4 = _context19["catch"](34);
|
|
1669
|
+
return _context19.abrupt("return");
|
|
1670
|
+
case 44:
|
|
1671
|
+
oldDesignProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(state);
|
|
1672
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions.setDesignProductionMethod)(identifier));
|
|
1673
|
+
if ((0, _Selectors.isCanvasUpdateRequired)((0, _Selectors.getSelectedDesignArea)(state), selectedDesignProduction)) {
|
|
1674
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions3.recalculateDesignArea)());
|
|
1675
|
+
}
|
|
1676
|
+
this.updateCanvasToCurrentDesignProductionMethod();
|
|
1677
|
+
if (bulkNameSelected && !selectedDesignProduction.allowBulkNames) {
|
|
1678
|
+
this.removeBulkNameItems(designData);
|
|
1679
|
+
!(0, _Selectors.isBulkNamesSelected)(_ServiceLocator.Services.store.state.configurator) && _ServiceLocator.Services.configurator.clearBulkNames();
|
|
1680
|
+
}
|
|
1681
|
+
_context19.next = 51;
|
|
1682
|
+
return this.updateObjectsAfterProductionMethodChange(oldDesignProductionMethod, selectedDesignProduction);
|
|
1683
|
+
case 51:
|
|
1684
|
+
case "end":
|
|
1685
|
+
return _context19.stop();
|
|
2005
1686
|
}
|
|
2006
|
-
},
|
|
1687
|
+
}, _callee19, this, [[10, 17], [20, 29], [34, 41]]);
|
|
2007
1688
|
}));
|
|
2008
|
-
|
|
2009
1689
|
function setDesignProductionMethod(_x20) {
|
|
2010
1690
|
return _setDesignProductionMethod2.apply(this, arguments);
|
|
2011
1691
|
}
|
|
2012
|
-
|
|
2013
1692
|
return setDesignProductionMethod;
|
|
2014
1693
|
}()
|
|
2015
1694
|
}, {
|
|
2016
|
-
key: "
|
|
2017
|
-
value: function
|
|
1695
|
+
key: "updateCanvasToCurrentDesignProductionMethod",
|
|
1696
|
+
value: function updateCanvasToCurrentDesignProductionMethod() {
|
|
2018
1697
|
// the mask should be updated when switching design production method
|
|
2019
1698
|
var state = _ServiceLocator.Services.store.state;
|
|
2020
1699
|
var designArea = (0, _Selectors.getSelectedDesignArea)(state);
|
|
2021
|
-
|
|
2022
1700
|
var canvas = this._getCanvas(designArea);
|
|
2023
|
-
|
|
2024
1701
|
var maskHandler = canvas.getMaskHandler();
|
|
2025
1702
|
var maskData = (0, _Selectors.getMaskDataForDesignArea)(state, designArea);
|
|
2026
|
-
|
|
2027
1703
|
if (maskData) {
|
|
2028
1704
|
maskHandler.init(maskData);
|
|
2029
1705
|
} else {
|
|
2030
1706
|
maskHandler && maskHandler.dispose();
|
|
2031
1707
|
}
|
|
1708
|
+
var colorOverlayData = (0, _Selectors.getColorOverlayData)(state, designArea);
|
|
1709
|
+
var colorOverlay = canvas.getColorOverlay();
|
|
1710
|
+
if (colorOverlayData !== null && colorOverlayData !== void 0 && colorOverlayData.color) {
|
|
1711
|
+
colorOverlay === null || colorOverlay === void 0 || colorOverlay.init(colorOverlayData);
|
|
1712
|
+
} else {
|
|
1713
|
+
colorOverlay === null || colorOverlay === void 0 || colorOverlay.dispose();
|
|
1714
|
+
}
|
|
2032
1715
|
}
|
|
2033
1716
|
}, {
|
|
2034
1717
|
key: "setCanvasData",
|
|
@@ -2038,52 +1721,42 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2038
1721
|
}, {
|
|
2039
1722
|
key: "setColorAmount",
|
|
2040
1723
|
value: function () {
|
|
2041
|
-
var _setColorAmount2 = _asyncToGenerator( /*#__PURE__*/
|
|
1724
|
+
var _setColorAmount2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(maxColorCount) {
|
|
2042
1725
|
var currentColorCount, colorCount;
|
|
2043
|
-
return
|
|
2044
|
-
while (1) {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
if (!(maxColorCount && colorCount > maxColorCount && !isWidget(location.pathname) && (0, _configuration.getConf)('displayColorAmountWarnings', true))) {
|
|
2055
|
-
_context19.next = 11;
|
|
2056
|
-
break;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
_context19.prev = 3;
|
|
2060
|
-
_context19.next = 6;
|
|
2061
|
-
return _ServiceLocator.Services.store.dispatch((0, _Actions.showMaxColorChangeConfirm)(colorCount, maxColorCount, currentColorCount));
|
|
2062
|
-
|
|
2063
|
-
case 6:
|
|
2064
|
-
_context19.next = 11;
|
|
1726
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1727
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1728
|
+
case 0:
|
|
1729
|
+
// check the current color usage before applying the selected color count
|
|
1730
|
+
// so if the color count is more than the selected maxColorCount the user can decide to
|
|
1731
|
+
// 1. proceed with the new value
|
|
1732
|
+
// 2. leave the current value (skip applying the newly selected one)
|
|
1733
|
+
currentColorCount = (0, _Selectors.getSelectedDesignAreaProperties)(_ServiceLocator.Services.store.state).colorAmount;
|
|
1734
|
+
colorCount = (0, _Selectors.getColors)(_ServiceLocator.Services.store.state).length;
|
|
1735
|
+
if (!(maxColorCount && colorCount > maxColorCount && !isWidget(location.pathname) && (0, _configuration.getConf)('displayColorAmountWarnings', true))) {
|
|
1736
|
+
_context20.next = 11;
|
|
2065
1737
|
break;
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
1738
|
+
}
|
|
1739
|
+
_context20.prev = 3;
|
|
1740
|
+
_context20.next = 6;
|
|
1741
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions.showMaxColorChangeConfirm)(colorCount, maxColorCount, currentColorCount));
|
|
1742
|
+
case 6:
|
|
1743
|
+
_context20.next = 11;
|
|
1744
|
+
break;
|
|
1745
|
+
case 8:
|
|
1746
|
+
_context20.prev = 8;
|
|
1747
|
+
_context20.t0 = _context20["catch"](3);
|
|
1748
|
+
return _context20.abrupt("return");
|
|
1749
|
+
case 11:
|
|
1750
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions.setColorAmount)(maxColorCount));
|
|
1751
|
+
case 12:
|
|
1752
|
+
case "end":
|
|
1753
|
+
return _context20.stop();
|
|
2079
1754
|
}
|
|
2080
|
-
},
|
|
1755
|
+
}, _callee20, null, [[3, 8]]);
|
|
2081
1756
|
}));
|
|
2082
|
-
|
|
2083
1757
|
function setColorAmount(_x21) {
|
|
2084
1758
|
return _setColorAmount2.apply(this, arguments);
|
|
2085
1759
|
}
|
|
2086
|
-
|
|
2087
1760
|
return setColorAmount;
|
|
2088
1761
|
}()
|
|
2089
1762
|
/**
|
|
@@ -2091,63 +1764,51 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2091
1764
|
* That calls back to the provided drawingFunction with the getDrawingContext at the first argument.
|
|
2092
1765
|
*
|
|
2093
1766
|
*/
|
|
2094
|
-
|
|
2095
1767
|
}, {
|
|
2096
1768
|
key: "updateVisualization",
|
|
2097
1769
|
value: function () {
|
|
2098
|
-
var _updateVisualization = _asyncToGenerator( /*#__PURE__*/
|
|
1770
|
+
var _updateVisualization = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2099
1771
|
var updateEventObject,
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
return
|
|
2106
|
-
while (1) {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
return _ServiceLocator.Services.visualization.updateTexture({
|
|
2135
|
-
updateEventObject: updateEventObject,
|
|
2136
|
-
drawingFunction: drawingFunction.bind(this)
|
|
2137
|
-
});
|
|
2138
|
-
|
|
2139
|
-
case 12:
|
|
2140
|
-
case "end":
|
|
2141
|
-
return _context20.stop();
|
|
2142
|
-
}
|
|
1772
|
+
isDesignAreaSelected,
|
|
1773
|
+
isDesignerOpen,
|
|
1774
|
+
isScreenshotEvent,
|
|
1775
|
+
drawingFunction,
|
|
1776
|
+
_args21 = arguments;
|
|
1777
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1778
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1779
|
+
case 0:
|
|
1780
|
+
updateEventObject = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
|
|
1781
|
+
if (_ServiceLocator.Services.visualization.isReadyToRender()) {
|
|
1782
|
+
_context21.next = 3;
|
|
1783
|
+
break;
|
|
1784
|
+
}
|
|
1785
|
+
return _context21.abrupt("return");
|
|
1786
|
+
case 3:
|
|
1787
|
+
if (_ServiceLocator.Services.visualization.isReadyToRenderCustomDesign()) {
|
|
1788
|
+
_context21.next = 6;
|
|
1789
|
+
break;
|
|
1790
|
+
}
|
|
1791
|
+
_ServiceLocator.Services.visualization.render();
|
|
1792
|
+
return _context21.abrupt("return");
|
|
1793
|
+
case 6:
|
|
1794
|
+
isDesignAreaSelected = !!(0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state).identifier;
|
|
1795
|
+
isDesignerOpen = isDesignAreaSelected && _ServiceLocator.Services.ui.isVisible('designer');
|
|
1796
|
+
isScreenshotEvent = (0, _get2["default"])(updateEventObject, 'data.screenshot');
|
|
1797
|
+
drawingFunction = isDesignerOpen && !isScreenshotEvent && !this.isInPreviewMode ? this.redrawEmptyAreas : this.redrawAllDesignAreas;
|
|
1798
|
+
_context21.next = 12;
|
|
1799
|
+
return _ServiceLocator.Services.visualization.updateTexture({
|
|
1800
|
+
updateEventObject: updateEventObject,
|
|
1801
|
+
drawingFunction: drawingFunction.bind(this)
|
|
1802
|
+
});
|
|
1803
|
+
case 12:
|
|
1804
|
+
case "end":
|
|
1805
|
+
return _context21.stop();
|
|
2143
1806
|
}
|
|
2144
|
-
},
|
|
1807
|
+
}, _callee21, this);
|
|
2145
1808
|
}));
|
|
2146
|
-
|
|
2147
1809
|
function updateVisualization() {
|
|
2148
1810
|
return _updateVisualization.apply(this, arguments);
|
|
2149
1811
|
}
|
|
2150
|
-
|
|
2151
1812
|
return updateVisualization;
|
|
2152
1813
|
}()
|
|
2153
1814
|
}, {
|
|
@@ -2155,247 +1816,193 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2155
1816
|
value: function getFontSizeMin() {
|
|
2156
1817
|
return (0, _Selectors.getFontSizeMin)(_ServiceLocator.Services.store.state);
|
|
2157
1818
|
}
|
|
1819
|
+
|
|
2158
1820
|
/**
|
|
2159
1821
|
* Gets the drawing context and draws all design areas (that has existing canvas) on the texture.
|
|
2160
1822
|
* It also handles the highlighting of the design areas.
|
|
2161
1823
|
* @param {function} getDrawingContext
|
|
2162
1824
|
* @param {object} updateEventObject
|
|
2163
1825
|
*/
|
|
2164
|
-
|
|
2165
1826
|
}, {
|
|
2166
1827
|
key: "redrawAllDesignAreas",
|
|
2167
1828
|
value: function () {
|
|
2168
|
-
var _redrawAllDesignAreas = _asyncToGenerator( /*#__PURE__*/
|
|
1829
|
+
var _redrawAllDesignAreas = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(getDrawingContext, updateEventObject) {
|
|
2169
1830
|
var _this8 = this;
|
|
2170
|
-
|
|
2171
1831
|
var state, showHighlight, textureBuilderConfig, variantIdentifier, effectEnabled, drawingFn;
|
|
2172
|
-
return
|
|
2173
|
-
while (1) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
return
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
return regeneratorRuntime.wrap(function _loop$(_context21) {
|
|
2231
|
-
while (1) {
|
|
2232
|
-
switch (_context21.prev = _context21.next) {
|
|
2233
|
-
case 0:
|
|
2234
|
-
designArea = _step9.value;
|
|
2235
|
-
canvas = _this8._getCanvas(_this8.getDesignAreaByIdentifier(designArea.identifier));
|
|
2236
|
-
|
|
2237
|
-
if (!canvas) {
|
|
2238
|
-
_context21.next = 16;
|
|
2239
|
-
break;
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
_context21.next = 5;
|
|
2243
|
-
return (0, _ObjectLock.requestLock)(canvas);
|
|
2244
|
-
|
|
2245
|
-
case 5:
|
|
2246
|
-
releaseLock = _context21.sent;
|
|
2247
|
-
selectedObject = (0, _get2["default"])(canvas, 'selectedObject');
|
|
2248
|
-
|
|
2249
|
-
if (selectedObject) {
|
|
2250
|
-
selectedObject.selected = false;
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
maskHandler = canvas.getMaskHandler();
|
|
2254
|
-
|
|
2255
|
-
if (maskHandler) {
|
|
2256
|
-
restoreOutlineVisibility = maskHandler.toggleOutline(showHighlight, {
|
|
2257
|
-
getZoomFactor: function getZoomFactor(_ref20) {
|
|
2258
|
-
var zoom = _ref20.zoom;
|
|
2259
|
-
// currentZoom is only available for 2D, for 3D it is always 1
|
|
2260
|
-
var threeFactor = Math.min(getParams().currentZoom, 1) || 1;
|
|
2261
|
-
return zoom * threeFactor;
|
|
2262
|
-
}
|
|
2263
|
-
});
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
drawToContext = canvas.drawToContext.bind(canvas);
|
|
2267
|
-
|
|
2268
|
-
getSvg = function getSvg() {
|
|
2269
|
-
return canvas.getScreenshot((0, _Selectors4.getFontMapping)(state));
|
|
2270
|
-
};
|
|
2271
|
-
|
|
2272
|
-
_context21.next = 14;
|
|
2273
|
-
return drawCanvasToArea(_objectSpread({
|
|
2274
|
-
drawToContext: drawToContext,
|
|
2275
|
-
designArea: designArea,
|
|
2276
|
-
getSvg: getSvg
|
|
2277
|
-
}, effectEnabled && (0, _Selectors.getVisualizationEffectWithOptions)(state, designArea, variantIdentifier)));
|
|
2278
|
-
|
|
2279
|
-
case 14:
|
|
2280
|
-
if (maskHandler) {
|
|
2281
|
-
restoreOutlineVisibility();
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
releaseLock();
|
|
2285
|
-
|
|
2286
|
-
case 16:
|
|
2287
|
-
case "end":
|
|
2288
|
-
return _context21.stop();
|
|
2289
|
-
}
|
|
1832
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context24) {
|
|
1833
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1834
|
+
case 0:
|
|
1835
|
+
state = _ServiceLocator.Services.store.state;
|
|
1836
|
+
showHighlight = (0, _get2["default"])(state, 'designArea.showHighlight');
|
|
1837
|
+
textureBuilderConfig = {
|
|
1838
|
+
highlight: {
|
|
1839
|
+
borderColor: (0, _Selectors3.getClientHighlightColor)(state),
|
|
1840
|
+
backgroundColor: (0, _configuration.getConf)('visualization.designAreaHighlightBackgroundColor')
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
variantIdentifier = (0, _get2["default"])(updateEventObject, 'data.variant', false);
|
|
1844
|
+
effectEnabled = !(0, _Selectors3.isDesignerProductPreviewMode)();
|
|
1845
|
+
drawingFn = /*#__PURE__*/function () {
|
|
1846
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(textureCtx, getTextureBuilder) {
|
|
1847
|
+
var designAreas,
|
|
1848
|
+
_getTextureBuilder,
|
|
1849
|
+
getTextureImage,
|
|
1850
|
+
drawCanvasToArea,
|
|
1851
|
+
highlightDesignAreas,
|
|
1852
|
+
drawOn,
|
|
1853
|
+
getParams,
|
|
1854
|
+
_iterator9,
|
|
1855
|
+
_step9,
|
|
1856
|
+
_loop,
|
|
1857
|
+
_args23 = arguments;
|
|
1858
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context23) {
|
|
1859
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1860
|
+
case 0:
|
|
1861
|
+
designAreas = _args23.length > 2 && _args23[2] !== undefined ? _args23[2] : _this8.getDesignAreas();
|
|
1862
|
+
_getTextureBuilder = getTextureBuilder(textureBuilderConfig), getTextureImage = _getTextureBuilder.getTextureImage, drawCanvasToArea = _getTextureBuilder.drawCanvasToArea, highlightDesignAreas = _getTextureBuilder.highlightDesignAreas, drawOn = _getTextureBuilder.drawOn, getParams = _getTextureBuilder.getParams;
|
|
1863
|
+
if (getTextureImage()) {
|
|
1864
|
+
_context23.next = 5;
|
|
1865
|
+
break;
|
|
1866
|
+
}
|
|
1867
|
+
// eslint-disable-next-line no-console
|
|
1868
|
+
console.warn('Texture image is missing!', designAreas);
|
|
1869
|
+
return _context23.abrupt("return");
|
|
1870
|
+
case 5:
|
|
1871
|
+
if (showHighlight) {
|
|
1872
|
+
// highlight only the design areas with no mask
|
|
1873
|
+
// for the others the outline is added by the maskHandler
|
|
1874
|
+
highlightDesignAreas(designAreas.filter(function (designArea) {
|
|
1875
|
+
return !(0, _Selectors.designAreaAppliesMask)(state, designArea);
|
|
1876
|
+
}));
|
|
1877
|
+
}
|
|
1878
|
+
_iterator9 = _createForOfIteratorHelper(designAreas);
|
|
1879
|
+
_context23.prev = 7;
|
|
1880
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
1881
|
+
var designArea, canvas, _canvas$getColorOverl, releaseLock, selectedObject, maskHandler, restoreOutlineVisibility, restoreColorOverlayVisibility, drawToContext, getSvg;
|
|
1882
|
+
return _regeneratorRuntime().wrap(function _loop$(_context22) {
|
|
1883
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1884
|
+
case 0:
|
|
1885
|
+
designArea = _step9.value;
|
|
1886
|
+
canvas = _this8._getCanvas(_this8.getDesignAreaByIdentifier(designArea.identifier));
|
|
1887
|
+
if (!canvas) {
|
|
1888
|
+
_context22.next = 18;
|
|
1889
|
+
break;
|
|
2290
1890
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
1891
|
+
_context22.next = 5;
|
|
1892
|
+
return (0, _ObjectLock.requestLock)(canvas);
|
|
1893
|
+
case 5:
|
|
1894
|
+
releaseLock = _context22.sent;
|
|
1895
|
+
selectedObject = (0, _get2["default"])(canvas, 'selectedObject');
|
|
1896
|
+
if (selectedObject) {
|
|
1897
|
+
selectedObject.selected = false;
|
|
1898
|
+
}
|
|
1899
|
+
maskHandler = canvas.getMaskHandler();
|
|
1900
|
+
if (maskHandler) {
|
|
1901
|
+
restoreOutlineVisibility = maskHandler.toggleOutline(showHighlight, {
|
|
1902
|
+
getZoomFactor: function getZoomFactor(_ref20) {
|
|
1903
|
+
var zoom = _ref20.zoom;
|
|
1904
|
+
// currentZoom is only available for 2D, for 3D it is always 1
|
|
1905
|
+
var threeFactor = Math.min(getParams().currentZoom, 1) || 1;
|
|
1906
|
+
return zoom * threeFactor;
|
|
1907
|
+
}
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
restoreColorOverlayVisibility = (_canvas$getColorOverl = canvas.getColorOverlay()) === null || _canvas$getColorOverl === void 0 ? void 0 : _canvas$getColorOverl.toggle(false);
|
|
1911
|
+
drawToContext = canvas.drawToContext.bind(canvas);
|
|
1912
|
+
getSvg = function getSvg() {
|
|
1913
|
+
return canvas.getScreenshot((0, _Selectors4.getFontMapping)(state));
|
|
1914
|
+
};
|
|
1915
|
+
_context22.next = 15;
|
|
1916
|
+
return drawCanvasToArea(_objectSpread({
|
|
1917
|
+
drawToContext: drawToContext,
|
|
1918
|
+
designArea: designArea,
|
|
1919
|
+
getSvg: getSvg
|
|
1920
|
+
}, effectEnabled && (0, _Selectors.getVisualizationEffectWithOptions)(state, designArea, variantIdentifier)));
|
|
1921
|
+
case 15:
|
|
1922
|
+
if (maskHandler) {
|
|
1923
|
+
restoreOutlineVisibility();
|
|
1924
|
+
}
|
|
1925
|
+
restoreColorOverlayVisibility && restoreColorOverlayVisibility();
|
|
1926
|
+
releaseLock();
|
|
1927
|
+
case 18:
|
|
1928
|
+
case "end":
|
|
1929
|
+
return _context22.stop();
|
|
2300
1930
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
case 14:
|
|
2309
|
-
_context22.next = 19;
|
|
2310
|
-
break;
|
|
2311
|
-
|
|
2312
|
-
case 16:
|
|
2313
|
-
_context22.prev = 16;
|
|
2314
|
-
_context22.t1 = _context22["catch"](7);
|
|
2315
|
-
|
|
2316
|
-
_iterator9.e(_context22.t1);
|
|
2317
|
-
|
|
2318
|
-
case 19:
|
|
2319
|
-
_context22.prev = 19;
|
|
2320
|
-
|
|
2321
|
-
_iterator9.f();
|
|
2322
|
-
|
|
2323
|
-
return _context22.finish(19);
|
|
2324
|
-
|
|
2325
|
-
case 22:
|
|
2326
|
-
drawOn(textureCtx);
|
|
2327
|
-
|
|
2328
|
-
case 23:
|
|
2329
|
-
case "end":
|
|
2330
|
-
return _context22.stop();
|
|
1931
|
+
}, _loop);
|
|
1932
|
+
});
|
|
1933
|
+
_iterator9.s();
|
|
1934
|
+
case 10:
|
|
1935
|
+
if ((_step9 = _iterator9.n()).done) {
|
|
1936
|
+
_context23.next = 14;
|
|
1937
|
+
break;
|
|
2331
1938
|
}
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
1939
|
+
return _context23.delegateYield(_loop(), "t0", 12);
|
|
1940
|
+
case 12:
|
|
1941
|
+
_context23.next = 10;
|
|
1942
|
+
break;
|
|
1943
|
+
case 14:
|
|
1944
|
+
_context23.next = 19;
|
|
1945
|
+
break;
|
|
1946
|
+
case 16:
|
|
1947
|
+
_context23.prev = 16;
|
|
1948
|
+
_context23.t1 = _context23["catch"](7);
|
|
1949
|
+
_iterator9.e(_context23.t1);
|
|
1950
|
+
case 19:
|
|
1951
|
+
_context23.prev = 19;
|
|
1952
|
+
_iterator9.f();
|
|
1953
|
+
return _context23.finish(19);
|
|
1954
|
+
case 22:
|
|
1955
|
+
drawOn(textureCtx);
|
|
1956
|
+
case 23:
|
|
1957
|
+
case "end":
|
|
1958
|
+
return _context23.stop();
|
|
1959
|
+
}
|
|
1960
|
+
}, _callee22, null, [[7, 16, 19, 22]]);
|
|
1961
|
+
}));
|
|
1962
|
+
return function drawingFn(_x24, _x25) {
|
|
1963
|
+
return _ref19.apply(this, arguments);
|
|
1964
|
+
};
|
|
1965
|
+
}();
|
|
1966
|
+
_context24.prev = 6;
|
|
1967
|
+
_context24.next = 9;
|
|
1968
|
+
return getDrawingContext(drawingFn, true /* update alpha */, true /* clean up texture before drawing */);
|
|
1969
|
+
case 9:
|
|
1970
|
+
_context24.next = 14;
|
|
1971
|
+
break;
|
|
1972
|
+
case 11:
|
|
1973
|
+
_context24.prev = 11;
|
|
1974
|
+
_context24.t0 = _context24["catch"](6);
|
|
1975
|
+
// eslint-disable-next-line no-console
|
|
1976
|
+
console.warn('Could not get drawing context, texture update is skipped!', _context24.t0.message);
|
|
1977
|
+
case 14:
|
|
1978
|
+
case "end":
|
|
1979
|
+
return _context24.stop();
|
|
2363
1980
|
}
|
|
2364
|
-
},
|
|
1981
|
+
}, _callee23, null, [[6, 11]]);
|
|
2365
1982
|
}));
|
|
2366
|
-
|
|
2367
1983
|
function redrawAllDesignAreas(_x22, _x23) {
|
|
2368
1984
|
return _redrawAllDesignAreas.apply(this, arguments);
|
|
2369
1985
|
}
|
|
2370
|
-
|
|
2371
1986
|
return redrawAllDesignAreas;
|
|
2372
1987
|
}()
|
|
2373
1988
|
}, {
|
|
2374
1989
|
key: "redrawEmptyAreas",
|
|
2375
1990
|
value: function redrawEmptyAreas(getDrawingContext) {
|
|
2376
|
-
getDrawingContext( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
2377
|
-
return
|
|
2378
|
-
while (1) {
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
return _context24.stop();
|
|
2383
|
-
}
|
|
1991
|
+
getDrawingContext( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1992
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context25) {
|
|
1993
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1994
|
+
case 0:
|
|
1995
|
+
case "end":
|
|
1996
|
+
return _context25.stop();
|
|
2384
1997
|
}
|
|
2385
|
-
},
|
|
2386
|
-
})), true
|
|
2387
|
-
/* update alpha */
|
|
2388
|
-
, true
|
|
2389
|
-
/* clean up texture before drawing */
|
|
2390
|
-
);
|
|
1998
|
+
}, _callee24);
|
|
1999
|
+
})), true /* update alpha */, true /* clean up texture before drawing */);
|
|
2391
2000
|
}
|
|
2392
2001
|
}, {
|
|
2393
2002
|
key: "toggleHighlight",
|
|
2394
2003
|
value: function toggleHighlight(show) {
|
|
2395
2004
|
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2396
|
-
|
|
2397
2005
|
_ServiceLocator.Services.store.dispatch((0, _Actions3.toggleHighlight)(show));
|
|
2398
|
-
|
|
2399
2006
|
if (update) {
|
|
2400
2007
|
this.updateVisualization();
|
|
2401
2008
|
}
|
|
@@ -2404,10 +2011,8 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2404
2011
|
key: "toggleIsInPreviewMode",
|
|
2405
2012
|
value: function toggleIsInPreviewMode(isInPreviewMode) {
|
|
2406
2013
|
this.isInPreviewMode = isInPreviewMode;
|
|
2407
|
-
|
|
2408
2014
|
if (!this.isInPreviewMode) {
|
|
2409
2015
|
var hasSelectedDesignArea = !!(0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state).identifier;
|
|
2410
|
-
|
|
2411
2016
|
if (hasSelectedDesignArea) {
|
|
2412
2017
|
_ServiceLocator.Services.visualization.disableUserMovement();
|
|
2413
2018
|
}
|
|
@@ -2417,7 +2022,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2417
2022
|
key: "createHighlightMemo",
|
|
2418
2023
|
value: function createHighlightMemo(tmpState) {
|
|
2419
2024
|
var _this9 = this;
|
|
2420
|
-
|
|
2421
2025
|
var origState = (0, _Selectors.isHighlighted)(_ServiceLocator.Services.store.state);
|
|
2422
2026
|
this.toggleHighlight(tmpState, false);
|
|
2423
2027
|
return {
|
|
@@ -2429,119 +2033,101 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2429
2033
|
}, {
|
|
2430
2034
|
key: "getScreenshots",
|
|
2431
2035
|
value: function () {
|
|
2432
|
-
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/
|
|
2036
|
+
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(fontMapping) {
|
|
2433
2037
|
var _this10 = this;
|
|
2434
|
-
|
|
2435
2038
|
var options,
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
var
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
screenshot = _ref26[1];
|
|
2499
|
-
|
|
2500
|
-
return _objectSpread(_objectSpread({}, screenShots), {}, _defineProperty({}, id, screenshot));
|
|
2501
|
-
}, {}));
|
|
2502
|
-
|
|
2503
|
-
case 5:
|
|
2504
|
-
case "end":
|
|
2505
|
-
return _context26.stop();
|
|
2506
|
-
}
|
|
2039
|
+
_options$screenshotFn,
|
|
2040
|
+
screenshotFn,
|
|
2041
|
+
_args27 = arguments;
|
|
2042
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2043
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2044
|
+
case 0:
|
|
2045
|
+
options = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {};
|
|
2046
|
+
_options$screenshotFn = options.screenshotFn, screenshotFn = _options$screenshotFn === void 0 ? 'getScreenshot' : _options$screenshotFn;
|
|
2047
|
+
_context27.next = 4;
|
|
2048
|
+
return Promise.all(this.getDesignAreas().map(function (area) {
|
|
2049
|
+
return {
|
|
2050
|
+
id: area.identifier,
|
|
2051
|
+
canvas: _this10._getCanvas(area)
|
|
2052
|
+
};
|
|
2053
|
+
}).filter(function (_ref22) {
|
|
2054
|
+
var canvas = _ref22.canvas;
|
|
2055
|
+
return canvas && canvas[screenshotFn] && canvas.objects && canvas.objects.length > 0;
|
|
2056
|
+
}).map( /*#__PURE__*/function () {
|
|
2057
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref23) {
|
|
2058
|
+
var _canvas$getColorOverl2;
|
|
2059
|
+
var id, canvas, releaseLock, maskHandler, restoreOutlineVisibility, restoreColorOverlayVisibility, result;
|
|
2060
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context26) {
|
|
2061
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2062
|
+
case 0:
|
|
2063
|
+
id = _ref23.id, canvas = _ref23.canvas;
|
|
2064
|
+
_context26.next = 3;
|
|
2065
|
+
return (0, _ObjectLock.requestLock)(canvas);
|
|
2066
|
+
case 3:
|
|
2067
|
+
releaseLock = _context26.sent;
|
|
2068
|
+
maskHandler = canvas.getMaskHandler();
|
|
2069
|
+
restoreOutlineVisibility = maskHandler && maskHandler.toggleOutline(false);
|
|
2070
|
+
restoreColorOverlayVisibility = (_canvas$getColorOverl2 = canvas.getColorOverlay()) === null || _canvas$getColorOverl2 === void 0 ? void 0 : _canvas$getColorOverl2.toggle(false);
|
|
2071
|
+
_context26.t0 = id;
|
|
2072
|
+
_context26.next = 10;
|
|
2073
|
+
return canvas[screenshotFn](fontMapping);
|
|
2074
|
+
case 10:
|
|
2075
|
+
_context26.t1 = _context26.sent;
|
|
2076
|
+
result = [_context26.t0, _context26.t1];
|
|
2077
|
+
restoreOutlineVisibility && restoreOutlineVisibility();
|
|
2078
|
+
restoreColorOverlayVisibility && restoreColorOverlayVisibility();
|
|
2079
|
+
releaseLock();
|
|
2080
|
+
return _context26.abrupt("return", result);
|
|
2081
|
+
case 16:
|
|
2082
|
+
case "end":
|
|
2083
|
+
return _context26.stop();
|
|
2084
|
+
}
|
|
2085
|
+
}, _callee25);
|
|
2086
|
+
}));
|
|
2087
|
+
return function (_x27) {
|
|
2088
|
+
return _ref24.apply(this, arguments);
|
|
2089
|
+
};
|
|
2090
|
+
}()));
|
|
2091
|
+
case 4:
|
|
2092
|
+
return _context27.abrupt("return", _context27.sent.reduce(function (screenShots, _ref25) {
|
|
2093
|
+
var _ref26 = _slicedToArray(_ref25, 2),
|
|
2094
|
+
id = _ref26[0],
|
|
2095
|
+
screenshot = _ref26[1];
|
|
2096
|
+
return _objectSpread(_objectSpread({}, screenShots), {}, _defineProperty({}, id, screenshot));
|
|
2097
|
+
}, {}));
|
|
2098
|
+
case 5:
|
|
2099
|
+
case "end":
|
|
2100
|
+
return _context27.stop();
|
|
2507
2101
|
}
|
|
2508
|
-
},
|
|
2102
|
+
}, _callee26, this);
|
|
2509
2103
|
}));
|
|
2510
|
-
|
|
2511
2104
|
function getScreenshots(_x26) {
|
|
2512
2105
|
return _getScreenshots.apply(this, arguments);
|
|
2513
2106
|
}
|
|
2514
|
-
|
|
2515
2107
|
return getScreenshots;
|
|
2516
2108
|
}()
|
|
2517
2109
|
}, {
|
|
2518
2110
|
key: "getScreenshotsOfElements",
|
|
2519
2111
|
value: function () {
|
|
2520
|
-
var _getScreenshotsOfElements = _asyncToGenerator( /*#__PURE__*/
|
|
2521
|
-
return
|
|
2522
|
-
while (1) {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
case 3:
|
|
2534
|
-
case "end":
|
|
2535
|
-
return _context27.stop();
|
|
2536
|
-
}
|
|
2112
|
+
var _getScreenshotsOfElements = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(fontMapping) {
|
|
2113
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
2114
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2115
|
+
case 0:
|
|
2116
|
+
_context28.next = 2;
|
|
2117
|
+
return this.getScreenshots(fontMapping, {
|
|
2118
|
+
screenshotFn: 'getScreenshotsOfElements'
|
|
2119
|
+
});
|
|
2120
|
+
case 2:
|
|
2121
|
+
return _context28.abrupt("return", _context28.sent);
|
|
2122
|
+
case 3:
|
|
2123
|
+
case "end":
|
|
2124
|
+
return _context28.stop();
|
|
2537
2125
|
}
|
|
2538
|
-
},
|
|
2126
|
+
}, _callee27, this);
|
|
2539
2127
|
}));
|
|
2540
|
-
|
|
2541
2128
|
function getScreenshotsOfElements(_x28) {
|
|
2542
2129
|
return _getScreenshotsOfElements.apply(this, arguments);
|
|
2543
2130
|
}
|
|
2544
|
-
|
|
2545
2131
|
return getScreenshotsOfElements;
|
|
2546
2132
|
}()
|
|
2547
2133
|
/**
|
|
@@ -2554,22 +2140,17 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2554
2140
|
* @param designAreaIdentifier
|
|
2555
2141
|
* @returns {{toggleSampleText: (function(*=)), setColorAmount: (function(*=))}}
|
|
2556
2142
|
*/
|
|
2557
|
-
|
|
2558
2143
|
}, {
|
|
2559
2144
|
key: "getSampleCanvasEditorForDesignArea",
|
|
2560
2145
|
value: function getSampleCanvasEditorForDesignArea() {
|
|
2561
2146
|
var _this11 = this;
|
|
2562
|
-
|
|
2563
2147
|
var designAreaIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2564
2148
|
designAreaIdentifier && _ServiceLocator.Services.store.dispatch((0, _Actions3.selectDesignArea)(designAreaIdentifier));
|
|
2565
2149
|
var designArea = _ServiceLocator.Services.store.state.designArea.selectedDesignArea;
|
|
2566
2150
|
var identifier = designArea.identifier;
|
|
2567
|
-
|
|
2568
2151
|
var canvas = this._getCanvas(designArea);
|
|
2569
|
-
|
|
2570
2152
|
if (canvas) {
|
|
2571
2153
|
var previouslyContainedSampleText = canvas.getLength() > 0;
|
|
2572
|
-
|
|
2573
2154
|
var addSampleText = function addSampleText() {
|
|
2574
2155
|
var state = _ServiceLocator.Services.store.state;
|
|
2575
2156
|
var designAreaData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, identifier);
|
|
@@ -2577,13 +2158,10 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2577
2158
|
var text = (0, _i18n.t)('calculationWidget.textContent', {
|
|
2578
2159
|
colorAmount: colorAmount
|
|
2579
2160
|
});
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2161
|
+
_ServiceLocator.Services.designer.addText(canvas, text, colorAmount);
|
|
2162
|
+
// eslint-disable-next-line no-console
|
|
2584
2163
|
console.log("Sample text added to canvas: ".concat(identifier));
|
|
2585
2164
|
};
|
|
2586
|
-
|
|
2587
2165
|
var clearTextObjects = function clearTextObjects() {
|
|
2588
2166
|
var objects = canvas.objects.filter(function (obj) {
|
|
2589
2167
|
return obj.type === 'Text';
|
|
@@ -2592,7 +2170,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2592
2170
|
return obj.remove();
|
|
2593
2171
|
});
|
|
2594
2172
|
};
|
|
2595
|
-
|
|
2596
2173
|
return {
|
|
2597
2174
|
toggleSampleText: function toggleSampleText(active) {
|
|
2598
2175
|
if (active) {
|
|
@@ -2600,25 +2177,19 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2600
2177
|
} else {
|
|
2601
2178
|
canvas.clear();
|
|
2602
2179
|
}
|
|
2603
|
-
|
|
2604
2180
|
_this11.updateCanvasData(canvas);
|
|
2605
2181
|
},
|
|
2606
2182
|
setColorAmount: function setColorAmount(value) {
|
|
2607
2183
|
clearTextObjects();
|
|
2608
|
-
|
|
2609
2184
|
_this11.setColorAmount(value);
|
|
2610
|
-
|
|
2611
2185
|
previouslyContainedSampleText && addSampleText();
|
|
2612
2186
|
var imgObjects = canvas.objects.filter(function (obj) {
|
|
2613
2187
|
return obj.type !== 'Text';
|
|
2614
2188
|
});
|
|
2615
|
-
|
|
2616
2189
|
var canvasData = _this11._serializeCanvas(canvas);
|
|
2617
|
-
|
|
2618
2190
|
if (imgObjects.length > 0) {
|
|
2619
2191
|
canvasData = _this11.calculateObjectPosition(canvas);
|
|
2620
2192
|
}
|
|
2621
|
-
|
|
2622
2193
|
_this11.setCanvasData(canvasData, identifier);
|
|
2623
2194
|
}
|
|
2624
2195
|
};
|
|
@@ -2627,158 +2198,124 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2627
2198
|
}, {
|
|
2628
2199
|
key: "addSampleImageForDesignAreas",
|
|
2629
2200
|
value: function () {
|
|
2630
|
-
var _addSampleImageForDesignAreas = _asyncToGenerator( /*#__PURE__*/
|
|
2201
|
+
var _addSampleImageForDesignAreas = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(designAreaIdentifiers, active) {
|
|
2631
2202
|
var _this12 = this;
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
if (!active) {
|
|
2651
|
-
_context28.next = 13;
|
|
2652
|
-
break;
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
|
-
imageData = (0, _Modifiers2.createSVGImageData)({
|
|
2656
|
-
fileName: 'designer_placeholder_logo.svg',
|
|
2657
|
-
imageUrl: imageSrc,
|
|
2658
|
-
thumbUrl: imageSrc,
|
|
2659
|
-
isPlaceHolderImage: true,
|
|
2660
|
-
galleryImage: false
|
|
2661
|
-
});
|
|
2662
|
-
_context28.next = 8;
|
|
2663
|
-
return _ServiceLocator.Services.designer.addImageFromUrl(canvas, (0, _Selectors2.getPreviewUrlFromImageData)(imageData.preview), imageData, {
|
|
2664
|
-
enlargeImage: true
|
|
2665
|
-
});
|
|
2666
|
-
|
|
2667
|
-
case 8:
|
|
2668
|
-
canvasDataJSON = _this12.calculateObjectPosition(canvas); // eslint-disable-next-line no-console
|
|
2669
|
-
|
|
2670
|
-
// eslint-disable-next-line no-console
|
|
2671
|
-
console.log("Sample image added to canvas: ".concat(designAreaIdentifier));
|
|
2672
|
-
|
|
2673
|
-
_this12.setCanvasData(canvasDataJSON, designAreaIdentifier);
|
|
2674
|
-
|
|
2675
|
-
_context28.next = 21;
|
|
2676
|
-
break;
|
|
2677
|
-
|
|
2678
|
-
case 13:
|
|
2679
|
-
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designAreaIdentifier);
|
|
2680
|
-
canvasData = designData.canvasData;
|
|
2681
|
-
|
|
2682
|
-
if (canvasData) {
|
|
2683
|
-
_context28.next = 17;
|
|
2684
|
-
break;
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
return _context28.abrupt("return");
|
|
2688
|
-
|
|
2689
|
-
case 17:
|
|
2690
|
-
objects = canvasData ? canvasData.objects.filter(function (obj) {
|
|
2691
|
-
return obj.type === 'Text';
|
|
2692
|
-
}) : [];
|
|
2693
|
-
|
|
2694
|
-
_this12.setCanvasData(_objectSpread(_objectSpread({}, canvasData), {}, {
|
|
2695
|
-
objects: objects
|
|
2696
|
-
}), designAreaIdentifier);
|
|
2697
|
-
|
|
2698
|
-
_context28.next = 21;
|
|
2699
|
-
return _this12.loadCanvasDataFromState([designArea]);
|
|
2700
|
-
|
|
2701
|
-
case 21:
|
|
2702
|
-
return _context28.abrupt("return", {
|
|
2703
|
-
canvas: canvas,
|
|
2704
|
-
designAreaIdentifier: designAreaIdentifier
|
|
2705
|
-
});
|
|
2706
|
-
|
|
2707
|
-
case 22:
|
|
2708
|
-
case "end":
|
|
2709
|
-
return _context28.stop();
|
|
2203
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context30) {
|
|
2204
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2205
|
+
case 0:
|
|
2206
|
+
_context30.next = 2;
|
|
2207
|
+
return Promise.all(designAreaIdentifiers.map( /*#__PURE__*/function () {
|
|
2208
|
+
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(designAreaIdentifier) {
|
|
2209
|
+
var designArea, canvas, state, imageSrc, imageData, canvasDataJSON, designData, canvasData, objects;
|
|
2210
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
2211
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2212
|
+
case 0:
|
|
2213
|
+
designArea = _this12.getDesignAreaByIdentifier(designAreaIdentifier);
|
|
2214
|
+
canvas = _this12._getCanvas(designArea);
|
|
2215
|
+
state = _ServiceLocator.Services.store.state;
|
|
2216
|
+
imageSrc = _designer_placeholder_logo["default"];
|
|
2217
|
+
if (!active) {
|
|
2218
|
+
_context29.next = 13;
|
|
2219
|
+
break;
|
|
2710
2220
|
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2221
|
+
imageData = (0, _Modifiers2.createSVGImageData)({
|
|
2222
|
+
fileName: 'designer_placeholder_logo.svg',
|
|
2223
|
+
imageUrl: imageSrc,
|
|
2224
|
+
thumbUrl: imageSrc,
|
|
2225
|
+
isPlaceHolderImage: true,
|
|
2226
|
+
galleryImage: false
|
|
2227
|
+
});
|
|
2228
|
+
_context29.next = 8;
|
|
2229
|
+
return _ServiceLocator.Services.designer.addImageFromUrl(canvas, (0, _Selectors2.getPreviewUrlFromImageData)(imageData.preview), imageData, {
|
|
2230
|
+
enlargeImage: true
|
|
2231
|
+
});
|
|
2232
|
+
case 8:
|
|
2233
|
+
canvasDataJSON = _this12.calculateObjectPosition(canvas); // eslint-disable-next-line no-console
|
|
2234
|
+
console.log("Sample image added to canvas: ".concat(designAreaIdentifier));
|
|
2235
|
+
_this12.setCanvasData(canvasDataJSON, designAreaIdentifier);
|
|
2236
|
+
_context29.next = 21;
|
|
2237
|
+
break;
|
|
2238
|
+
case 13:
|
|
2239
|
+
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designAreaIdentifier);
|
|
2240
|
+
canvasData = designData.canvasData;
|
|
2241
|
+
if (canvasData) {
|
|
2242
|
+
_context29.next = 17;
|
|
2243
|
+
break;
|
|
2244
|
+
}
|
|
2245
|
+
return _context29.abrupt("return");
|
|
2246
|
+
case 17:
|
|
2247
|
+
objects = canvasData ? canvasData.objects.filter(function (obj) {
|
|
2248
|
+
return obj.type === 'Text';
|
|
2249
|
+
}) : [];
|
|
2250
|
+
_this12.setCanvasData(_objectSpread(_objectSpread({}, canvasData), {}, {
|
|
2251
|
+
objects: objects
|
|
2252
|
+
}), designAreaIdentifier);
|
|
2253
|
+
_context29.next = 21;
|
|
2254
|
+
return _this12.loadCanvasDataFromState([designArea]);
|
|
2255
|
+
case 21:
|
|
2256
|
+
return _context29.abrupt("return", {
|
|
2257
|
+
canvas: canvas,
|
|
2258
|
+
designAreaIdentifier: designAreaIdentifier
|
|
2259
|
+
});
|
|
2260
|
+
case 22:
|
|
2261
|
+
case "end":
|
|
2262
|
+
return _context29.stop();
|
|
2263
|
+
}
|
|
2264
|
+
}, _callee28);
|
|
2265
|
+
}));
|
|
2266
|
+
return function (_x31) {
|
|
2267
|
+
return _ref27.apply(this, arguments);
|
|
2268
|
+
};
|
|
2269
|
+
}()));
|
|
2270
|
+
case 2:
|
|
2271
|
+
case "end":
|
|
2272
|
+
return _context30.stop();
|
|
2724
2273
|
}
|
|
2725
|
-
},
|
|
2274
|
+
}, _callee29);
|
|
2726
2275
|
}));
|
|
2727
|
-
|
|
2728
2276
|
function addSampleImageForDesignAreas(_x29, _x30) {
|
|
2729
2277
|
return _addSampleImageForDesignAreas.apply(this, arguments);
|
|
2730
2278
|
}
|
|
2731
|
-
|
|
2732
2279
|
return addSampleImageForDesignAreas;
|
|
2733
2280
|
}()
|
|
2734
2281
|
}, {
|
|
2735
2282
|
key: "addImageToDesignArea",
|
|
2736
2283
|
value: function () {
|
|
2737
|
-
var _addImageToDesignArea = _asyncToGenerator( /*#__PURE__*/
|
|
2284
|
+
var _addImageToDesignArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(designArea, imageData) {
|
|
2738
2285
|
var canvas;
|
|
2739
|
-
return
|
|
2740
|
-
while (1) {
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
case 5:
|
|
2761
|
-
return _context30.abrupt("return", _context30.sent);
|
|
2762
|
-
|
|
2763
|
-
case 6:
|
|
2764
|
-
case "end":
|
|
2765
|
-
return _context30.stop();
|
|
2766
|
-
}
|
|
2286
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context31) {
|
|
2287
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2288
|
+
case 0:
|
|
2289
|
+
canvas = this._getCanvas(designArea);
|
|
2290
|
+
if (canvas) {
|
|
2291
|
+
_context31.next = 3;
|
|
2292
|
+
break;
|
|
2293
|
+
}
|
|
2294
|
+
return _context31.abrupt("return", false);
|
|
2295
|
+
case 3:
|
|
2296
|
+
_context31.next = 5;
|
|
2297
|
+
return _ServiceLocator.Services.designer.addImageFromUrl(canvas, (0, _Selectors2.getPreviewUrlFromImageData)(imageData.preview), imageData, {
|
|
2298
|
+
enlargeImage: true,
|
|
2299
|
+
scaleToHalf: false,
|
|
2300
|
+
autoSelect: false
|
|
2301
|
+
});
|
|
2302
|
+
case 5:
|
|
2303
|
+
return _context31.abrupt("return", _context31.sent);
|
|
2304
|
+
case 6:
|
|
2305
|
+
case "end":
|
|
2306
|
+
return _context31.stop();
|
|
2767
2307
|
}
|
|
2768
|
-
},
|
|
2308
|
+
}, _callee30, this);
|
|
2769
2309
|
}));
|
|
2770
|
-
|
|
2771
2310
|
function addImageToDesignArea(_x32, _x33) {
|
|
2772
2311
|
return _addImageToDesignArea.apply(this, arguments);
|
|
2773
2312
|
}
|
|
2774
|
-
|
|
2775
2313
|
return addImageToDesignArea;
|
|
2776
2314
|
}()
|
|
2777
2315
|
}, {
|
|
2778
2316
|
key: "calculateObjectPosition",
|
|
2779
2317
|
value: function calculateObjectPosition(canvas) {
|
|
2780
2318
|
var canvasData = this._serializeCanvas(canvas);
|
|
2781
|
-
|
|
2782
2319
|
var textObject = canvasData ? canvasData.objects.find(function (obj) {
|
|
2783
2320
|
return obj.type === 'Text';
|
|
2784
2321
|
}) : [];
|
|
@@ -2791,7 +2328,6 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2791
2328
|
var canvasImageObject = canvas.objects.find(function (obj) {
|
|
2792
2329
|
return obj.uuid === imageObject.uuid;
|
|
2793
2330
|
});
|
|
2794
|
-
|
|
2795
2331
|
if (canvasTextObject && canvasImageObject) {
|
|
2796
2332
|
var canvasImageObjectSize = canvasImageObject.getBoundSize();
|
|
2797
2333
|
var canvasTextObjectSize = canvasTextObject.getBoundSize();
|
|
@@ -2801,32 +2337,25 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2801
2337
|
objects: objects
|
|
2802
2338
|
});
|
|
2803
2339
|
}
|
|
2804
|
-
|
|
2805
2340
|
return canvasData;
|
|
2806
2341
|
}
|
|
2807
2342
|
}, {
|
|
2808
2343
|
key: "applyDesignAreaPreSelection",
|
|
2809
2344
|
value: function applyDesignAreaPreSelection(filteredDesignAreas) {
|
|
2810
2345
|
var preSelectionDesignAreaIdentifier = (0, _get2["default"])((0, _configuration.getConf)('designerPreSelection', {}), 'designAreas[0].identifier');
|
|
2811
|
-
|
|
2812
2346
|
if (preSelectionDesignAreaIdentifier) {
|
|
2813
2347
|
this.selectDesignArea(preSelectionDesignAreaIdentifier);
|
|
2814
2348
|
}
|
|
2815
|
-
|
|
2816
2349
|
var _iterator10 = _createForOfIteratorHelper(filteredDesignAreas),
|
|
2817
|
-
|
|
2818
|
-
|
|
2350
|
+
_step10;
|
|
2819
2351
|
try {
|
|
2820
2352
|
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
2821
2353
|
var area = _step10.value;
|
|
2822
2354
|
var selectedDesignArea = (0, _Selectors.getDesignAreaPreSelection)(area.identifier);
|
|
2823
|
-
|
|
2824
2355
|
if (selectedDesignArea.identifier) {
|
|
2825
2356
|
var preSelectionColorAmount = +(0, _get2["default"])(selectedDesignArea, 'colorAmount', 1);
|
|
2826
|
-
|
|
2827
2357
|
if (!isNaN(preSelectionColorAmount)) {
|
|
2828
2358
|
var sampleCanvasEditor = _ServiceLocator.Services.designData.getSampleCanvasEditorForDesignArea(area.identifier);
|
|
2829
|
-
|
|
2830
2359
|
sampleCanvasEditor.setColorAmount(preSelectionColorAmount);
|
|
2831
2360
|
sampleCanvasEditor.toggleSampleText(true);
|
|
2832
2361
|
}
|
|
@@ -2842,139 +2371,106 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2842
2371
|
key: "changeAllColorsNeeded",
|
|
2843
2372
|
value: function changeAllColorsNeeded() {
|
|
2844
2373
|
var _getSelectedDesignAre3 = (0, _Selectors.getSelectedDesignAreaProperties)(_ServiceLocator.Services.store.state),
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2374
|
+
maxColorAmount = _getSelectedDesignAre3.maxColorAmount,
|
|
2375
|
+
hasEngravingBackgroundColors = _getSelectedDesignAre3.hasEngravingBackgroundColors;
|
|
2848
2376
|
return maxColorAmount === 1 && !hasEngravingBackgroundColors;
|
|
2849
2377
|
}
|
|
2850
2378
|
}, {
|
|
2851
2379
|
key: "setImageAndTextColor",
|
|
2852
2380
|
value: function () {
|
|
2853
|
-
var _setImageAndTextColor = _asyncToGenerator( /*#__PURE__*/
|
|
2381
|
+
var _setImageAndTextColor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(color) {
|
|
2854
2382
|
var designArea, designData, objects, hasmultipleObjects, canvas, isImageSelected, selectedImageIdentifier, _iterator11, _step11, object, image, operations;
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
if (this.changeAllColorsNeeded()) {
|
|
2861
|
-
_context31.next = 2;
|
|
2862
|
-
break;
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
return _context31.abrupt("return");
|
|
2866
|
-
|
|
2867
|
-
case 2:
|
|
2868
|
-
designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
2869
|
-
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(_ServiceLocator.Services.store.state, designArea.identifier);
|
|
2870
|
-
objects = (0, _get2["default"])(designData, 'canvasData.objects', []);
|
|
2871
|
-
hasmultipleObjects = objects.length > 1;
|
|
2872
|
-
|
|
2873
|
-
if (hasmultipleObjects) {
|
|
2874
|
-
_context31.next = 8;
|
|
2875
|
-
break;
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
|
-
return _context31.abrupt("return");
|
|
2879
|
-
|
|
2880
|
-
case 8:
|
|
2881
|
-
canvas = this._getCanvas(designArea);
|
|
2882
|
-
isImageSelected = canvas.selectedObject && canvas.selectedObject.type === 'Image';
|
|
2883
|
-
selectedImageIdentifier = isImageSelected ? (0, _get2["default"])(_ServiceLocator.Services.store.state, 'imageGallery.selectedImage.identifier', null) : null;
|
|
2884
|
-
|
|
2885
|
-
_ServiceLocator.Services.store.dispatch((0, _Actions.setDesignAreaTextsColor)(designArea.identifier, color));
|
|
2886
|
-
|
|
2887
|
-
_iterator11 = _createForOfIteratorHelper(objects);
|
|
2888
|
-
_context31.prev = 13;
|
|
2889
|
-
|
|
2890
|
-
_iterator11.s();
|
|
2891
|
-
|
|
2892
|
-
case 15:
|
|
2893
|
-
if ((_step11 = _iterator11.n()).done) {
|
|
2894
|
-
_context31.next = 24;
|
|
2895
|
-
break;
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
|
-
object = _step11.value;
|
|
2899
|
-
|
|
2900
|
-
if (!(object.type === 'Image' && object.imageData.identifier !== selectedImageIdentifier)) {
|
|
2901
|
-
_context31.next = 22;
|
|
2902
|
-
break;
|
|
2903
|
-
}
|
|
2904
|
-
|
|
2905
|
-
image = (0, _Selectors2.getUserImage)(_ServiceLocator.Services.store.state, object.imageData.identifier);
|
|
2906
|
-
operations = (0, _Modifiers.setColorOnOperations)(image.operations, color);
|
|
2907
|
-
_context31.next = 22;
|
|
2908
|
-
return _ServiceLocator.Services.designData.editFile(operations, image);
|
|
2909
|
-
|
|
2910
|
-
case 22:
|
|
2911
|
-
_context31.next = 15;
|
|
2383
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context32) {
|
|
2384
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2385
|
+
case 0:
|
|
2386
|
+
if (this.changeAllColorsNeeded()) {
|
|
2387
|
+
_context32.next = 2;
|
|
2912
2388
|
break;
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2389
|
+
}
|
|
2390
|
+
return _context32.abrupt("return");
|
|
2391
|
+
case 2:
|
|
2392
|
+
designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
2393
|
+
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(_ServiceLocator.Services.store.state, designArea.identifier);
|
|
2394
|
+
objects = (0, _get2["default"])(designData, 'canvasData.objects', []);
|
|
2395
|
+
hasmultipleObjects = objects.length > 1;
|
|
2396
|
+
if (hasmultipleObjects) {
|
|
2397
|
+
_context32.next = 8;
|
|
2916
2398
|
break;
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2399
|
+
}
|
|
2400
|
+
return _context32.abrupt("return");
|
|
2401
|
+
case 8:
|
|
2402
|
+
canvas = this._getCanvas(designArea);
|
|
2403
|
+
isImageSelected = canvas.selectedObject && canvas.selectedObject.type === 'Image';
|
|
2404
|
+
selectedImageIdentifier = isImageSelected ? (0, _get2["default"])(_ServiceLocator.Services.store.state, 'imageGallery.selectedImage.identifier', null) : null;
|
|
2405
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions.setDesignAreaTextsColor)(designArea.identifier, color));
|
|
2406
|
+
_iterator11 = _createForOfIteratorHelper(objects);
|
|
2407
|
+
_context32.prev = 13;
|
|
2408
|
+
_iterator11.s();
|
|
2409
|
+
case 15:
|
|
2410
|
+
if ((_step11 = _iterator11.n()).done) {
|
|
2411
|
+
_context32.next = 24;
|
|
2412
|
+
break;
|
|
2413
|
+
}
|
|
2414
|
+
object = _step11.value;
|
|
2415
|
+
if (!(object.type === 'Image' && object.imageData.identifier !== selectedImageIdentifier)) {
|
|
2416
|
+
_context32.next = 22;
|
|
2417
|
+
break;
|
|
2418
|
+
}
|
|
2419
|
+
image = (0, _Selectors2.getUserImage)(_ServiceLocator.Services.store.state, object.imageData.identifier);
|
|
2420
|
+
operations = (0, _Modifiers.setColorOnOperations)(image.operations, color);
|
|
2421
|
+
_context32.next = 22;
|
|
2422
|
+
return _ServiceLocator.Services.designData.editFile(operations, image);
|
|
2423
|
+
case 22:
|
|
2424
|
+
_context32.next = 15;
|
|
2425
|
+
break;
|
|
2426
|
+
case 24:
|
|
2427
|
+
_context32.next = 29;
|
|
2428
|
+
break;
|
|
2429
|
+
case 26:
|
|
2430
|
+
_context32.prev = 26;
|
|
2431
|
+
_context32.t0 = _context32["catch"](13);
|
|
2432
|
+
_iterator11.e(_context32.t0);
|
|
2433
|
+
case 29:
|
|
2434
|
+
_context32.prev = 29;
|
|
2435
|
+
_iterator11.f();
|
|
2436
|
+
return _context32.finish(29);
|
|
2437
|
+
case 32:
|
|
2438
|
+
_context32.next = 34;
|
|
2439
|
+
return this.updateCanvasDataFromState([designArea]);
|
|
2440
|
+
case 34:
|
|
2441
|
+
case "end":
|
|
2442
|
+
return _context32.stop();
|
|
2939
2443
|
}
|
|
2940
|
-
},
|
|
2444
|
+
}, _callee31, this, [[13, 26, 29, 32]]);
|
|
2941
2445
|
}));
|
|
2942
|
-
|
|
2943
2446
|
function setImageAndTextColor(_x34) {
|
|
2944
2447
|
return _setImageAndTextColor.apply(this, arguments);
|
|
2945
2448
|
}
|
|
2946
|
-
|
|
2947
2449
|
return setImageAndTextColor;
|
|
2948
2450
|
}()
|
|
2949
2451
|
}, {
|
|
2950
2452
|
key: "getGalleryImageColors",
|
|
2951
2453
|
value: function () {
|
|
2952
|
-
var _getGalleryImageColors = _asyncToGenerator( /*#__PURE__*/
|
|
2454
|
+
var _getGalleryImageColors = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(url) {
|
|
2953
2455
|
var svgContent, designProductionMethod;
|
|
2954
|
-
return
|
|
2955
|
-
while (1) {
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
case 5:
|
|
2967
|
-
case "end":
|
|
2968
|
-
return _context32.stop();
|
|
2969
|
-
}
|
|
2456
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context33) {
|
|
2457
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2458
|
+
case 0:
|
|
2459
|
+
_context33.next = 2;
|
|
2460
|
+
return getSvgContent(url);
|
|
2461
|
+
case 2:
|
|
2462
|
+
svgContent = _context33.sent;
|
|
2463
|
+
designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
2464
|
+
return _context33.abrupt("return", (0, _Modifiers.createVectorizeColorsMap)({}, getSvgColors(svgContent, designProductionMethod)));
|
|
2465
|
+
case 5:
|
|
2466
|
+
case "end":
|
|
2467
|
+
return _context33.stop();
|
|
2970
2468
|
}
|
|
2971
|
-
},
|
|
2469
|
+
}, _callee32);
|
|
2972
2470
|
}));
|
|
2973
|
-
|
|
2974
2471
|
function getGalleryImageColors(_x35) {
|
|
2975
2472
|
return _getGalleryImageColors.apply(this, arguments);
|
|
2976
2473
|
}
|
|
2977
|
-
|
|
2978
2474
|
return getGalleryImageColors;
|
|
2979
2475
|
}()
|
|
2980
2476
|
}, {
|
|
@@ -2988,298 +2484,255 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
2988
2484
|
this.removeDesignAreaPlaceholders(false, true);
|
|
2989
2485
|
newImage && _ServiceLocator.Services.store.dispatch((0, _Actions.updateImageData)(newImage, originalImageIdentifier));
|
|
2990
2486
|
}
|
|
2487
|
+
|
|
2991
2488
|
/**
|
|
2992
2489
|
* Calls editFile in a queued way to make sure the current image data state is not updated simultaneously
|
|
2993
2490
|
* by other editFileQueued calls
|
|
2994
2491
|
* Note: it works only with editFileQueued calls (does not guard against calling editFile directly)
|
|
2995
2492
|
*/
|
|
2996
|
-
|
|
2997
2493
|
}, {
|
|
2998
2494
|
key: "editFileQueued",
|
|
2999
2495
|
value: function () {
|
|
3000
|
-
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/
|
|
2496
|
+
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(operations, image) {
|
|
3001
2497
|
var options,
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
return
|
|
3005
|
-
while (1) {
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
return _context33.finish(8);
|
|
3025
|
-
|
|
3026
|
-
case 11:
|
|
3027
|
-
case "end":
|
|
3028
|
-
return _context33.stop();
|
|
3029
|
-
}
|
|
2498
|
+
releaseLock,
|
|
2499
|
+
_args34 = arguments;
|
|
2500
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context34) {
|
|
2501
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2502
|
+
case 0:
|
|
2503
|
+
options = _args34.length > 2 && _args34[2] !== undefined ? _args34[2] : {};
|
|
2504
|
+
_context34.next = 3;
|
|
2505
|
+
return (0, _ObjectLock.requestLock)(this);
|
|
2506
|
+
case 3:
|
|
2507
|
+
releaseLock = _context34.sent;
|
|
2508
|
+
_context34.prev = 4;
|
|
2509
|
+
_context34.next = 7;
|
|
2510
|
+
return this.editFile(operations, image, options);
|
|
2511
|
+
case 7:
|
|
2512
|
+
return _context34.abrupt("return", _context34.sent);
|
|
2513
|
+
case 8:
|
|
2514
|
+
_context34.prev = 8;
|
|
2515
|
+
releaseLock();
|
|
2516
|
+
return _context34.finish(8);
|
|
2517
|
+
case 11:
|
|
2518
|
+
case "end":
|
|
2519
|
+
return _context34.stop();
|
|
3030
2520
|
}
|
|
3031
|
-
},
|
|
2521
|
+
}, _callee33, this, [[4,, 8, 11]]);
|
|
3032
2522
|
}));
|
|
3033
|
-
|
|
3034
2523
|
function editFileQueued(_x36, _x37) {
|
|
3035
2524
|
return _editFileQueued.apply(this, arguments);
|
|
3036
2525
|
}
|
|
3037
|
-
|
|
3038
2526
|
return editFileQueued;
|
|
3039
2527
|
}()
|
|
3040
2528
|
}, {
|
|
3041
2529
|
key: "editFile",
|
|
3042
2530
|
value: function () {
|
|
3043
|
-
var _editFile = _asyncToGenerator( /*#__PURE__*/
|
|
2531
|
+
var _editFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(operations, image) {
|
|
3044
2532
|
var options,
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
2533
|
+
_options$immediateCom,
|
|
2534
|
+
immediateCommit,
|
|
2535
|
+
_options$designProduc,
|
|
2536
|
+
designProductionMethod,
|
|
2537
|
+
_options$addMode,
|
|
2538
|
+
addMode,
|
|
2539
|
+
displayColorPreview,
|
|
2540
|
+
imageIdentifier,
|
|
2541
|
+
preview,
|
|
2542
|
+
compatibilityInfoHash,
|
|
2543
|
+
imageIsCompatible,
|
|
2544
|
+
operationsMatching,
|
|
2545
|
+
vectorizedLogoMandatory,
|
|
2546
|
+
colorPreviewRequired,
|
|
2547
|
+
imageDataPatch,
|
|
2548
|
+
_getImageUsageInfo,
|
|
2549
|
+
designAreas,
|
|
2550
|
+
count,
|
|
2551
|
+
createCopy,
|
|
2552
|
+
editData,
|
|
2553
|
+
currentEditData,
|
|
2554
|
+
isBackendNeeded,
|
|
2555
|
+
selectedImage,
|
|
2556
|
+
_designProductionMethod,
|
|
2557
|
+
svgContent,
|
|
2558
|
+
svgColors,
|
|
2559
|
+
vectorizeColorsMap,
|
|
2560
|
+
thresholdChanged,
|
|
2561
|
+
maxPotentialColorAmount,
|
|
2562
|
+
vectorizeOriginalColorsMap,
|
|
2563
|
+
numberOfAggregatedColors,
|
|
2564
|
+
numberOfColorsToRemove,
|
|
2565
|
+
_args35 = arguments;
|
|
2566
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context35) {
|
|
2567
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2568
|
+
case 0:
|
|
2569
|
+
options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
|
|
2570
|
+
// patch operations to keep other unchanged values
|
|
2571
|
+
operations = _objectSpread(_objectSpread({}, image.operations), operations);
|
|
2572
|
+
_options$immediateCom = options.immediateCommit, immediateCommit = _options$immediateCom === void 0 ? false : _options$immediateCom, _options$designProduc = options.designProductionMethod, designProductionMethod = _options$designProduc === void 0 ? (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state) : _options$designProduc, _options$addMode = options.addMode, addMode = _options$addMode === void 0 ? false : _options$addMode, displayColorPreview = options.displayColorPreview;
|
|
2573
|
+
imageIdentifier = image.identifier;
|
|
2574
|
+
preview = image.preview;
|
|
2575
|
+
compatibilityInfoHash = (0, _Selectors.getDesignAreaImageCompatibilityInfo)(designProductionMethod);
|
|
2576
|
+
imageIsCompatible = (0, _Selectors.areHashesCompatible)(image.compatibilityInfoHash, compatibilityInfoHash);
|
|
2577
|
+
operationsMatching = (0, _Modifiers.compareOperations)(image.operations, operations);
|
|
2578
|
+
vectorizedLogoMandatory = (0, _Selectors.isVectorizedLogoMandatory)(designProductionMethod);
|
|
2579
|
+
colorPreviewRequired = (0, _Selectors.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod) || vectorizedLogoMandatory;
|
|
2580
|
+
imageDataPatch = _objectSpread({
|
|
2581
|
+
compatibilityInfoHash: compatibilityInfoHash,
|
|
2582
|
+
colorPreviewRequired: colorPreviewRequired,
|
|
2583
|
+
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
2584
|
+
}, displayColorPreview !== undefined && {
|
|
2585
|
+
displayColorPreview: displayColorPreview
|
|
2586
|
+
});
|
|
2587
|
+
if (!(!operationsMatching || !imageIsCompatible)) {
|
|
2588
|
+
_context35.next = 29;
|
|
2589
|
+
break;
|
|
2590
|
+
}
|
|
2591
|
+
if (!image.operations) {
|
|
2592
|
+
operations.vectorizeThreshold = null;
|
|
2593
|
+
}
|
|
2594
|
+
operations = makeOperationsCompatible(operations, compatibilityInfoHash, designProductionMethod.colorPalettes);
|
|
2595
|
+
if (!image.gallery) {
|
|
2596
|
+
_context35.next = 18;
|
|
2597
|
+
break;
|
|
2598
|
+
}
|
|
2599
|
+
operations = _objectSpread(_objectSpread({}, operations || {}), {}, {
|
|
2600
|
+
vectorizeColorsMap: operations.vectorizeColorsMap
|
|
2601
|
+
});
|
|
2602
|
+
_context35.next = 29;
|
|
2603
|
+
break;
|
|
2604
|
+
case 18:
|
|
2605
|
+
_getImageUsageInfo = (0, _Selectors2.getImageUsageInfo)(_ServiceLocator.Services.store.state, image.identifier), designAreas = _getImageUsageInfo.designAreas, count = _getImageUsageInfo.count;
|
|
2606
|
+
createCopy = !!(designAreas > 1 && image.compatibilityInfoHash && !imageIsCompatible) || !operationsMatching && count > (addMode ? 0 : 1);
|
|
2607
|
+
editData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, operations, designProductionMethod);
|
|
2608
|
+
currentEditData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, image.operations || {}, designProductionMethod);
|
|
2609
|
+
isBackendNeeded = createCopy || !(0, _isEqual["default"])(editData, currentEditData);
|
|
2610
|
+
if (!isBackendNeeded) {
|
|
2611
|
+
_context35.next = 29;
|
|
2612
|
+
break;
|
|
2613
|
+
}
|
|
2614
|
+
_context35.next = 26;
|
|
2615
|
+
return _ServiceLocator.Services.store.dispatch((0, _Actions2.editImage)(_objectSpread(_objectSpread({}, editData), {}, {
|
|
2616
|
+
createCopy: createCopy
|
|
2617
|
+
}), _objectSpread(_objectSpread({}, imageDataPatch), {}, {
|
|
2618
|
+
operations: operations,
|
|
2619
|
+
identifier: imageIdentifier,
|
|
2620
|
+
incomplete: true
|
|
2621
|
+
}), {
|
|
2622
|
+
immediateCommit: immediateCommit
|
|
2623
|
+
}));
|
|
2624
|
+
case 26:
|
|
2625
|
+
selectedImage = _ServiceLocator.Services.store.state.imageGallery.selectedImage;
|
|
2626
|
+
preview = (0, _get2["default"])(selectedImage, 'preview');
|
|
2627
|
+
imageIdentifier = (0, _get2["default"])(selectedImage, 'identifier');
|
|
2628
|
+
case 29:
|
|
2629
|
+
if (!(!preview || !preview.url)) {
|
|
2630
|
+
_context35.next = 31;
|
|
2631
|
+
break;
|
|
2632
|
+
}
|
|
2633
|
+
throw new Error('Preview image url is not specified!');
|
|
2634
|
+
case 31:
|
|
2635
|
+
if (!(0, _Selectors2.isEditableVectorImage)(preview)) {
|
|
2636
|
+
_context35.next = 40;
|
|
2637
|
+
break;
|
|
2638
|
+
}
|
|
2639
|
+
_designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
2640
|
+
_context35.next = 35;
|
|
2641
|
+
return getSvgContent(preview.url, false, !operationsMatching);
|
|
2642
|
+
case 35:
|
|
2643
|
+
svgContent = _context35.sent;
|
|
2644
|
+
svgColors = getSvgColors(svgContent, _designProductionMethod);
|
|
2645
|
+
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)(operations.vectorizeColorsMap, svgColors);
|
|
2646
|
+
thresholdChanged = operations.vectorizeThreshold !== (0, _get2["default"])(image, 'operations.vectorizeThreshold', 0); // prepare initial values for the vectorize feature
|
|
2647
|
+
if (!operations.vectorizeThreshold) {
|
|
2648
|
+
maxPotentialColorAmount = +(0, _get2["default"])(preview, 'additionalData.maxPotentialColorAmount') || svgColors.length;
|
|
2649
|
+
operations = _objectSpread(_objectSpread({}, operations), {}, {
|
|
2650
|
+
vectorizeMaxColorAmount: maxPotentialColorAmount,
|
|
2651
|
+
vectorizeThreshold: (0, _Selectors5.getAggregatedColorCount)(vectorizeColorsMap)
|
|
3100
2652
|
});
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
if (!image.operations) {
|
|
3108
|
-
operations.vectorizeThreshold = null;
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
|
-
operations = makeOperationsCompatible(operations, compatibilityInfoHash, designProductionMethod.colorPalettes);
|
|
3112
|
-
|
|
3113
|
-
if (!image.gallery) {
|
|
3114
|
-
_context34.next = 18;
|
|
3115
|
-
break;
|
|
3116
|
-
}
|
|
3117
|
-
|
|
3118
|
-
operations = _objectSpread(_objectSpread({}, operations || {}), {}, {
|
|
3119
|
-
vectorizeColorsMap: operations.vectorizeColorsMap
|
|
2653
|
+
vectorizeOriginalColorsMap = (0, _Modifiers.createVectorizeColorsMap)({}, svgColors);
|
|
2654
|
+
operations = _objectSpread(_objectSpread({}, operations), {}, {
|
|
2655
|
+
vectorizeOriginalColorsMap: vectorizeOriginalColorsMap,
|
|
2656
|
+
vectorizeColorsMap: vectorizeColorsMap
|
|
3120
2657
|
});
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
case 18:
|
|
3125
|
-
_getImageUsageInfo = (0, _Selectors2.getImageUsageInfo)(_ServiceLocator.Services.store.state, image.identifier), designAreas = _getImageUsageInfo.designAreas, count = _getImageUsageInfo.count;
|
|
3126
|
-
createCopy = !!(designAreas > 1 && image.compatibilityInfoHash && !imageIsCompatible) || !operationsMatching && count > (addMode ? 0 : 1);
|
|
3127
|
-
editData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, operations, designProductionMethod);
|
|
3128
|
-
currentEditData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, image.operations || {}, designProductionMethod);
|
|
3129
|
-
isBackendNeeded = createCopy || !(0, _isEqual["default"])(editData, currentEditData);
|
|
3130
|
-
|
|
3131
|
-
if (!isBackendNeeded) {
|
|
3132
|
-
_context34.next = 29;
|
|
3133
|
-
break;
|
|
3134
|
-
}
|
|
3135
|
-
|
|
3136
|
-
_context34.next = 26;
|
|
3137
|
-
return _ServiceLocator.Services.store.dispatch((0, _Actions2.editImage)(_objectSpread(_objectSpread({}, editData), {}, {
|
|
3138
|
-
createCopy: createCopy
|
|
3139
|
-
}), _objectSpread(_objectSpread({}, imageDataPatch), {}, {
|
|
3140
|
-
operations: operations,
|
|
3141
|
-
identifier: imageIdentifier,
|
|
3142
|
-
incomplete: true
|
|
3143
|
-
}), {
|
|
3144
|
-
immediateCommit: immediateCommit
|
|
3145
|
-
}));
|
|
3146
|
-
|
|
3147
|
-
case 26:
|
|
3148
|
-
selectedImage = _ServiceLocator.Services.store.state.imageGallery.selectedImage;
|
|
3149
|
-
preview = (0, _get2["default"])(selectedImage, 'preview');
|
|
3150
|
-
imageIdentifier = (0, _get2["default"])(selectedImage, 'identifier');
|
|
3151
|
-
|
|
3152
|
-
case 29:
|
|
3153
|
-
if (!(!preview || !preview.url)) {
|
|
3154
|
-
_context34.next = 31;
|
|
3155
|
-
break;
|
|
3156
|
-
}
|
|
3157
|
-
|
|
3158
|
-
throw new Error('Preview image url is not specified!');
|
|
3159
|
-
|
|
3160
|
-
case 31:
|
|
3161
|
-
if (!(0, _Selectors2.isEditableVectorImage)(preview)) {
|
|
3162
|
-
_context34.next = 40;
|
|
3163
|
-
break;
|
|
3164
|
-
}
|
|
3165
|
-
|
|
3166
|
-
_designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
3167
|
-
_context34.next = 35;
|
|
3168
|
-
return getSvgContent(preview.url, false, !operationsMatching);
|
|
3169
|
-
|
|
3170
|
-
case 35:
|
|
3171
|
-
svgContent = _context34.sent;
|
|
3172
|
-
svgColors = getSvgColors(svgContent, _designProductionMethod);
|
|
3173
|
-
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)(operations.vectorizeColorsMap, svgColors);
|
|
3174
|
-
thresholdChanged = operations.vectorizeThreshold !== (0, _get2["default"])(image, 'operations.vectorizeThreshold', 0); // prepare initial values for the vectorize feature
|
|
2658
|
+
} else if (thresholdChanged) {
|
|
2659
|
+
operations.vectorizeColorsMap = (0, _ImageEditUtils.expandVectorizeColorsMap)(vectorizeColorsMap, _designProductionMethod.colorPalettes, operations.vectorizeThreshold);
|
|
3175
2660
|
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
vectorizeOriginalColorsMap = (0, _Modifiers.createVectorizeColorsMap)({}, svgColors);
|
|
3183
|
-
operations = _objectSpread(_objectSpread({}, operations), {}, {
|
|
3184
|
-
vectorizeOriginalColorsMap: vectorizeOriginalColorsMap,
|
|
3185
|
-
vectorizeColorsMap: vectorizeColorsMap
|
|
3186
|
-
});
|
|
3187
|
-
} else if (thresholdChanged) {
|
|
3188
|
-
operations.vectorizeColorsMap = (0, _ImageEditUtils.expandVectorizeColorsMap)(vectorizeColorsMap, _designProductionMethod.colorPalettes, operations.vectorizeThreshold); // gallery images are not edited by the api, colors have to be reduced programmatically
|
|
3189
|
-
|
|
3190
|
-
if (image.gallery) {
|
|
3191
|
-
numberOfAggregatedColors = (0, _Selectors5.getAggregatedColorCount)(operations.vectorizeColorsMap);
|
|
3192
|
-
numberOfColorsToRemove = numberOfAggregatedColors - operations.vectorizeThreshold;
|
|
3193
|
-
|
|
3194
|
-
if (numberOfColorsToRemove > 0) {
|
|
3195
|
-
operations.vectorizeColorsMap = (0, _Modifiers.reduceNumberOfDistinctColorsBy)(operations.vectorizeColorsMap, numberOfColorsToRemove);
|
|
3196
|
-
}
|
|
2661
|
+
// gallery images are not edited by the api, colors have to be reduced programmatically
|
|
2662
|
+
if (image.gallery) {
|
|
2663
|
+
numberOfAggregatedColors = (0, _Selectors5.getAggregatedColorCount)(operations.vectorizeColorsMap);
|
|
2664
|
+
numberOfColorsToRemove = numberOfAggregatedColors - operations.vectorizeThreshold;
|
|
2665
|
+
if (numberOfColorsToRemove > 0) {
|
|
2666
|
+
operations.vectorizeColorsMap = (0, _Modifiers.reduceNumberOfDistinctColorsBy)(operations.vectorizeColorsMap, numberOfColorsToRemove);
|
|
3197
2667
|
}
|
|
3198
|
-
} else {
|
|
3199
|
-
operations.vectorizeColorsMap = vectorizeColorsMap;
|
|
3200
|
-
}
|
|
3201
|
-
|
|
3202
|
-
case 40:
|
|
3203
|
-
_ServiceLocator.Services.store.dispatch((0, _Actions2.updateImage)(imageIdentifier, _objectSpread(_objectSpread({
|
|
3204
|
-
operations: operations
|
|
3205
|
-
}, imageDataPatch), {}, {
|
|
3206
|
-
incomplete: false
|
|
3207
|
-
}), immediateCommit));
|
|
3208
|
-
|
|
3209
|
-
if (immediateCommit) {
|
|
3210
|
-
this.updateDesignAreaImagesWithSelectedImageData(image.identifier);
|
|
3211
2668
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
2669
|
+
} else {
|
|
2670
|
+
operations.vectorizeColorsMap = vectorizeColorsMap;
|
|
2671
|
+
}
|
|
2672
|
+
case 40:
|
|
2673
|
+
_ServiceLocator.Services.store.dispatch((0, _Actions2.updateImage)(imageIdentifier, _objectSpread(_objectSpread({
|
|
2674
|
+
operations: operations
|
|
2675
|
+
}, imageDataPatch), {}, {
|
|
2676
|
+
incomplete: false
|
|
2677
|
+
}), immediateCommit));
|
|
2678
|
+
if (immediateCommit) {
|
|
2679
|
+
this.updateDesignAreaImagesWithSelectedImageData(image.identifier);
|
|
2680
|
+
}
|
|
2681
|
+
return _context35.abrupt("return", {
|
|
2682
|
+
vectorizeColorsMap: operations.vectorizeColorsMap,
|
|
2683
|
+
vectorizeThreshold: operations.vectorizeThreshold,
|
|
2684
|
+
vectorizeMaxColorAmount: operations.vectorizeMaxColorAmount,
|
|
2685
|
+
vectorizeOriginalColorsMap: operations.vectorizeOriginalColorsMap
|
|
2686
|
+
});
|
|
2687
|
+
case 43:
|
|
2688
|
+
case "end":
|
|
2689
|
+
return _context35.stop();
|
|
3224
2690
|
}
|
|
3225
|
-
},
|
|
2691
|
+
}, _callee34, this);
|
|
3226
2692
|
}));
|
|
3227
|
-
|
|
3228
2693
|
function editFile(_x38, _x39) {
|
|
3229
2694
|
return _editFile.apply(this, arguments);
|
|
3230
2695
|
}
|
|
3231
|
-
|
|
3232
2696
|
return editFile;
|
|
3233
2697
|
}()
|
|
3234
2698
|
}, {
|
|
3235
2699
|
key: "resetEditedFile",
|
|
3236
2700
|
value: function () {
|
|
3237
|
-
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/
|
|
2701
|
+
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(image) {
|
|
3238
2702
|
var state, _image, operations, vectorizeColorsMap, resetOperations, designProductionMethod;
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
return this.editFileQueued(resetOperations, image);
|
|
3267
|
-
|
|
3268
|
-
case 7:
|
|
3269
|
-
return _context35.abrupt("return", _context35.sent);
|
|
3270
|
-
|
|
3271
|
-
case 8:
|
|
3272
|
-
case "end":
|
|
3273
|
-
return _context35.stop();
|
|
3274
|
-
}
|
|
2703
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context36) {
|
|
2704
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2705
|
+
case 0:
|
|
2706
|
+
state = _ServiceLocator.Services.store.state;
|
|
2707
|
+
if (!image) {
|
|
2708
|
+
image = state.imageGallery.selectedImage;
|
|
2709
|
+
}
|
|
2710
|
+
_image = image, operations = _image.operations;
|
|
2711
|
+
vectorizeColorsMap = _extends({}, (_objectDestructuringEmpty(operations.vectorizeOriginalColorsMap), operations.vectorizeOriginalColorsMap));
|
|
2712
|
+
if (image.gallery) {
|
|
2713
|
+
resetOperations = _objectSpread(_objectSpread({}, operations), {}, {
|
|
2714
|
+
vectorizeColorsMap: vectorizeColorsMap
|
|
2715
|
+
});
|
|
2716
|
+
} else {
|
|
2717
|
+
designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(state);
|
|
2718
|
+
resetOperations = _objectSpread(_objectSpread({}, operations), !designProductionMethod.options.vectorsRequired ? (0, _Modifiers.removeVectorizeFromOperations)(operations) : {
|
|
2719
|
+
vectorizeColorsMap: vectorizeColorsMap,
|
|
2720
|
+
vectorizeThreshold: null
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
_context36.next = 7;
|
|
2724
|
+
return this.editFileQueued(resetOperations, image);
|
|
2725
|
+
case 7:
|
|
2726
|
+
return _context36.abrupt("return", _context36.sent);
|
|
2727
|
+
case 8:
|
|
2728
|
+
case "end":
|
|
2729
|
+
return _context36.stop();
|
|
3275
2730
|
}
|
|
3276
|
-
},
|
|
2731
|
+
}, _callee35, this);
|
|
3277
2732
|
}));
|
|
3278
|
-
|
|
3279
2733
|
function resetEditedFile(_x40) {
|
|
3280
2734
|
return _resetEditedFile.apply(this, arguments);
|
|
3281
2735
|
}
|
|
3282
|
-
|
|
3283
2736
|
return resetEditedFile;
|
|
3284
2737
|
}()
|
|
3285
2738
|
}, {
|
|
@@ -3291,18 +2744,12 @@ var DesignDataService = /*#__PURE__*/function () {
|
|
|
3291
2744
|
key: "clearSelectionOnCurrentDesignArea",
|
|
3292
2745
|
value: function clearSelectionOnCurrentDesignArea() {
|
|
3293
2746
|
var designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
3294
|
-
|
|
3295
2747
|
var canvas = this._getCanvas(designArea);
|
|
3296
|
-
|
|
3297
2748
|
if (canvas) {
|
|
3298
2749
|
canvas.clearSelection();
|
|
3299
2750
|
}
|
|
3300
2751
|
}
|
|
3301
2752
|
}]);
|
|
3302
|
-
|
|
3303
2753
|
return DesignDataService;
|
|
3304
2754
|
}();
|
|
3305
|
-
|
|
3306
|
-
exports["default"] = DesignDataService;
|
|
3307
|
-
|
|
3308
2755
|
_defineProperty(DesignDataService, "serviceName", 'DesignDataService');
|