@ggraphic/editor 0.0.0-stage → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/NOTICE +2 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES +7 -0
- package/dist/CanvasEditorProvider.d.ts +214 -0
- package/dist/CanvasEditorProvider.js +10 -0
- package/dist/ai/applyOperation.d.ts +75 -0
- package/dist/ai/applyOperation.js +354 -0
- package/dist/ai/describeCanvasElements.d.ts +17 -0
- package/dist/ai/describeCanvasElements.js +148 -0
- package/dist/ai/illustrationCapability.d.ts +6 -0
- package/dist/ai/illustrationCapability.js +20 -0
- package/dist/ai/types.d.ts +91 -0
- package/dist/ai/types.js +1 -0
- package/dist/blocks/liftedBlock.d.ts +61 -0
- package/dist/blocks/liftedBlock.js +117 -0
- package/dist/brand/bindPick.d.ts +18 -0
- package/dist/brand/bindPick.js +28 -0
- package/dist/brand/bindableFields.d.ts +9 -0
- package/dist/brand/bindableFields.js +61 -0
- package/dist/brand/brandRegistry.d.ts +26 -0
- package/dist/brand/brandRegistry.js +56 -0
- package/dist/brand/composerBrand.d.ts +146 -0
- package/dist/brand/composerBrand.js +6 -0
- package/dist/brand/documentBrand.d.ts +16 -0
- package/dist/brand/documentBrand.js +6 -0
- package/dist/collab/documentVersion.d.ts +36 -0
- package/dist/collab/documentVersion.js +139 -0
- package/dist/collab/pageElementStateKeys.d.ts +33 -0
- package/dist/collab/pageElementStateKeys.js +148 -0
- package/dist/collab/pagesDoc.d.ts +152 -0
- package/dist/collab/pagesDoc.js +434 -0
- package/dist/collab/useAwarenessState.d.ts +12 -0
- package/dist/collab/useAwarenessState.js +47 -0
- package/dist/collab/useEmitHostStateChanges.d.ts +18 -0
- package/dist/collab/useEmitHostStateChanges.js +40 -0
- package/dist/collab/useSelectionAwareness.d.ts +22 -0
- package/dist/collab/useSelectionAwareness.js +60 -0
- package/dist/collab/useYjsCanvasBinding.d.ts +7 -0
- package/dist/collab/useYjsCanvasBinding.js +21 -0
- package/dist/collab/useYjsPageStateSync.d.ts +20 -0
- package/dist/collab/useYjsPageStateSync.js +49 -0
- package/dist/collab/useYjsPages.d.ts +73 -0
- package/dist/collab/useYjsPages.js +396 -0
- package/dist/collab/wrapCallbacksWithPageSync.d.ts +3 -0
- package/dist/collab/wrapCallbacksWithPageSync.js +62 -0
- package/dist/collab/ydocKeys.d.ts +50 -0
- package/dist/collab/ydocKeys.js +50 -0
- package/dist/collab/yjsBinding.d.ts +27 -0
- package/dist/collab/yjsBinding.js +105 -0
- package/dist/common/Lightbox.d.ts +8 -0
- package/dist/common/Lightbox.js +8 -0
- package/dist/common/imageSourceTypes.d.ts +1 -0
- package/dist/common/imageSourceTypes.js +1 -0
- package/dist/components/AddPageButton.d.ts +13 -0
- package/dist/components/AddPageButton.js +13 -0
- package/dist/components/CanvasAnnouncer.d.ts +8 -0
- package/dist/components/CanvasAnnouncer.js +10 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.d.ts +12 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.js +145 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.d.ts +33 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.js +107 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.d.ts +68 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.js +203 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.d.ts +32 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.js +1144 -0
- package/dist/components/CanvasEditor/PageWrapper.d.ts +7 -0
- package/dist/components/CanvasEditor/PageWrapper.js +103 -0
- package/dist/components/CanvasEditor/autoSwitchTab.d.ts +11 -0
- package/dist/components/CanvasEditor/autoSwitchTab.js +15 -0
- package/dist/components/CanvasEditor/blockInsertContext.d.ts +22 -0
- package/dist/components/CanvasEditor/blockInsertContext.js +5 -0
- package/dist/components/CanvasEditor/editorShell.d.ts +99 -0
- package/dist/components/CanvasEditor/editorShell.js +20 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.d.ts +32 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.js +140 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.d.ts +13 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.js +29 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.d.ts +14 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.js +56 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.d.ts +18 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.js +36 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.d.ts +25 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.js +49 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.js +70 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.js +31 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.d.ts +75 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.js +69 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.d.ts +6 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.js +56 -0
- package/dist/components/CanvasEditor/layersTab.d.ts +13 -0
- package/dist/components/CanvasEditor/layersTab.js +27 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.d.ts +8 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.js +27 -0
- package/dist/components/CanvasEditor/types.d.ts +202 -0
- package/dist/components/CanvasEditor/types.js +1 -0
- package/dist/components/CanvasEditorSkeleton.d.ts +16 -0
- package/dist/components/CanvasEditorSkeleton.js +24 -0
- package/dist/components/CanvasMetaBar.d.ts +16 -0
- package/dist/components/CanvasMetaBar.js +33 -0
- package/dist/components/CanvasRenderLayer.d.ts +37 -0
- package/dist/components/CanvasRenderLayer.js +54 -0
- package/dist/components/CanvasTextOverlay.d.ts +126 -0
- package/dist/components/CanvasTextOverlay.js +527 -0
- package/dist/components/ConfigCanvas.d.ts +35 -0
- package/dist/components/ConfigCanvas.js +30 -0
- package/dist/components/CropGhostOverlay.d.ts +13 -0
- package/dist/components/CropGhostOverlay.js +56 -0
- package/dist/components/CustomColorSwatch.d.ts +35 -0
- package/dist/components/CustomColorSwatch.js +81 -0
- package/dist/components/DownloadNotice.d.ts +7 -0
- package/dist/components/DownloadNotice.js +7 -0
- package/dist/components/GenericCanvas.d.ts +309 -0
- package/dist/components/GenericCanvas.js +787 -0
- package/dist/components/GenericCanvasElement.d.ts +34 -0
- package/dist/components/GenericCanvasElement.js +267 -0
- package/dist/components/MultiSelectionTransformer.d.ts +39 -0
- package/dist/components/MultiSelectionTransformer.js +107 -0
- package/dist/components/PagePreview.d.ts +14 -0
- package/dist/components/PagePreview.js +63 -0
- package/dist/components/PageThumbnailStrip.d.ts +25 -0
- package/dist/components/PageThumbnailStrip.js +46 -0
- package/dist/components/PageToolbar.d.ts +12 -0
- package/dist/components/PageToolbar.js +20 -0
- package/dist/components/PrintGuides.d.ts +13 -0
- package/dist/components/PrintGuides.js +28 -0
- package/dist/components/RemoteSelectionOverlay.d.ts +15 -0
- package/dist/components/RemoteSelectionOverlay.js +29 -0
- package/dist/components/RichTextField.d.ts +34 -0
- package/dist/components/RichTextField.js +216 -0
- package/dist/components/SelectionPill.d.ts +56 -0
- package/dist/components/SelectionPill.js +123 -0
- package/dist/components/SlideNotesPanel.d.ts +13 -0
- package/dist/components/SlideNotesPanel.js +28 -0
- package/dist/components/SlotBudgetStatus.d.ts +12 -0
- package/dist/components/SlotBudgetStatus.js +64 -0
- package/dist/components/StandaloneCanvas.d.ts +33 -0
- package/dist/components/StandaloneCanvas.js +61 -0
- package/dist/components/TextFormatButtons.d.ts +61 -0
- package/dist/components/TextFormatButtons.js +107 -0
- package/dist/components/TextFormatControls.d.ts +26 -0
- package/dist/components/TextFormatControls.js +73 -0
- package/dist/components/Toolbar.d.ts +40 -0
- package/dist/components/Toolbar.js +26 -0
- package/dist/components/ToolbarStateBridge.d.ts +72 -0
- package/dist/components/ToolbarStateBridge.js +298 -0
- package/dist/components/TopBar/AutoSaveIndicator.d.ts +8 -0
- package/dist/components/TopBar/AutoSaveIndicator.js +44 -0
- package/dist/components/TopBar/ContextControls.d.ts +107 -0
- package/dist/components/TopBar/ContextControls.js +321 -0
- package/dist/components/TopBar/ContextToolbar.d.ts +14 -0
- package/dist/components/TopBar/ContextToolbar.js +20 -0
- package/dist/components/TopBar/CropModeControls.d.ts +35 -0
- package/dist/components/TopBar/CropModeControls.js +84 -0
- package/dist/components/TopBar/DownloadSection.d.ts +47 -0
- package/dist/components/TopBar/DownloadSection.js +102 -0
- package/dist/components/TopBar/MobileSelectionBar.d.ts +16 -0
- package/dist/components/TopBar/MobileSelectionBar.js +26 -0
- package/dist/components/TopBar/MobileSelectionControls.d.ts +10 -0
- package/dist/components/TopBar/MobileSelectionControls.js +43 -0
- package/dist/components/TopBar/MultiSelectionToolbar.d.ts +19 -0
- package/dist/components/TopBar/MultiSelectionToolbar.js +30 -0
- package/dist/components/TopBar/ShareDropdown.d.ts +54 -0
- package/dist/components/TopBar/ShareDropdown.js +110 -0
- package/dist/components/TopBar/TopBar.d.ts +6 -0
- package/dist/components/TopBar/TopBar.js +6 -0
- package/dist/components/TopBar/barTiles.d.ts +15 -0
- package/dist/components/TopBar/barTiles.js +34 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.d.ts +28 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.js +26 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.js +133 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.d.ts +16 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.js +89 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.d.ts +17 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.js +37 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.d.ts +7 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +22 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.js +19 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.js +15 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.js +9 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.js +19 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.js +74 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.js +27 -0
- package/dist/components/TransformHud.d.ts +11 -0
- package/dist/components/TransformHud.js +121 -0
- package/dist/components/WholeTextFormatControls.d.ts +10 -0
- package/dist/components/WholeTextFormatControls.js +37 -0
- package/dist/components/ZoomableViewport.d.ts +6 -0
- package/dist/components/ZoomableViewport.js +4 -0
- package/dist/components/accentMark.d.ts +20 -0
- package/dist/components/accentMark.js +24 -0
- package/dist/components/canvasItemLock.d.ts +13 -0
- package/dist/components/canvasItemLock.js +12 -0
- package/dist/components/kindRenderers.d.ts +118 -0
- package/dist/components/kindRenderers.js +151 -0
- package/dist/components/markColor.d.ts +13 -0
- package/dist/components/markColor.js +21 -0
- package/dist/components/markerMark.d.ts +24 -0
- package/dist/components/markerMark.js +22 -0
- package/dist/composer/cardFollowsText.d.ts +17 -0
- package/dist/composer/cardFollowsText.js +34 -0
- package/dist/composer/marks.d.ts +4 -0
- package/dist/composer/marks.js +15 -0
- package/dist/composer/steckbriefLayout.d.ts +147 -0
- package/dist/composer/steckbriefLayout.js +468 -0
- package/dist/composer/textFit.d.ts +31 -0
- package/dist/composer/textFit.js +89 -0
- package/dist/configs/buildSharepicText.d.ts +5 -0
- package/dist/configs/buildSharepicText.js +58 -0
- package/dist/configs/configLoader.d.ts +34 -0
- package/dist/configs/configLoader.js +60 -0
- package/dist/configs/factory/actionFactories.d.ts +201 -0
- package/dist/configs/factory/actionFactories.js +628 -0
- package/dist/configs/factory/baseTypes.d.ts +150 -0
- package/dist/configs/factory/baseTypes.js +8 -0
- package/dist/configs/factory/carryInstanceState.d.ts +82 -0
- package/dist/configs/factory/carryInstanceState.js +121 -0
- package/dist/configs/factory/createTextElement.d.ts +63 -0
- package/dist/configs/factory/createTextElement.js +63 -0
- package/dist/configs/factory/defineSection.d.ts +45 -0
- package/dist/configs/factory/defineSection.js +45 -0
- package/dist/configs/factory/layoutAccessors.d.ts +15 -0
- package/dist/configs/factory/layoutAccessors.js +20 -0
- package/dist/configs/featureInjector.d.ts +40 -0
- package/dist/configs/featureInjector.js +184 -0
- package/dist/configs/pageInheritance.d.ts +8 -0
- package/dist/configs/pageInheritance.js +82 -0
- package/dist/configs/placeholders.d.ts +14 -0
- package/dist/configs/placeholders.js +33 -0
- package/dist/configs/shareSection.d.ts +11 -0
- package/dist/configs/shareSection.js +65 -0
- package/dist/configs/types.d.ts +431 -0
- package/dist/configs/types.js +1 -0
- package/dist/configs/unifiedTabs.d.ts +26 -0
- package/dist/configs/unifiedTabs.js +6 -0
- package/dist/editorSeamTypes.d.ts +41 -0
- package/dist/editorSeamTypes.js +1 -0
- package/dist/export/pptx/buildPptxModel.d.ts +47 -0
- package/dist/export/pptx/buildPptxModel.js +612 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +26 -0
- package/dist/export/pptx/exportPptxDeck.js +80 -0
- package/dist/export/pptx/pptxFonts.d.ts +26 -0
- package/dist/export/pptx/pptxFonts.js +41 -0
- package/dist/export/pptx/pptxUnits.d.ts +27 -0
- package/dist/export/pptx/pptxUnits.js +54 -0
- package/dist/export/pptx/textModel.d.ts +17 -0
- package/dist/export/pptx/textModel.js +118 -0
- package/dist/export/pptx/types.d.ts +161 -0
- package/dist/export/pptx/types.js +11 -0
- package/dist/export/pptx/writePptx.d.ts +40 -0
- package/dist/export/pptx/writePptx.js +206 -0
- package/dist/export/pptx/writeText.d.ts +19 -0
- package/dist/export/pptx/writeText.js +120 -0
- package/dist/export/printExport.d.ts +42 -0
- package/dist/export/printExport.js +94 -0
- package/dist/export/printPdf.d.ts +103 -0
- package/dist/export/printPdf.js +144 -0
- package/dist/export/slidesPdf.d.ts +9 -0
- package/dist/export/slidesPdf.js +31 -0
- package/dist/formats/index.d.ts +115 -0
- package/dist/formats/index.js +287 -0
- package/dist/groups/pageGroups.d.ts +32 -0
- package/dist/groups/pageGroups.js +91 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAiImageGeneration.d.ts +15 -0
- package/dist/hooks/useAiImageGeneration.js +73 -0
- package/dist/hooks/useAnnounce.d.ts +27 -0
- package/dist/hooks/useAnnounce.js +47 -0
- package/dist/hooks/useBoxSnap.d.ts +37 -0
- package/dist/hooks/useBoxSnap.js +49 -0
- package/dist/hooks/useCanvasAutoSave.d.ts +33 -0
- package/dist/hooks/useCanvasAutoSave.js +259 -0
- package/dist/hooks/useCanvasElementHandlers.d.ts +182 -0
- package/dist/hooks/useCanvasElementHandlers.js +326 -0
- package/dist/hooks/useCanvasHistorySetup.d.ts +37 -0
- package/dist/hooks/useCanvasHistorySetup.js +113 -0
- package/dist/hooks/useCanvasInteractions.d.ts +31 -0
- package/dist/hooks/useCanvasInteractions.js +103 -0
- package/dist/hooks/useCanvasKeyboardHandlers.d.ts +37 -0
- package/dist/hooks/useCanvasKeyboardHandlers.js +280 -0
- package/dist/hooks/useCanvasStoreReset.d.ts +25 -0
- package/dist/hooks/useCanvasStoreReset.js +35 -0
- package/dist/hooks/useCanvasUndoRedo.d.ts +34 -0
- package/dist/hooks/useCanvasUndoRedo.js +213 -0
- package/dist/hooks/useContextPress.d.ts +14 -0
- package/dist/hooks/useContextPress.js +45 -0
- package/dist/hooks/useCropSession.d.ts +23 -0
- package/dist/hooks/useCropSession.js +69 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +14 -0
- package/dist/hooks/useDeckAutoSave.d.ts +30 -0
- package/dist/hooks/useDeckAutoSave.js +234 -0
- package/dist/hooks/useDeepSelect.d.ts +18 -0
- package/dist/hooks/useDeepSelect.js +135 -0
- package/dist/hooks/useElementSnapping.d.ts +13 -0
- package/dist/hooks/useElementSnapping.js +26 -0
- package/dist/hooks/useEmojiCatalog.d.ts +3 -0
- package/dist/hooks/useEmojiCatalog.js +13 -0
- package/dist/hooks/useFloatingModuleHandlers.d.ts +52 -0
- package/dist/hooks/useFloatingModuleHandlers.js +285 -0
- package/dist/hooks/useFloatingModuleState.d.ts +83 -0
- package/dist/hooks/useFloatingModuleState.js +250 -0
- package/dist/hooks/useFontGeneration.d.ts +10 -0
- package/dist/hooks/useFontGeneration.js +77 -0
- package/dist/hooks/useFontLoader.d.ts +53 -0
- package/dist/hooks/useFontLoader.js +129 -0
- package/dist/hooks/useGeometryReporter.d.ts +19 -0
- package/dist/hooks/useGeometryReporter.js +41 -0
- package/dist/hooks/useHoverOutline.d.ts +8 -0
- package/dist/hooks/useHoverOutline.js +78 -0
- package/dist/hooks/useIconCatalog.d.ts +12 -0
- package/dist/hooks/useIconCatalog.js +30 -0
- package/dist/hooks/useIconSearch.d.ts +2 -0
- package/dist/hooks/useIconSearch.js +14 -0
- package/dist/hooks/useIconSetsFor.d.ts +8 -0
- package/dist/hooks/useIconSetsFor.js +30 -0
- package/dist/hooks/useImageCoverFit.d.ts +17 -0
- package/dist/hooks/useImageCoverFit.js +35 -0
- package/dist/hooks/useIsCanvasMobile.d.ts +3 -0
- package/dist/hooks/useIsCanvasMobile.js +19 -0
- package/dist/hooks/useMarqueeSelection.d.ts +27 -0
- package/dist/hooks/useMarqueeSelection.js +140 -0
- package/dist/hooks/useMobileSheet.d.ts +48 -0
- package/dist/hooks/useMobileSheet.js +282 -0
- package/dist/hooks/useMultiPageExport.d.ts +30 -0
- package/dist/hooks/useMultiPageExport.js +117 -0
- package/dist/hooks/usePageManager.d.ts +132 -0
- package/dist/hooks/usePageManager.js +399 -0
- package/dist/hooks/usePageThumbnails.d.ts +10 -0
- package/dist/hooks/usePageThumbnails.js +122 -0
- package/dist/hooks/usePaginatedIcons.d.ts +11 -0
- package/dist/hooks/usePaginatedIcons.js +46 -0
- package/dist/hooks/useRovingToolbar.d.ts +17 -0
- package/dist/hooks/useRovingToolbar.js +76 -0
- package/dist/hooks/useSelectionAnnouncement.d.ts +13 -0
- package/dist/hooks/useSelectionAnnouncement.js +68 -0
- package/dist/hooks/useSnapScheduler.d.ts +20 -0
- package/dist/hooks/useSnapScheduler.js +61 -0
- package/dist/hooks/useTrackUnsplashDownload.d.ts +6 -0
- package/dist/hooks/useTrackUnsplashDownload.js +19 -0
- package/dist/hooks/useZoomGestures.d.ts +35 -0
- package/dist/hooks/useZoomGestures.js +185 -0
- package/dist/hostServices.d.ts +308 -0
- package/dist/hostServices.js +107 -0
- package/dist/i18n/de.d.ts +897 -0
- package/dist/i18n/de.js +961 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +949 -0
- package/dist/i18n/messages.d.ts +28 -0
- package/dist/i18n/messages.js +66 -0
- package/dist/layouts/CanvasEditorLayout.d.ts +28 -0
- package/dist/layouts/CanvasEditorLayout.js +56 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.js +2 -0
- package/dist/primitives/AssetPrimitive.d.ts +24 -0
- package/dist/primitives/AssetPrimitive.js +158 -0
- package/dist/primitives/CanvasBackground.d.ts +33 -0
- package/dist/primitives/CanvasBackground.js +44 -0
- package/dist/primitives/CanvasIcons.d.ts +19 -0
- package/dist/primitives/CanvasIcons.js +46 -0
- package/dist/primitives/CanvasImage.d.ts +73 -0
- package/dist/primitives/CanvasImage.js +460 -0
- package/dist/primitives/CanvasRichText.d.ts +25 -0
- package/dist/primitives/CanvasRichText.js +284 -0
- package/dist/primitives/CanvasStage.d.ts +84 -0
- package/dist/primitives/CanvasStage.js +292 -0
- package/dist/primitives/CanvasText.d.ts +91 -0
- package/dist/primitives/CanvasText.js +293 -0
- package/dist/primitives/ChartPrimitive.d.ts +24 -0
- package/dist/primitives/ChartPrimitive.js +318 -0
- package/dist/primitives/CircleBadge.d.ts +43 -0
- package/dist/primitives/CircleBadge.js +233 -0
- package/dist/primitives/FramePrimitive.d.ts +14 -0
- package/dist/primitives/FramePrimitive.js +406 -0
- package/dist/primitives/IconPrimitive.d.ts +28 -0
- package/dist/primitives/IconPrimitive.js +119 -0
- package/dist/primitives/IllustrationPrimitive.d.ts +16 -0
- package/dist/primitives/IllustrationPrimitive.js +184 -0
- package/dist/primitives/PillBadge.d.ts +45 -0
- package/dist/primitives/PillBadge.js +237 -0
- package/dist/primitives/ShapePrimitive.d.ts +12 -0
- package/dist/primitives/ShapePrimitive.js +521 -0
- package/dist/primitives/SnapGuidelines.d.ts +19 -0
- package/dist/primitives/SnapGuidelines.js +34 -0
- package/dist/primitives/UserImagePrimitive.d.ts +30 -0
- package/dist/primitives/UserImagePrimitive.js +496 -0
- package/dist/primitives/index.d.ts +18 -0
- package/dist/primitives/index.js +11 -0
- package/dist/sidebar/SidebarPanel.d.ts +8 -0
- package/dist/sidebar/SidebarPanel.js +219 -0
- package/dist/sidebar/SidebarTabBar.d.ts +2 -0
- package/dist/sidebar/SidebarTabBar.js +31 -0
- package/dist/sidebar/SubsectionTabBar.d.ts +13 -0
- package/dist/sidebar/SubsectionTabBar.js +30 -0
- package/dist/sidebar/UserUploadsProvider.d.ts +31 -0
- package/dist/sidebar/UserUploadsProvider.js +139 -0
- package/dist/sidebar/components/AltTextField.d.ts +21 -0
- package/dist/sidebar/components/AltTextField.js +60 -0
- package/dist/sidebar/components/SidebarHint.d.ts +7 -0
- package/dist/sidebar/components/SidebarHint.js +38 -0
- package/dist/sidebar/components/SidebarSlider.d.ts +16 -0
- package/dist/sidebar/components/SidebarSlider.js +9 -0
- package/dist/sidebar/components/TextFieldPrimitives.d.ts +26 -0
- package/dist/sidebar/components/TextFieldPrimitives.js +56 -0
- package/dist/sidebar/sections/ChartSettingsSection.d.ts +9 -0
- package/dist/sidebar/sections/ChartSettingsSection.js +78 -0
- package/dist/sidebar/sections/CombinedTextSection.d.ts +16 -0
- package/dist/sidebar/sections/CombinedTextSection.js +43 -0
- package/dist/sidebar/sections/DiagrammeSection.d.ts +9 -0
- package/dist/sidebar/sections/DiagrammeSection.js +40 -0
- package/dist/sidebar/sections/EffectsSection.d.ts +20 -0
- package/dist/sidebar/sections/EffectsSection.js +23 -0
- package/dist/sidebar/sections/FormenSection.d.ts +28 -0
- package/dist/sidebar/sections/FormenSection.js +440 -0
- package/dist/sidebar/sections/FrameSettingsSection.d.ts +8 -0
- package/dist/sidebar/sections/FrameSettingsSection.js +26 -0
- package/dist/sidebar/sections/GenericShareSection.d.ts +26 -0
- package/dist/sidebar/sections/GenericShareSection.js +262 -0
- package/dist/sidebar/sections/IconsSection.d.ts +8 -0
- package/dist/sidebar/sections/IconsSection.js +55 -0
- package/dist/sidebar/sections/IllustrationSettings.d.ts +9 -0
- package/dist/sidebar/sections/IllustrationSettings.js +33 -0
- package/dist/sidebar/sections/IllustrationThumb.d.ts +7 -0
- package/dist/sidebar/sections/IllustrationThumb.js +15 -0
- package/dist/sidebar/sections/ImageAdjustSection.d.ts +13 -0
- package/dist/sidebar/sections/ImageAdjustSection.js +85 -0
- package/dist/sidebar/sections/LayersSection.d.ts +25 -0
- package/dist/sidebar/sections/LayersSection.js +155 -0
- package/dist/sidebar/sections/RahmenSection.d.ts +7 -0
- package/dist/sidebar/sections/RahmenSection.js +18 -0
- package/dist/sidebar/sections/StudioGallery.d.ts +33 -0
- package/dist/sidebar/sections/StudioGallery.js +58 -0
- package/dist/sidebar/sections/UploadsSection.d.ts +11 -0
- package/dist/sidebar/sections/UploadsSection.js +130 -0
- package/dist/sidebar/sections/assets/AssetsSection.d.ts +59 -0
- package/dist/sidebar/sections/assets/AssetsSection.js +27 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.d.ts +9 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.js +49 -0
- package/dist/sidebar/sections/assets/CategoryCard.d.ts +14 -0
- package/dist/sidebar/sections/assets/CategoryCard.js +15 -0
- package/dist/sidebar/sections/assets/ElementGrid.d.ts +14 -0
- package/dist/sidebar/sections/assets/ElementGrid.js +34 -0
- package/dist/sidebar/sections/assets/ElementThumb.d.ts +10 -0
- package/dist/sidebar/sections/assets/ElementThumb.js +61 -0
- package/dist/sidebar/sections/assets/ElementTile.d.ts +32 -0
- package/dist/sidebar/sections/assets/ElementTile.js +60 -0
- package/dist/sidebar/sections/assets/ElementsPanel.d.ts +7 -0
- package/dist/sidebar/sections/assets/ElementsPanel.js +249 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.d.ts +8 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.js +26 -0
- package/dist/sidebar/sections/assets/FotosCatalog.d.ts +12 -0
- package/dist/sidebar/sections/assets/FotosCatalog.js +41 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.js +133 -0
- package/dist/sidebar/sections/assets/RecentCarousel.d.ts +7 -0
- package/dist/sidebar/sections/assets/RecentCarousel.js +42 -0
- package/dist/sidebar/sections/assets/StickerCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/StickerCatalog.js +49 -0
- package/dist/sidebar/sections/assets/constants.d.ts +4 -0
- package/dist/sidebar/sections/assets/constants.js +15 -0
- package/dist/sidebar/sections/assets/elementPanelHost.d.ts +45 -0
- package/dist/sidebar/sections/assets/elementPanelHost.js +1 -0
- package/dist/sidebar/sections/assets/elementSearch.d.ts +10 -0
- package/dist/sidebar/sections/assets/elementSearch.js +38 -0
- package/dist/sidebar/sections/assets/elementTypes.d.ts +67 -0
- package/dist/sidebar/sections/assets/elementTypes.js +24 -0
- package/dist/sidebar/sections/assets/index.d.ts +3 -0
- package/dist/sidebar/sections/assets/index.js +3 -0
- package/dist/sidebar/sections/assets/useElementCatalog.d.ts +43 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +386 -0
- package/dist/sidebar/sections/assets/useRecentElements.d.ts +21 -0
- package/dist/sidebar/sections/assets/useRecentElements.js +67 -0
- package/dist/sidebar/sections/assets/useStockPhotos.d.ts +22 -0
- package/dist/sidebar/sections/assets/useStockPhotos.js +96 -0
- package/dist/sidebar/sections/effects/EffectCard.d.ts +11 -0
- package/dist/sidebar/sections/effects/EffectCard.js +14 -0
- package/dist/sidebar/sections/effects/GradientSettings.d.ts +10 -0
- package/dist/sidebar/sections/effects/GradientSettings.js +34 -0
- package/dist/sidebar/sections/effects/OutlineSettings.d.ts +12 -0
- package/dist/sidebar/sections/effects/OutlineSettings.js +29 -0
- package/dist/sidebar/sections/effects/ShadowSettings.d.ts +13 -0
- package/dist/sidebar/sections/effects/ShadowSettings.js +38 -0
- package/dist/sidebar/sections/effects/effectsFor.d.ts +16 -0
- package/dist/sidebar/sections/effects/effectsFor.js +24 -0
- package/dist/sidebar/sections/index.d.ts +28 -0
- package/dist/sidebar/sections/index.js +36 -0
- package/dist/sidebar/sections/lazyWithPreload.d.ts +11 -0
- package/dist/sidebar/sections/lazyWithPreload.js +29 -0
- package/dist/sidebar/sections/tools/AiCreateTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiCreateTool.js +58 -0
- package/dist/sidebar/sections/tools/AiEditTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiEditTool.js +57 -0
- package/dist/sidebar/sections/tools/AltTextTool.d.ts +11 -0
- package/dist/sidebar/sections/tools/AltTextTool.js +78 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.js +90 -0
- package/dist/sidebar/sections/tools/GradientTextTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/GradientTextTool.js +104 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.d.ts +7 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.js +68 -0
- package/dist/sidebar/sections/tools/QRCodeTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/QRCodeTool.js +63 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.js +52 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.js +125 -0
- package/dist/sidebar/sections/tools/ToolPanel.d.ts +26 -0
- package/dist/sidebar/sections/tools/ToolPanel.js +13 -0
- package/dist/sidebar/sections/tools/ToolTiles.d.ts +5 -0
- package/dist/sidebar/sections/tools/ToolTiles.js +76 -0
- package/dist/sidebar/sections/tools/ToolsSection.d.ts +15 -0
- package/dist/sidebar/sections/tools/ToolsSection.js +151 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.d.ts +8 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.js +22 -0
- package/dist/sidebar/sections/tools/UnsplashTool.d.ts +10 -0
- package/dist/sidebar/sections/tools/UnsplashTool.js +47 -0
- package/dist/sidebar/sections/tools/index.d.ts +1 -0
- package/dist/sidebar/sections/tools/index.js +2 -0
- package/dist/sidebar/sections/tools/toolTiles.css +335 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.d.ts +19 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.js +23 -0
- package/dist/sidebar/sections/whenIdle.d.ts +2 -0
- package/dist/sidebar/sections/whenIdle.js +10 -0
- package/dist/sidebar/sidebarStyles.d.ts +60 -0
- package/dist/sidebar/sidebarStyles.js +61 -0
- package/dist/sidebar/tabTypes.d.ts +27 -0
- package/dist/sidebar/tabTypes.js +1 -0
- package/dist/sidebar/types.d.ts +43 -0
- package/dist/sidebar/types.js +1 -0
- package/dist/sidebar/useImagePlacement.d.ts +17 -0
- package/dist/sidebar/useImagePlacement.js +28 -0
- package/dist/stores/AutoSaveStoreProvider.d.ts +28 -0
- package/dist/stores/AutoSaveStoreProvider.js +45 -0
- package/dist/stores/CanvasStoreProvider.d.ts +43 -0
- package/dist/stores/CanvasStoreProvider.js +74 -0
- package/dist/stores/createAutoSaveStore.d.ts +50 -0
- package/dist/stores/createAutoSaveStore.js +42 -0
- package/dist/stores/createCanvasEditorStore.d.ts +126 -0
- package/dist/stores/createCanvasEditorStore.js +266 -0
- package/dist/stores/useAutoSaveStore.d.ts +12 -0
- package/dist/stores/useAutoSaveStore.js +12 -0
- package/dist/styles/editor.css +445 -0
- package/dist/styles/index.css +4 -0
- package/dist/styles/tailwind.css +239 -0
- package/dist/styles/tokens.css +199 -0
- package/dist/templates/fontWidths.generated.d.ts +1 -0
- package/dist/templates/fontWidths.generated.js +17 -0
- package/dist/templates/registry.d.ts +59 -0
- package/dist/templates/registry.js +40 -0
- package/dist/templates/templateGeometry.d.ts +32 -0
- package/dist/templates/templateGeometry.js +887 -0
- package/dist/templates/testKinds.d.ts +15 -0
- package/dist/templates/testKinds.js +151 -0
- package/dist/testing/documentBrandConfig.d.ts +14 -0
- package/dist/testing/documentBrandConfig.js +60 -0
- package/dist/testing/documentBrandPacks.d.ts +10 -0
- package/dist/testing/documentBrandPacks.js +45 -0
- package/dist/testing/fixtureTemplates.d.ts +13 -0
- package/dist/testing/fixtureTemplates.js +376 -0
- package/dist/testing/stampKind.d.ts +91 -0
- package/dist/testing/stampKind.js +56 -0
- package/dist/types/editorTypes.d.ts +65 -0
- package/dist/types/editorTypes.js +21 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +42 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +29 -0
- package/dist/ui/dialog.d.ts +15 -0
- package/dist/ui/dialog.js +53 -0
- package/dist/ui/icon-button.d.ts +18 -0
- package/dist/ui/icon-button.js +54 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/masonry-grid.d.ts +11 -0
- package/dist/ui/masonry-grid.js +43 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +26 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +38 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils/__snapshots__/kindSelection.vitest.ts.snap +1086 -0
- package/dist/utils/alignment.d.ts +21 -0
- package/dist/utils/alignment.js +54 -0
- package/dist/utils/axisLock.d.ts +30 -0
- package/dist/utils/axisLock.js +78 -0
- package/dist/utils/backgroundPhotoCrop.d.ts +28 -0
- package/dist/utils/backgroundPhotoCrop.js +28 -0
- package/dist/utils/canvasAssets.d.ts +140 -0
- package/dist/utils/canvasAssets.js +121 -0
- package/dist/utils/canvasClipboard.d.ts +51 -0
- package/dist/utils/canvasClipboard.js +37 -0
- package/dist/utils/canvasCommandRegistry.d.ts +207 -0
- package/dist/utils/canvasCommandRegistry.js +124 -0
- package/dist/utils/canvasCommands.d.ts +106 -0
- package/dist/utils/canvasCommands.js +564 -0
- package/dist/utils/canvasFontFamilies.d.ts +12 -0
- package/dist/utils/canvasFontFamilies.js +24 -0
- package/dist/utils/canvasIcons.d.ts +68 -0
- package/dist/utils/canvasIcons.js +293 -0
- package/dist/utils/canvasImageSource.d.ts +12 -0
- package/dist/utils/canvasImageSource.js +19 -0
- package/dist/utils/canvasItem.d.ts +102 -0
- package/dist/utils/canvasItem.js +1 -0
- package/dist/utils/canvasLayerManager.d.ts +51 -0
- package/dist/utils/canvasLayerManager.js +107 -0
- package/dist/utils/canvasValueResolver.d.ts +9 -0
- package/dist/utils/canvasValueResolver.js +13 -0
- package/dist/utils/captureStage.d.ts +59 -0
- package/dist/utils/captureStage.js +152 -0
- package/dist/utils/chartTypes.d.ts +6 -0
- package/dist/utils/chartTypes.js +2 -0
- package/dist/utils/chartUtils.d.ts +49 -0
- package/dist/utils/chartUtils.js +191 -0
- package/dist/utils/circleBadgeUtils.d.ts +30 -0
- package/dist/utils/circleBadgeUtils.js +85 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +66 -0
- package/dist/utils/collectAltTextPages.d.ts +6 -0
- package/dist/utils/collectAltTextPages.js +20 -0
- package/dist/utils/colorLuminance.d.ts +3 -0
- package/dist/utils/colorLuminance.js +14 -0
- package/dist/utils/colorNames.d.ts +7 -0
- package/dist/utils/colorNames.js +17 -0
- package/dist/utils/colorOptions.d.ts +20 -0
- package/dist/utils/colorOptions.js +20 -0
- package/dist/utils/cornerRadius.d.ts +14 -0
- package/dist/utils/cornerRadius.js +27 -0
- package/dist/utils/cornerReservation.d.ts +19 -0
- package/dist/utils/cornerReservation.js +7 -0
- package/dist/utils/coverFit.d.ts +117 -0
- package/dist/utils/coverFit.js +207 -0
- package/dist/utils/cropAspect.d.ts +47 -0
- package/dist/utils/cropAspect.js +53 -0
- package/dist/utils/cropGhost.d.ts +63 -0
- package/dist/utils/cropGhost.js +216 -0
- package/dist/utils/cropSession.d.ts +23 -0
- package/dist/utils/cropSession.js +92 -0
- package/dist/utils/cropTarget.d.ts +22 -0
- package/dist/utils/cropTarget.js +33 -0
- package/dist/utils/deepSelect.d.ts +43 -0
- package/dist/utils/deepSelect.js +74 -0
- package/dist/utils/downloadError.d.ts +2 -0
- package/dist/utils/downloadError.js +13 -0
- package/dist/utils/duplicateElement.d.ts +127 -0
- package/dist/utils/duplicateElement.js +235 -0
- package/dist/utils/editorFocus.d.ts +36 -0
- package/dist/utils/editorFocus.js +67 -0
- package/dist/utils/editorToast.d.ts +21 -0
- package/dist/utils/editorToast.js +7 -0
- package/dist/utils/elementKinds.d.ts +212 -0
- package/dist/utils/elementKinds.js +137 -0
- package/dist/utils/emoji/emojiCatalog.d.ts +12 -0
- package/dist/utils/emoji/emojiCatalog.en.json +9997 -0
- package/dist/utils/emoji/emojiCatalog.js +53 -0
- package/dist/utils/emoji/emojiCatalog.json +9913 -0
- package/dist/utils/ensureFontsReady.d.ts +12 -0
- package/dist/utils/ensureFontsReady.js +23 -0
- package/dist/utils/expandImage.d.ts +17 -0
- package/dist/utils/expandImage.js +76 -0
- package/dist/utils/externalIcons.d.ts +67 -0
- package/dist/utils/externalIcons.js +168 -0
- package/dist/utils/filterCache.d.ts +16 -0
- package/dist/utils/filterCache.js +31 -0
- package/dist/utils/filterUtils.d.ts +2 -0
- package/dist/utils/filterUtils.js +89 -0
- package/dist/utils/followStage.d.ts +2 -0
- package/dist/utils/followStage.js +48 -0
- package/dist/utils/fontAliases.d.ts +14 -0
- package/dist/utils/fontAliases.js +32 -0
- package/dist/utils/fontMarkSupport.d.ts +26 -0
- package/dist/utils/fontMarkSupport.js +32 -0
- package/dist/utils/frameUtils.d.ts +20 -0
- package/dist/utils/frameUtils.js +283 -0
- package/dist/utils/gradientFill.d.ts +55 -0
- package/dist/utils/gradientFill.js +57 -0
- package/dist/utils/gradientHitArea.d.ts +22 -0
- package/dist/utils/gradientHitArea.js +94 -0
- package/dist/utils/grain.d.ts +29 -0
- package/dist/utils/grain.js +103 -0
- package/dist/utils/grainSpec.d.ts +2 -0
- package/dist/utils/grainSpec.js +3 -0
- package/dist/utils/groupSnap.d.ts +27 -0
- package/dist/utils/groupSnap.js +54 -0
- package/dist/utils/handDrawn.d.ts +92 -0
- package/dist/utils/handDrawn.js +523 -0
- package/dist/utils/historyStamp.d.ts +22 -0
- package/dist/utils/historyStamp.js +31 -0
- package/dist/utils/hostStorageKeys.d.ts +16 -0
- package/dist/utils/hostStorageKeys.js +27 -0
- package/dist/utils/iconInstances.d.ts +80 -0
- package/dist/utils/iconInstances.js +109 -0
- package/dist/utils/illustrations/gophers.d.ts +11 -0
- package/dist/utils/illustrations/gophers.js +1236 -0
- package/dist/utils/illustrations/humaaans.d.ts +8 -0
- package/dist/utils/illustrations/humaaans.js +265 -0
- package/dist/utils/illustrations/illlustrations.d.ts +11 -0
- package/dist/utils/illustrations/illlustrations.js +929 -0
- package/dist/utils/illustrations/kawaii.d.ts +6 -0
- package/dist/utils/illustrations/kawaii.js +73 -0
- package/dist/utils/illustrations/opendoodles.d.ts +6 -0
- package/dist/utils/illustrations/opendoodles.js +271 -0
- package/dist/utils/illustrations/openpeeps.d.ts +9 -0
- package/dist/utils/illustrations/openpeeps.js +1522 -0
- package/dist/utils/illustrations/prefetchAnalytics.d.ts +78 -0
- package/dist/utils/illustrations/prefetchAnalytics.js +162 -0
- package/dist/utils/illustrations/registry.d.ts +27 -0
- package/dist/utils/illustrations/registry.js +106 -0
- package/dist/utils/illustrations/svgCache.d.ts +60 -0
- package/dist/utils/illustrations/svgCache.js +349 -0
- package/dist/utils/illustrations/transhumans.d.ts +8 -0
- package/dist/utils/illustrations/transhumans.js +313 -0
- package/dist/utils/illustrations/types.d.ts +25 -0
- package/dist/utils/illustrations/types.js +45 -0
- package/dist/utils/imageElementComparison.d.ts +19 -0
- package/dist/utils/imageElementComparison.js +121 -0
- package/dist/utils/imageFilters.d.ts +94 -0
- package/dist/utils/imageFilters.js +304 -0
- package/dist/utils/imageLook.d.ts +18 -0
- package/dist/utils/imageLook.js +41 -0
- package/dist/utils/keyboardCrop.d.ts +25 -0
- package/dist/utils/keyboardCrop.js +98 -0
- package/dist/utils/keyboardOwnership.d.ts +30 -0
- package/dist/utils/keyboardOwnership.js +93 -0
- package/dist/utils/layerLabels.d.ts +39 -0
- package/dist/utils/layerLabels.js +181 -0
- package/dist/utils/layerLock.d.ts +24 -0
- package/dist/utils/layerLock.js +52 -0
- package/dist/utils/layerSelection.d.ts +24 -0
- package/dist/utils/layerSelection.js +16 -0
- package/dist/utils/markerBoxes.d.ts +38 -0
- package/dist/utils/markerBoxes.js +60 -0
- package/dist/utils/markerColors.d.ts +16 -0
- package/dist/utils/markerColors.js +32 -0
- package/dist/utils/mediaDrop.d.ts +76 -0
- package/dist/utils/mediaDrop.js +95 -0
- package/dist/utils/mediaPlacement.d.ts +6 -0
- package/dist/utils/mediaPlacement.js +17 -0
- package/dist/utils/motifSizes.d.ts +8 -0
- package/dist/utils/motifSizes.js +9 -0
- package/dist/utils/multiSelect.d.ts +44 -0
- package/dist/utils/multiSelect.js +139 -0
- package/dist/utils/notch.d.ts +17 -0
- package/dist/utils/notch.js +23 -0
- package/dist/utils/orientElement.d.ts +46 -0
- package/dist/utils/orientElement.js +108 -0
- package/dist/utils/orientation.d.ts +119 -0
- package/dist/utils/orientation.js +411 -0
- package/dist/utils/pageCounter.d.ts +15 -0
- package/dist/utils/pageCounter.js +17 -0
- package/dist/utils/pendingImages.d.ts +10 -0
- package/dist/utils/pendingImages.js +25 -0
- package/dist/utils/photoCredit.d.ts +9 -0
- package/dist/utils/photoCredit.js +29 -0
- package/dist/utils/photoCredits.d.ts +5 -0
- package/dist/utils/photoCredits.js +17 -0
- package/dist/utils/photoPlaceholder.d.ts +25 -0
- package/dist/utils/photoPlaceholder.js +38 -0
- package/dist/utils/pillBadgeUtils.d.ts +41 -0
- package/dist/utils/pillBadgeUtils.js +94 -0
- package/dist/utils/pixelHitArea.d.ts +13 -0
- package/dist/utils/pixelHitArea.js +33 -0
- package/dist/utils/plainTextLayout.d.ts +11 -0
- package/dist/utils/plainTextLayout.js +64 -0
- package/dist/utils/printImageInfo.d.ts +9 -0
- package/dist/utils/printImageInfo.js +14 -0
- package/dist/utils/recacheNextFrame.d.ts +6 -0
- package/dist/utils/recacheNextFrame.js +15 -0
- package/dist/utils/removeElement.d.ts +17 -0
- package/dist/utils/removeElement.js +47 -0
- package/dist/utils/renderedBoxes.d.ts +19 -0
- package/dist/utils/renderedBoxes.js +67 -0
- package/dist/utils/resolveElementValue.d.ts +44 -0
- package/dist/utils/resolveElementValue.js +72 -0
- package/dist/utils/scrollBehavior.d.ts +6 -0
- package/dist/utils/scrollBehavior.js +17 -0
- package/dist/utils/searchTranslations.d.ts +20 -0
- package/dist/utils/searchTranslations.js +366 -0
- package/dist/utils/selectionCapabilities.d.ts +53 -0
- package/dist/utils/selectionCapabilities.js +52 -0
- package/dist/utils/shade.d.ts +24 -0
- package/dist/utils/shade.js +55 -0
- package/dist/utils/shapeDevices.d.ts +72 -0
- package/dist/utils/shapeDevices.js +100 -0
- package/dist/utils/shapeTransform.d.ts +29 -0
- package/dist/utils/shapeTransform.js +69 -0
- package/dist/utils/shapes.d.ts +64 -0
- package/dist/utils/shapes.js +838 -0
- package/dist/utils/smartCrop.d.ts +30 -0
- package/dist/utils/smartCrop.js +163 -0
- package/dist/utils/snapping.d.ts +116 -0
- package/dist/utils/snapping.js +426 -0
- package/dist/utils/stageCssScale.d.ts +7 -0
- package/dist/utils/stageCssScale.js +11 -0
- package/dist/utils/stateTypeAssertions.d.ts +99 -0
- package/dist/utils/stateTypeAssertions.js +197 -0
- package/dist/utils/straighten.d.ts +51 -0
- package/dist/utils/straighten.js +254 -0
- package/dist/utils/surfaceGlow.d.ts +7 -0
- package/dist/utils/surfaceGlow.js +27 -0
- package/dist/utils/templateElementInstance.d.ts +43 -0
- package/dist/utils/templateElementInstance.js +100 -0
- package/dist/utils/templateRotation.d.ts +24 -0
- package/dist/utils/templateRotation.js +56 -0
- package/dist/utils/textAlign.d.ts +17 -0
- package/dist/utils/textAlign.js +30 -0
- package/dist/utils/textEditorOpeners.d.ts +12 -0
- package/dist/utils/textEditorOpeners.js +40 -0
- package/dist/utils/textRouting.d.ts +17 -0
- package/dist/utils/textRouting.js +22 -0
- package/dist/utils/textUtils.d.ts +102 -0
- package/dist/utils/textUtils.js +254 -0
- package/dist/utils/touchInput.d.ts +7 -0
- package/dist/utils/touchInput.js +19 -0
- package/dist/utils/transformHudLabel.d.ts +3 -0
- package/dist/utils/transformHudLabel.js +12 -0
- package/dist/utils/unsplashLinks.d.ts +2 -0
- package/dist/utils/unsplashLinks.js +7 -0
- package/dist/utils/userFacingError.d.ts +10 -0
- package/dist/utils/userFacingError.js +10 -0
- package/dist/utils/userImageCrop.d.ts +4 -0
- package/dist/utils/userImageCrop.js +26 -0
- package/dist/utils/userImageUtils.d.ts +44 -0
- package/dist/utils/userImageUtils.js +136 -0
- package/dist/utils/viewport.d.ts +16 -0
- package/dist/utils/viewport.js +30 -0
- package/dist/utils/zipPageImages.d.ts +9 -0
- package/dist/utils/zipPageImages.js +30 -0
- package/package.json +105 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AdditionalText } from '@ggraphic/editor/configs/types';
|
|
2
|
+
import type { ShapeInstance } from '@ggraphic/editor/utils/shapes';
|
|
3
|
+
interface CardPage {
|
|
4
|
+
additionalTexts: AdditionalText[];
|
|
5
|
+
shapeInstances: ShapeInstance[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The page with the composer's card behind `textId` (`${textId}-card`) grown or
|
|
9
|
+
* shrunk by what `partial` (new text, width, size …) adds or removes in lines;
|
|
10
|
+
* its top stays. The card keeps the sum in `textGrowth`, so the lift reads that
|
|
11
|
+
* much as the composer's own size, not as a hand style that would pin it
|
|
12
|
+
* through a recompose.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withCardFollowingText<S extends CardPage>(state: S, textId: string, partial: Partial<AdditionalText>): S;
|
|
15
|
+
/** The same for a text already changed from `before` to `after` (a recompose's hand styles). */
|
|
16
|
+
export declare function withCardResizedFor<S extends CardPage>(state: S, before: AdditionalText, after: AdditionalText): S;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { runMeasurer } from '@ggraphic/editor/utils/textUtils';
|
|
3
|
+
import { layoutRichTextBlock } from '@ggraphic/schema';
|
|
4
|
+
const textHeight = (t) => {
|
|
5
|
+
const measure = runMeasurer(t.fontSize, t.fontFamily, t.fontStyle ?? 'normal', 0, t.accent, t.fontWeight ?? null, t.letterSpacing ?? null);
|
|
6
|
+
return layoutRichTextBlock(t.text, t.width, measure).length * t.fontSize * (t.lineHeight ?? 1.2);
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The page with the composer's card behind `textId` (`${textId}-card`) grown or
|
|
10
|
+
* shrunk by what `partial` (new text, width, size …) adds or removes in lines;
|
|
11
|
+
* its top stays. The card keeps the sum in `textGrowth`, so the lift reads that
|
|
12
|
+
* much as the composer's own size, not as a hand style that would pin it
|
|
13
|
+
* through a recompose.
|
|
14
|
+
*/
|
|
15
|
+
export function withCardFollowingText(state, textId, partial) {
|
|
16
|
+
const text = state.additionalTexts.find((t) => t.id === textId);
|
|
17
|
+
return text ? withCardResizedFor(state, text, { ...text, ...partial }) : state;
|
|
18
|
+
}
|
|
19
|
+
/** The same for a text already changed from `before` to `after` (a recompose's hand styles). */
|
|
20
|
+
export function withCardResizedFor(state, before, after) {
|
|
21
|
+
const card = state.shapeInstances.find((s) => s.id === `${before.id}-card`);
|
|
22
|
+
if (!card || card.rotation)
|
|
23
|
+
return state;
|
|
24
|
+
const delta = textHeight(after) - textHeight(before);
|
|
25
|
+
if (!delta)
|
|
26
|
+
return state;
|
|
27
|
+
const grown = {
|
|
28
|
+
...card,
|
|
29
|
+
y: card.y + delta / 2,
|
|
30
|
+
height: card.height + delta / card.scaleY,
|
|
31
|
+
textGrowth: (card.textGrowth ?? 0) + delta,
|
|
32
|
+
};
|
|
33
|
+
return { ...state, shapeInstances: state.shapeInstances.map((s) => (s === card ? grown : s)) };
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A text without its inline marks (`**bold**`, `==accent==`, `++marker++` …) and hand-mark sentinels. */
|
|
2
|
+
export declare const stripMarks: (text: string) => string;
|
|
3
|
+
/** Every string of a slide with `++marker++` read as `==accent==` (AT has no marker boxes). */
|
|
4
|
+
export declare function foldMarkers<T>(value: T): T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { foldMarkerIntoAccent } from '@ggraphic/schema';
|
|
3
|
+
/** A text without its inline marks (`**bold**`, `==accent==`, `++marker++` …) and hand-mark sentinels. */
|
|
4
|
+
export const stripMarks = (text) => text.replace(/\*\*|__|==|\+\+|[\u2061-\u2064]/g, '');
|
|
5
|
+
/** Every string of a slide with `++marker++` read as `==accent==` (AT has no marker boxes). */
|
|
6
|
+
export function foldMarkers(value) {
|
|
7
|
+
if (typeof value === 'string')
|
|
8
|
+
return foldMarkerIntoAccent(value);
|
|
9
|
+
if (Array.isArray(value))
|
|
10
|
+
return value.map(foldMarkers);
|
|
11
|
+
if (value && typeof value === 'object') {
|
|
12
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, foldMarkers(v)]));
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometry of the `steckbrief` item: a person in the middle, short traits
|
|
3
|
+
* around them, each with a hand-drawn arrow to the person. Pure and
|
|
4
|
+
* deterministic — the composer measures the text, this places it.
|
|
5
|
+
*/
|
|
6
|
+
import { type DesignedArrowType, type HandArrowType } from '@ggraphic/editor/utils/handDrawn';
|
|
7
|
+
export interface Box {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
type Point = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Where the person stands, as the 2:3 portrait frame they were shot in: a
|
|
19
|
+
* cut-out (or a photo kept to the portrait's frame) centred on the bottom
|
|
20
|
+
* edge, the traits around it; a background photo cover-fitted to the slide.
|
|
21
|
+
*/
|
|
22
|
+
export declare function steckbriefPerson(canvas: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}, fullBleed?: boolean): Box;
|
|
26
|
+
/** The face keep-out in canvas px. */
|
|
27
|
+
export declare function steckbriefFace(person: Box): Box;
|
|
28
|
+
/**
|
|
29
|
+
* One place for a trait, after the layout of the introduction posts: which
|
|
30
|
+
* side it hugs and its top as a share of the height (on a cut-out and on a
|
|
31
|
+
* photo, whose head leaves other gaps), the point on the person its arrow would rather end at (shares of
|
|
32
|
+
* the frame) and the arrow's stroke. Listed in the order they fill, so a few
|
|
33
|
+
* traits still spread round the person.
|
|
34
|
+
*/
|
|
35
|
+
export interface SteckbriefSlot {
|
|
36
|
+
side: 'links' | 'rechts';
|
|
37
|
+
top: number;
|
|
38
|
+
/** Where the arrow ends, just off the silhouette (shares of the frame). */
|
|
39
|
+
target: Point;
|
|
40
|
+
arrow: DesignedArrowType;
|
|
41
|
+
/** Where its tail starts: beside the inner edge, under the last line, over the first. */
|
|
42
|
+
anchor: 'innen' | 'unten' | 'oben';
|
|
43
|
+
/** Which way the stroke bows (see `arrowPose`). */
|
|
44
|
+
bow: 1 | -1;
|
|
45
|
+
/**
|
|
46
|
+
* On a background photo the person is larger and reaches the slide's edges:
|
|
47
|
+
* the arrow there, aimed at the contour on the trait's own side.
|
|
48
|
+
*/
|
|
49
|
+
foto: Pick<SteckbriefSlot, 'target' | 'anchor' | 'arrow' | 'bow'>;
|
|
50
|
+
}
|
|
51
|
+
export declare const STECKBRIEF_SLOTS: readonly SteckbriefSlot[];
|
|
52
|
+
/** The places of `count` traits, in trait order. */
|
|
53
|
+
export declare function steckbriefSlots(count: number): SteckbriefSlot[];
|
|
54
|
+
/** Konva's transform of a centred shape: scale, then rotate (degrees), then move. */
|
|
55
|
+
export declare function shapePoint(pose: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
rotation: number;
|
|
59
|
+
scaleX: number;
|
|
60
|
+
scaleY: number;
|
|
61
|
+
}, local: Point): Point;
|
|
62
|
+
/**
|
|
63
|
+
* The pose of a hand-drawn arrow whose tail lands on `from` and whose tip
|
|
64
|
+
* lands on `to`. The stroke is mirrored for an arrow running leftward, so it
|
|
65
|
+
* bows the same way as seen from its label; `bow: -1` bends it the other way.
|
|
66
|
+
*/
|
|
67
|
+
export declare function arrowPose(type: HandArrowType, from: Point, to: Point, strokeWidth: number, bow?: 1 | -1): {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
rotation: number;
|
|
73
|
+
scaleX: number;
|
|
74
|
+
scaleY: 1 | -1;
|
|
75
|
+
};
|
|
76
|
+
type Pose = ReturnType<typeof arrowPose>;
|
|
77
|
+
/** Where a placed arrow's stroke runs: its line, tail first, then both barbs. */
|
|
78
|
+
export declare function arrowSamples(type: DesignedArrowType, pose: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
rotation: number;
|
|
84
|
+
scaleX: number;
|
|
85
|
+
scaleY: number;
|
|
86
|
+
}, strokeWidth: number): {
|
|
87
|
+
line: Point[];
|
|
88
|
+
barbs: Point[];
|
|
89
|
+
};
|
|
90
|
+
/** Something an arrow keeps clear of: boxes, turned `rotation` degrees about `pivot` (Konva text). */
|
|
91
|
+
export interface Obstacle {
|
|
92
|
+
rects: Box[];
|
|
93
|
+
pivot: Point;
|
|
94
|
+
rotation: number;
|
|
95
|
+
}
|
|
96
|
+
export declare function obstacleHit(o: Obstacle, p: Point, pad: number): boolean;
|
|
97
|
+
/** The portrait's outline in canvas px. */
|
|
98
|
+
export declare function steckbriefOutline(person: Box): Point[];
|
|
99
|
+
/** Where a row crosses the outline: its leftmost and rightmost x, or null above the head. */
|
|
100
|
+
export declare function outlineSpan(outline: Point[], y: number): [number, number] | null;
|
|
101
|
+
/** Distance from the outline, negative inside it. */
|
|
102
|
+
export declare function outlineDistance(outline: Point[], p: Point): number;
|
|
103
|
+
export interface ArrowScene {
|
|
104
|
+
canvas: {
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
};
|
|
108
|
+
person: Box;
|
|
109
|
+
/** Text and marks no arrow may cross: the other labels, the greeting, the corners. */
|
|
110
|
+
obstacles: Obstacle[];
|
|
111
|
+
stroke: number;
|
|
112
|
+
gap: number;
|
|
113
|
+
minLength: number;
|
|
114
|
+
maxLength: number;
|
|
115
|
+
curlMin: number;
|
|
116
|
+
}
|
|
117
|
+
export interface ArrowRequest {
|
|
118
|
+
arrow: DesignedArrowType;
|
|
119
|
+
/** The slot's own arrow, set by hand for the fixed portrait; taken when it touches nothing. */
|
|
120
|
+
designed?: {
|
|
121
|
+
from: Point;
|
|
122
|
+
to: Point;
|
|
123
|
+
bow: 1 | -1;
|
|
124
|
+
};
|
|
125
|
+
/** Where the tail may start, the likelier first. */
|
|
126
|
+
froms: Point[];
|
|
127
|
+
/** Where on the person this slot would rather point (canvas px). */
|
|
128
|
+
prefer: Point;
|
|
129
|
+
/** The trait's own label: the tail starts beside it. */
|
|
130
|
+
own: Obstacle;
|
|
131
|
+
}
|
|
132
|
+
export interface PlacedArrow {
|
|
133
|
+
type: DesignedArrowType;
|
|
134
|
+
pose: Pose;
|
|
135
|
+
line: Point[];
|
|
136
|
+
barbs: Point[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The best arrow from a trait to the person: from each tail, to each point
|
|
140
|
+
* just off the outline (or on the body, when the trait stands on it), in the
|
|
141
|
+
* slot's stroke or a plain arc, bowed either way — the cheapest by length,
|
|
142
|
+
* aim and preference whose stroke crosses no text, no face, no other arrow
|
|
143
|
+
* and does not run over the person. If every one touches something, the one
|
|
144
|
+
* touching least. Deterministic: a fixed candidate order, strict comparisons.
|
|
145
|
+
*/
|
|
146
|
+
export declare function placeArrow(req: ArrowRequest, scene: ArrowScene, placed: PlacedArrow[]): PlacedArrow;
|
|
147
|
+
export {};
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Geometry of the `steckbrief` item: a person in the middle, short traits
|
|
4
|
+
* around them, each with a hand-drawn arrow to the person. Pure and
|
|
5
|
+
* deterministic — the composer measures the text, this places it.
|
|
6
|
+
*/
|
|
7
|
+
import { HAND_ARROW_ASPECT, handArrowEnds, handArrowStroke, } from '@ggraphic/editor/utils/handDrawn';
|
|
8
|
+
/** The portrait's height as a share of the slide's. */
|
|
9
|
+
const STECKBRIEF_PERSON_HEIGHT = 0.74;
|
|
10
|
+
/**
|
|
11
|
+
* Where the person stands, as the 2:3 portrait frame they were shot in: a
|
|
12
|
+
* cut-out (or a photo kept to the portrait's frame) centred on the bottom
|
|
13
|
+
* edge, the traits around it; a background photo cover-fitted to the slide.
|
|
14
|
+
*/
|
|
15
|
+
export function steckbriefPerson(canvas, fullBleed = false) {
|
|
16
|
+
if (fullBleed) {
|
|
17
|
+
// The photo cover-fitted to the slide, centred, as the background draws it.
|
|
18
|
+
const width = Math.max(canvas.width, (canvas.height * 2) / 3);
|
|
19
|
+
const height = width * 1.5;
|
|
20
|
+
return { x: (canvas.width - width) / 2, y: (canvas.height - height) / 2, width, height };
|
|
21
|
+
}
|
|
22
|
+
const height = canvas.height * STECKBRIEF_PERSON_HEIGHT;
|
|
23
|
+
const width = Math.min(canvas.width * 0.66, (height * 2) / 3);
|
|
24
|
+
// A touch left of centre: the greeting stands beside the face on the right.
|
|
25
|
+
const x = (canvas.width - width) / 2 - canvas.width * 0.04;
|
|
26
|
+
return { x, y: canvas.height - height, width, height };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The outline of a head-and-shoulders portrait in its 2:3 frame (shares),
|
|
30
|
+
* clockwise from the left temple — measured on the Vorlage's cut-out: hair,
|
|
31
|
+
* cheeks, neck, shoulders out to the frame's edges.
|
|
32
|
+
*/
|
|
33
|
+
const OUTLINE = [
|
|
34
|
+
[0.25, 0.18],
|
|
35
|
+
[0.3, 0.145],
|
|
36
|
+
[0.36, 0.11],
|
|
37
|
+
[0.42, 0.097],
|
|
38
|
+
[0.5, 0.098],
|
|
39
|
+
[0.56, 0.108],
|
|
40
|
+
[0.62, 0.12],
|
|
41
|
+
[0.67, 0.145],
|
|
42
|
+
[0.71, 0.17],
|
|
43
|
+
[0.74, 0.2],
|
|
44
|
+
[0.75, 0.235],
|
|
45
|
+
[0.72, 0.27],
|
|
46
|
+
[0.71, 0.32],
|
|
47
|
+
[0.72, 0.36],
|
|
48
|
+
[0.7, 0.4],
|
|
49
|
+
[0.68, 0.44],
|
|
50
|
+
[0.66, 0.48],
|
|
51
|
+
[0.65, 0.52],
|
|
52
|
+
[0.65, 0.55],
|
|
53
|
+
[0.71, 0.57],
|
|
54
|
+
[0.82, 0.595],
|
|
55
|
+
[0.9, 0.62],
|
|
56
|
+
[0.965, 0.645],
|
|
57
|
+
[0.995, 0.68],
|
|
58
|
+
[1, 0.72],
|
|
59
|
+
[1, 1],
|
|
60
|
+
[0, 1],
|
|
61
|
+
[0, 0.72],
|
|
62
|
+
[0.01, 0.69],
|
|
63
|
+
[0.03, 0.67],
|
|
64
|
+
[0.065, 0.645],
|
|
65
|
+
[0.12, 0.62],
|
|
66
|
+
[0.21, 0.595],
|
|
67
|
+
[0.29, 0.57],
|
|
68
|
+
[0.345, 0.545],
|
|
69
|
+
[0.33, 0.495],
|
|
70
|
+
[0.31, 0.47],
|
|
71
|
+
[0.29, 0.43],
|
|
72
|
+
[0.27, 0.4],
|
|
73
|
+
[0.26, 0.36],
|
|
74
|
+
[0.27, 0.32],
|
|
75
|
+
[0.26, 0.27],
|
|
76
|
+
[0.215, 0.245],
|
|
77
|
+
[0.225, 0.215],
|
|
78
|
+
];
|
|
79
|
+
/** Eyes, nose and mouth, shares of the frame: no arrow crosses them. */
|
|
80
|
+
const FACE = { x0: 0.28, x1: 0.7, y0: 0.25, y1: 0.56 };
|
|
81
|
+
const inFrame = (person, [x, y]) => ({
|
|
82
|
+
x: person.x + person.width * x,
|
|
83
|
+
y: person.y + person.height * y,
|
|
84
|
+
});
|
|
85
|
+
/** The face keep-out in canvas px. */
|
|
86
|
+
export function steckbriefFace(person) {
|
|
87
|
+
const a = inFrame(person, [FACE.x0, FACE.y0]);
|
|
88
|
+
const b = inFrame(person, [FACE.x1, FACE.y1]);
|
|
89
|
+
return { x: a.x, y: a.y, width: b.x - a.x, height: b.y - a.y };
|
|
90
|
+
}
|
|
91
|
+
export const STECKBRIEF_SLOTS = [
|
|
92
|
+
{
|
|
93
|
+
side: 'links',
|
|
94
|
+
top: 0.05,
|
|
95
|
+
target: { x: 0.33, y: 0.115 },
|
|
96
|
+
arrow: 'hand-pfeil-spirale',
|
|
97
|
+
anchor: 'unten',
|
|
98
|
+
bow: 1,
|
|
99
|
+
foto: { target: { x: 0.25, y: 0.36 }, anchor: 'unten', arrow: 'hand-pfeil-spirale', bow: 1 },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
side: 'rechts',
|
|
103
|
+
top: 0.07,
|
|
104
|
+
target: { x: 0.62, y: 0.095 },
|
|
105
|
+
arrow: 'hand-pfeil-herz',
|
|
106
|
+
anchor: 'unten',
|
|
107
|
+
bow: -1,
|
|
108
|
+
foto: { target: { x: 0.745, y: 0.26 }, anchor: 'unten', arrow: 'hand-pfeil-herz', bow: -1 },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
side: 'links',
|
|
112
|
+
top: 0.36,
|
|
113
|
+
target: { x: 0.31, y: 0.5 },
|
|
114
|
+
arrow: 'hand-pfeil-haken',
|
|
115
|
+
anchor: 'unten',
|
|
116
|
+
bow: 1,
|
|
117
|
+
foto: { target: { x: 0.27, y: 0.46 }, anchor: 'unten', arrow: 'hand-pfeil-haken', bow: 1 },
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
side: 'rechts',
|
|
121
|
+
top: 0.25,
|
|
122
|
+
target: { x: 0.78, y: 0.215 },
|
|
123
|
+
arrow: 'hand-pfeil-bogen',
|
|
124
|
+
anchor: 'unten',
|
|
125
|
+
bow: -1,
|
|
126
|
+
foto: { target: { x: 0.73, y: 0.36 }, anchor: 'unten', arrow: 'hand-pfeil-bogen', bow: -1 },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
side: 'links',
|
|
130
|
+
top: 0.7,
|
|
131
|
+
target: { x: 0.3, y: 0.52 },
|
|
132
|
+
arrow: 'hand-pfeil-bogen',
|
|
133
|
+
anchor: 'oben',
|
|
134
|
+
bow: -1,
|
|
135
|
+
foto: { target: { x: 0.22, y: 0.6 }, anchor: 'oben', arrow: 'hand-pfeil-bogen', bow: 1 },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
side: 'rechts',
|
|
139
|
+
top: 0.64,
|
|
140
|
+
target: { x: 0.74, y: 0.565 },
|
|
141
|
+
arrow: 'hand-pfeil-bogen',
|
|
142
|
+
anchor: 'innen',
|
|
143
|
+
bow: 1,
|
|
144
|
+
foto: { target: { x: 0.56, y: 0.58 }, anchor: 'innen', arrow: 'hand-pfeil-bogen', bow: -1 },
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
side: 'links',
|
|
148
|
+
top: 0.83,
|
|
149
|
+
target: { x: 0.42, y: 0.62 },
|
|
150
|
+
arrow: 'hand-pfeil-welle',
|
|
151
|
+
anchor: 'oben',
|
|
152
|
+
bow: 1,
|
|
153
|
+
foto: { target: { x: 0.15, y: 0.63 }, anchor: 'oben', arrow: 'hand-pfeil-bogen', bow: 1 },
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
side: 'rechts',
|
|
157
|
+
top: 0.8,
|
|
158
|
+
target: { x: 0.64, y: 0.78 },
|
|
159
|
+
arrow: 'hand-pfeil-haken',
|
|
160
|
+
anchor: 'innen',
|
|
161
|
+
bow: 1,
|
|
162
|
+
foto: { target: { x: 0.61, y: 0.63 }, anchor: 'innen', arrow: 'hand-pfeil-bogen', bow: 1 },
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
side: 'links',
|
|
166
|
+
top: 0.52,
|
|
167
|
+
target: { x: 0.26, y: 0.4 },
|
|
168
|
+
arrow: 'hand-pfeil-bogen',
|
|
169
|
+
anchor: 'innen',
|
|
170
|
+
bow: 1,
|
|
171
|
+
foto: { target: { x: 0.3, y: 0.5 }, anchor: 'innen', arrow: 'hand-pfeil-bogen', bow: 1 },
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
side: 'links',
|
|
175
|
+
top: 0.2,
|
|
176
|
+
target: { x: 0.24, y: 0.17 },
|
|
177
|
+
arrow: 'hand-pfeil-schlaufe',
|
|
178
|
+
anchor: 'unten',
|
|
179
|
+
bow: 1,
|
|
180
|
+
foto: { target: { x: 0.26, y: 0.27 }, anchor: 'innen', arrow: 'hand-pfeil-schlaufe', bow: 1 },
|
|
181
|
+
},
|
|
182
|
+
];
|
|
183
|
+
/**
|
|
184
|
+
* Which places a given number of traits takes, top to bottom on both sides:
|
|
185
|
+
* few traits spread over the whole height instead of filling the top first.
|
|
186
|
+
*/
|
|
187
|
+
const SLOTS_FOR = {
|
|
188
|
+
3: [0, 4, 5],
|
|
189
|
+
4: [0, 1, 4, 5],
|
|
190
|
+
5: [0, 1, 2, 5, 6],
|
|
191
|
+
6: [0, 1, 2, 4, 5, 7],
|
|
192
|
+
7: [0, 1, 2, 3, 4, 5, 7],
|
|
193
|
+
};
|
|
194
|
+
/** The places of `count` traits, in trait order. */
|
|
195
|
+
export function steckbriefSlots(count) {
|
|
196
|
+
const picked = SLOTS_FOR[count] ?? STECKBRIEF_SLOTS.map((_, k) => k).slice(0, count);
|
|
197
|
+
return picked.map((k) => STECKBRIEF_SLOTS[k]);
|
|
198
|
+
}
|
|
199
|
+
/** Konva's transform of a centred shape: scale, then rotate (degrees), then move. */
|
|
200
|
+
export function shapePoint(pose, local) {
|
|
201
|
+
const a = (pose.rotation * Math.PI) / 180;
|
|
202
|
+
const lx = local.x * pose.scaleX;
|
|
203
|
+
const ly = local.y * pose.scaleY;
|
|
204
|
+
return {
|
|
205
|
+
x: pose.x + lx * Math.cos(a) - ly * Math.sin(a),
|
|
206
|
+
y: pose.y + lx * Math.sin(a) + ly * Math.cos(a),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The pose of a hand-drawn arrow whose tail lands on `from` and whose tip
|
|
211
|
+
* lands on `to`. The stroke is mirrored for an arrow running leftward, so it
|
|
212
|
+
* bows the same way as seen from its label; `bow: -1` bends it the other way.
|
|
213
|
+
*/
|
|
214
|
+
export function arrowPose(type, from, to, strokeWidth, bow = 1) {
|
|
215
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
216
|
+
const aspect = HAND_ARROW_ASPECT[type];
|
|
217
|
+
const scaleX = to.x < from.x ? -1 : 1;
|
|
218
|
+
const scaleY = bow;
|
|
219
|
+
// The tail-to-tip distance grows linearly with the width: two corrections land it.
|
|
220
|
+
const span = (w) => {
|
|
221
|
+
const { tail, tip } = handArrowEnds(type, w, w * aspect, strokeWidth);
|
|
222
|
+
return Math.hypot(tip.x - tail.x, tip.y - tail.y);
|
|
223
|
+
};
|
|
224
|
+
let width = Math.max(strokeWidth * 6, length);
|
|
225
|
+
width *= length / Math.max(1, span(width));
|
|
226
|
+
width *= length / Math.max(1, span(width));
|
|
227
|
+
const height = width * aspect;
|
|
228
|
+
const { tail, tip } = handArrowEnds(type, width, height, strokeWidth);
|
|
229
|
+
const local = Math.atan2(scaleY * (tip.y - tail.y), scaleX * (tip.x - tail.x));
|
|
230
|
+
const rotation = ((Math.atan2(to.y - from.y, to.x - from.x) - local) * 180) / Math.PI;
|
|
231
|
+
const start = shapePoint({ x: 0, y: 0, rotation, scaleX, scaleY }, tail);
|
|
232
|
+
return { x: from.x - start.x, y: from.y - start.y, width, height, rotation, scaleX, scaleY };
|
|
233
|
+
}
|
|
234
|
+
/** Where a placed arrow's stroke runs: its line, tail first, then both barbs. */
|
|
235
|
+
export function arrowSamples(type, pose, strokeWidth) {
|
|
236
|
+
const { line, barbs } = handArrowStroke(type, pose.width, pose.height, strokeWidth);
|
|
237
|
+
return {
|
|
238
|
+
line: line.map((p) => shapePoint(pose, p)),
|
|
239
|
+
barbs: barbs.flat().map((p) => shapePoint(pose, p)),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
export function obstacleHit(o, p, pad) {
|
|
243
|
+
const a = (-o.rotation * Math.PI) / 180;
|
|
244
|
+
const dx = p.x - o.pivot.x;
|
|
245
|
+
const dy = p.y - o.pivot.y;
|
|
246
|
+
const x = o.pivot.x + dx * Math.cos(a) - dy * Math.sin(a);
|
|
247
|
+
const y = o.pivot.y + dx * Math.sin(a) + dy * Math.cos(a);
|
|
248
|
+
return o.rects.some((r) => x > r.x - pad && x < r.x + r.width + pad && y > r.y - pad && y < r.y + r.height + pad);
|
|
249
|
+
}
|
|
250
|
+
/** The portrait's outline in canvas px. */
|
|
251
|
+
export function steckbriefOutline(person) {
|
|
252
|
+
return OUTLINE.map((p) => inFrame(person, p));
|
|
253
|
+
}
|
|
254
|
+
/** Where a row crosses the outline: its leftmost and rightmost x, or null above the head. */
|
|
255
|
+
export function outlineSpan(outline, y) {
|
|
256
|
+
const xs = [];
|
|
257
|
+
for (let i = 0, j = outline.length - 1; i < outline.length; j = i++) {
|
|
258
|
+
const a = outline[j];
|
|
259
|
+
const b = outline[i];
|
|
260
|
+
if (a.y > y !== b.y > y)
|
|
261
|
+
xs.push(a.x + ((b.x - a.x) * (y - a.y)) / (b.y - a.y));
|
|
262
|
+
}
|
|
263
|
+
return xs.length ? [Math.min(...xs), Math.max(...xs)] : null;
|
|
264
|
+
}
|
|
265
|
+
/** Distance from the outline, negative inside it. */
|
|
266
|
+
export function outlineDistance(outline, p) {
|
|
267
|
+
let inside = false;
|
|
268
|
+
let best = Infinity;
|
|
269
|
+
for (let i = 0, j = outline.length - 1; i < outline.length; j = i++) {
|
|
270
|
+
const a = outline[j];
|
|
271
|
+
const b = outline[i];
|
|
272
|
+
if (a.y > p.y !== b.y > p.y && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {
|
|
273
|
+
inside = !inside;
|
|
274
|
+
}
|
|
275
|
+
const ex = b.x - a.x;
|
|
276
|
+
const ey = b.y - a.y;
|
|
277
|
+
const t = Math.max(0, Math.min(1, ((p.x - a.x) * ex + (p.y - a.y) * ey) / (ex * ex + ey * ey || 1)));
|
|
278
|
+
best = Math.min(best, Math.hypot(p.x - a.x - t * ex, p.y - a.y - t * ey));
|
|
279
|
+
}
|
|
280
|
+
return inside ? -best : best;
|
|
281
|
+
}
|
|
282
|
+
/** Points just off the outline, `gap` out, every ~`step` px, with the way in. */
|
|
283
|
+
function edgeTargets(outline, gap, step) {
|
|
284
|
+
const out = [];
|
|
285
|
+
outline.forEach((a, i) => {
|
|
286
|
+
const b = outline[(i + 1) % outline.length];
|
|
287
|
+
const len = Math.hypot(b.x - a.x, b.y - a.y);
|
|
288
|
+
const n = Math.max(1, Math.round(len / step));
|
|
289
|
+
for (let k = 0; k < n; k++) {
|
|
290
|
+
const t = (k + 0.5) / n;
|
|
291
|
+
const p = { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };
|
|
292
|
+
// Clockwise on screen (y down): the left-hand normal points out.
|
|
293
|
+
const nx = (b.y - a.y) / len;
|
|
294
|
+
const ny = -(b.x - a.x) / len;
|
|
295
|
+
out.push({ at: { x: p.x + nx * gap, y: p.y + ny * gap }, inward: { x: -nx, y: -ny } });
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return out;
|
|
299
|
+
}
|
|
300
|
+
/** Below this a set arrow is a stub: a short label sits too close to its target. */
|
|
301
|
+
const DESIGNED_MIN_LENGTH = 120;
|
|
302
|
+
const CURLY = [
|
|
303
|
+
'hand-pfeil-herz',
|
|
304
|
+
'hand-pfeil-spirale',
|
|
305
|
+
'hand-pfeil-schlaufe',
|
|
306
|
+
];
|
|
307
|
+
/**
|
|
308
|
+
* The best arrow from a trait to the person: from each tail, to each point
|
|
309
|
+
* just off the outline (or on the body, when the trait stands on it), in the
|
|
310
|
+
* slot's stroke or a plain arc, bowed either way — the cheapest by length,
|
|
311
|
+
* aim and preference whose stroke crosses no text, no face, no other arrow
|
|
312
|
+
* and does not run over the person. If every one touches something, the one
|
|
313
|
+
* touching least. Deterministic: a fixed candidate order, strict comparisons.
|
|
314
|
+
*/
|
|
315
|
+
export function placeArrow(req, scene, placed) {
|
|
316
|
+
const { canvas, person, stroke, gap } = scene;
|
|
317
|
+
const outline = steckbriefOutline(person);
|
|
318
|
+
const face = steckbriefFace(person);
|
|
319
|
+
const centreX = person.x + person.width / 2;
|
|
320
|
+
const keepOut = (p, pad) => p.x > face.x - pad &&
|
|
321
|
+
p.x < face.x + face.width + pad &&
|
|
322
|
+
p.y > face.y - pad &&
|
|
323
|
+
p.y < face.y + face.height + pad;
|
|
324
|
+
const edge = edgeTargets(outline, gap, 34).filter(({ at }) => at.x > 30 &&
|
|
325
|
+
at.x < canvas.width - 30 &&
|
|
326
|
+
at.y > 30 &&
|
|
327
|
+
at.y < canvas.height - 30 &&
|
|
328
|
+
!keepOut(at, 10));
|
|
329
|
+
const neck = inFrame(person, [0.5, 0.6]);
|
|
330
|
+
/** From a tail on the body: up towards the neck, fanned out, landing on the body. */
|
|
331
|
+
const onBody = (from) => {
|
|
332
|
+
const d = Math.hypot(neck.x - from.x, neck.y - from.y) || 1;
|
|
333
|
+
const base = Math.atan2((neck.y - from.y) / d - 0.8, (neck.x - from.x) / d);
|
|
334
|
+
return [0, 0.35, -0.35, 0.7, -0.7, 1.05, -1.05].flatMap((turn) => [220, 280, 340, 160].flatMap((length) => {
|
|
335
|
+
const at = {
|
|
336
|
+
x: from.x + Math.cos(base + turn) * length,
|
|
337
|
+
y: from.y + Math.sin(base + turn) * length,
|
|
338
|
+
};
|
|
339
|
+
return outlineDistance(outline, at) < -20 && !keepOut(at, 30)
|
|
340
|
+
? [{ at, inward: null, aim: Math.abs(turn) * 40 }]
|
|
341
|
+
: [];
|
|
342
|
+
}));
|
|
343
|
+
};
|
|
344
|
+
const types = req.arrow === 'hand-pfeil-bogen' ? [req.arrow] : [req.arrow, 'hand-pfeil-bogen'];
|
|
345
|
+
const candidates = [];
|
|
346
|
+
req.froms.forEach((from, fi) => {
|
|
347
|
+
const inside = outlineDistance(outline, from) < 0;
|
|
348
|
+
// A tail on the hair or the face has nowhere to point.
|
|
349
|
+
if (inside && from.y < neck.y)
|
|
350
|
+
return;
|
|
351
|
+
const targets = inside
|
|
352
|
+
? onBody(from)
|
|
353
|
+
: edge.map((e) => ({ at: e.at, inward: e.inward, aim: 0 }));
|
|
354
|
+
for (const target of targets) {
|
|
355
|
+
const dx = target.at.x - from.x;
|
|
356
|
+
const dy = target.at.y - from.y;
|
|
357
|
+
const length = Math.hypot(dx, dy);
|
|
358
|
+
if (length < 80 || length > scene.maxLength + 80)
|
|
359
|
+
continue;
|
|
360
|
+
// Off the body an arrow points down or across to the person, never steeply up and away.
|
|
361
|
+
if (!inside && dy < 0 && -dy > 1.2 * Math.abs(dx))
|
|
362
|
+
continue;
|
|
363
|
+
let aim = target.aim;
|
|
364
|
+
if (target.inward) {
|
|
365
|
+
const cos = (dx * target.inward.x + dy * target.inward.y) / length;
|
|
366
|
+
if (cos < 0.15)
|
|
367
|
+
continue;
|
|
368
|
+
aim = (1 - cos) * 90;
|
|
369
|
+
}
|
|
370
|
+
const lengthCost = Math.max(0, scene.minLength - length) * 3 + Math.max(0, length - scene.maxLength) * 3;
|
|
371
|
+
const preferCost = Math.hypot(target.at.x - req.prefer.x, target.at.y - req.prefer.y) * 0.35;
|
|
372
|
+
types.forEach((type, ti) => {
|
|
373
|
+
if (CURLY.includes(type) && length < scene.curlMin)
|
|
374
|
+
return;
|
|
375
|
+
for (const bow of [1, -1]) {
|
|
376
|
+
candidates.push({
|
|
377
|
+
cost: lengthCost + aim + preferCost + fi * 12 + ti * 35,
|
|
378
|
+
type,
|
|
379
|
+
from,
|
|
380
|
+
to: target.at,
|
|
381
|
+
bow,
|
|
382
|
+
inside,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
candidates.sort((a, b) => a.cost - b.cost);
|
|
389
|
+
const pad = stroke / 2 + 12;
|
|
390
|
+
const near = stroke + 14;
|
|
391
|
+
const others = placed.map((other) => {
|
|
392
|
+
const points = [...other.line, ...other.barbs];
|
|
393
|
+
const xs = points.map((p) => p.x);
|
|
394
|
+
const ys = points.map((p) => p.y);
|
|
395
|
+
return {
|
|
396
|
+
points,
|
|
397
|
+
box: { x0: Math.min(...xs), x1: Math.max(...xs), y0: Math.min(...ys), y1: Math.max(...ys) },
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
const hits = (arrow, inside) => {
|
|
401
|
+
let count = 0;
|
|
402
|
+
let run = 0;
|
|
403
|
+
const total = arrow.line.reduce((sum, p, i) => i ? sum + Math.hypot(p.x - arrow.line[i - 1].x, p.y - arrow.line[i - 1].y) : 0, 0);
|
|
404
|
+
const check = (p, along) => {
|
|
405
|
+
if (p.x < 14 || p.x > canvas.width - 14 || p.y < 14 || p.y > canvas.height - 14)
|
|
406
|
+
count++;
|
|
407
|
+
if (keepOut(p, stroke))
|
|
408
|
+
count++;
|
|
409
|
+
if (scene.obstacles.some((o) => obstacleHit(o, p, pad)))
|
|
410
|
+
count++;
|
|
411
|
+
if (along > 26 && obstacleHit(req.own, p, stroke / 2 + 6))
|
|
412
|
+
count++;
|
|
413
|
+
if (!inside && along < total - 40 && outlineDistance(outline, p) < -12)
|
|
414
|
+
count++;
|
|
415
|
+
for (const other of others) {
|
|
416
|
+
const b = other.box;
|
|
417
|
+
if (p.x < b.x0 - near || p.x > b.x1 + near || p.y < b.y0 - near || p.y > b.y1 + near)
|
|
418
|
+
continue;
|
|
419
|
+
if (other.points.some((q) => Math.hypot(q.x - p.x, q.y - p.y) < near))
|
|
420
|
+
count++;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
arrow.line.forEach((p, i) => {
|
|
424
|
+
if (i)
|
|
425
|
+
run += Math.hypot(p.x - arrow.line[i - 1].x, p.y - arrow.line[i - 1].y);
|
|
426
|
+
check(p, run);
|
|
427
|
+
});
|
|
428
|
+
arrow.barbs.forEach((p) => check(p, total));
|
|
429
|
+
return count;
|
|
430
|
+
};
|
|
431
|
+
/** A sideways run sags; a steep one bows out, away from the person. */
|
|
432
|
+
const bulgeCost = (arrow, c) => {
|
|
433
|
+
const mid = arrow.line[Math.floor(arrow.line.length / 2)];
|
|
434
|
+
const bx = mid.x - (c.from.x + c.to.x) / 2;
|
|
435
|
+
const by = mid.y - (c.from.y + c.to.y) / 2;
|
|
436
|
+
const flat = Math.abs(c.to.x - c.from.x) > Math.abs(c.to.y - c.from.y);
|
|
437
|
+
const want = flat ? { x: 0, y: 1 } : { x: Math.sign(mid.x - centreX) || 1, y: 0 };
|
|
438
|
+
return bx * want.x + by * want.y < 0 ? 18 : 0;
|
|
439
|
+
};
|
|
440
|
+
if (req.designed) {
|
|
441
|
+
const { from, to, bow } = req.designed;
|
|
442
|
+
const pose = arrowPose(req.arrow, from, to, stroke, bow);
|
|
443
|
+
const arrow = { type: req.arrow, pose, ...arrowSamples(req.arrow, pose, stroke) };
|
|
444
|
+
const long = Math.hypot(to.x - from.x, to.y - from.y) >= DESIGNED_MIN_LENGTH;
|
|
445
|
+
if (long && hits(arrow, outlineDistance(outline, from) < 0) === 0)
|
|
446
|
+
return arrow;
|
|
447
|
+
}
|
|
448
|
+
let best = null;
|
|
449
|
+
for (const c of candidates.slice(0, 2500)) {
|
|
450
|
+
if (best && c.cost >= best.score)
|
|
451
|
+
break;
|
|
452
|
+
const pose = arrowPose(c.type, c.from, c.to, stroke, c.bow);
|
|
453
|
+
const arrow = { type: c.type, pose, ...arrowSamples(c.type, pose, stroke) };
|
|
454
|
+
const score = c.cost + bulgeCost(arrow, c) + hits(arrow, c.inside) * 1000;
|
|
455
|
+
if (!best || score < best.score)
|
|
456
|
+
best = { arrow, score };
|
|
457
|
+
}
|
|
458
|
+
if (best)
|
|
459
|
+
return best.arrow;
|
|
460
|
+
// Nowhere to go (no target in reach): a short plain arc towards the preferred point.
|
|
461
|
+
const from = req.froms[0];
|
|
462
|
+
const dx = req.prefer.x - from.x;
|
|
463
|
+
const dy = req.prefer.y - from.y;
|
|
464
|
+
const d = Math.hypot(dx, dy) || 1;
|
|
465
|
+
const to = { x: from.x + (dx / d) * scene.minLength, y: from.y + (dy / d) * scene.minLength };
|
|
466
|
+
const pose = arrowPose('hand-pfeil-bogen', from, to, stroke, 1);
|
|
467
|
+
return { type: 'hand-pfeil-bogen', pose, ...arrowSamples('hand-pfeil-bogen', pose, stroke) };
|
|
468
|
+
}
|