tldraw 3.16.0-internal.51e99e128bd4 → 3.16.0-internal.a478398270c6
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/dist-cjs/index.d.ts +23 -297
- package/dist-cjs/index.js +2 -30
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawImage.js +2 -5
- package/dist-cjs/lib/TldrawImage.js.map +3 -3
- package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
- package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawScribble.js +1 -1
- package/dist-cjs/lib/canvas/TldrawScribble.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +44 -27
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js +3 -3
- package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +0 -3
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +6 -3
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js +1 -1
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +17 -17
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -1
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js +1 -2
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +4 -5
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +5 -20
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +5 -6
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/ShapeFill.js +4 -4
- package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/freehand/svg.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +13 -7
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +1 -1
- package/dist-cjs/lib/styles.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +1 -25
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js +0 -12
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/TldrawUi.js +0 -14
- package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
- package/dist-cjs/lib/ui/components/A11y.js +12 -14
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +3 -12
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +2 -3
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js +4 -4
- package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js.map +2 -2
- package/dist-cjs/lib/ui/components/MobileStylePanel.js +3 -5
- package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +5 -4
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +2 -3
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +25 -2
- package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +139 -171
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +25 -26
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +21 -66
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +80 -189
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +4 -5
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +0 -22
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +16 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js +2 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +7 -31
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +12 -25
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +22 -154
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +8 -57
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +9 -94
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -11
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +1 -2
- package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +23 -297
- package/dist-esm/index.mjs +4 -51
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawImage.mjs +2 -5
- package/dist-esm/lib/TldrawImage.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawScribble.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawScribble.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +44 -30
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs +3 -3
- package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs.map +1 -1
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +0 -3
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +6 -4
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs +1 -1
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +17 -18
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -1
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +2 -3
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs +1 -2
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +4 -6
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -3
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +5 -21
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -7
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/ShapeFill.mjs +4 -5
- package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/freehand/svg.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +13 -8
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -3
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +1 -26
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +0 -13
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/TldrawUi.mjs +2 -16
- package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
- package/dist-esm/lib/ui/components/A11y.mjs +12 -14
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +3 -12
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +2 -3
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs +4 -4
- package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs +3 -6
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +5 -4
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +2 -3
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
- package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +139 -171
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +25 -26
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +21 -56
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +81 -192
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +4 -5
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +6 -8
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs +2 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +7 -31
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +12 -25
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +24 -162
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +8 -57
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +10 -102
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
- package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +34 -12
- package/src/index.ts +2 -39
- package/src/lib/TldrawImage.tsx +2 -6
- package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
- package/src/lib/canvas/TldrawHandles.tsx +1 -5
- package/src/lib/canvas/TldrawOverlays.tsx +1 -1
- package/src/lib/canvas/TldrawScribble.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
- package/src/lib/defaultExternalContentHandlers.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +3 -4
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +11 -12
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +46 -30
- package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
- package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
- package/src/lib/shapes/draw/DrawShapeTool.test.ts +5 -0
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +7 -4
- package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +21 -26
- package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +2 -3
- package/src/lib/shapes/geo/components/GeoShapeBody.tsx +2 -2
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +4 -7
- package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -3
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +3 -4
- package/src/lib/shapes/line/LineShapeUtil.tsx +6 -25
- package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
- package/src/lib/shapes/note/NoteShapeUtil.tsx +4 -10
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
- package/src/lib/shapes/shared/ShapeFill.tsx +4 -5
- package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
- package/src/lib/shapes/shared/freehand/svg.ts +0 -2
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
- package/src/lib/shapes/text/TextShapeTool.test.ts +5 -6
- package/src/lib/shapes/text/TextShapeUtil.tsx +14 -8
- package/src/lib/shapes/video/VideoShapeUtil.tsx +3 -3
- package/src/lib/styles.tsx +1 -3
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +1 -34
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +0 -20
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
- package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
- package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -11
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
- package/src/lib/ui/TldrawUi.tsx +2 -17
- package/src/lib/ui/components/A11y.tsx +13 -15
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +3 -15
- package/src/lib/ui/components/DefaultMenuPanel.tsx +3 -4
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
- package/src/lib/ui/components/Minimap/MinimapManager.ts +4 -4
- package/src/lib/ui/components/MobileStylePanel.tsx +6 -9
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +5 -4
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +2 -3
- package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +3 -4
- package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -3
- package/src/lib/ui/components/Spinner.tsx +24 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +106 -146
- package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +6 -7
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +1 -1
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +23 -55
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +61 -212
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
- package/src/lib/ui/components/menu-items.tsx +0 -25
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +35 -40
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
- package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +2 -4
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +12 -56
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +1 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +16 -29
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +23 -224
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
- package/src/lib/ui/context/actions.tsx +9 -59
- package/src/lib/ui/context/events.tsx +2 -6
- package/src/lib/ui/hooks/menu-hooks.ts +0 -1
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
- package/src/lib/ui/hooks/useTools.tsx +11 -142
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
- package/src/lib/ui/kbd-utils.ts +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +314 -414
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +7 -21
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +7 -28
- package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
- package/src/test/A11y.test.tsx +2 -3
- package/src/test/ClickManager.test.ts +6 -7
- package/src/test/Editor.test.tsx +20 -21
- package/src/test/EraserTool.test.ts +13 -184
- package/src/test/HandTool.test.ts +9 -10
- package/src/test/HighlightShape.test.ts +1 -2
- package/src/test/SelectTool.test.ts +13 -40
- package/src/test/TLUserPreferences.test.ts +3 -4
- package/src/test/TestEditor.ts +15 -13
- package/src/test/TldrawEditor.test.tsx +10 -11
- package/src/test/ZoomTool.test.ts +6 -7
- package/src/test/__snapshots__/drawing.test.ts.snap +2 -2
- package/src/test/__snapshots__/groups.test.tsx.snap +6 -6
- package/src/test/__snapshots__/resizing.test.ts.snap +2 -2
- package/src/test/arrows-megabus.test.tsx +10 -17
- package/src/test/bindings.test.tsx +37 -24
- package/src/test/bookmark-shapes.test.ts +8 -1
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +7 -23
- package/src/test/commands/__snapshots__/packShapes.test.ts.snap +8 -8
- package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
- package/src/test/commands/alignShapes.test.tsx +24 -25
- package/src/test/commands/animationSpeed.test.ts +1 -2
- package/src/test/commands/centerOnPoint.test.ts +2 -3
- package/src/test/commands/clipboard.test.ts +2 -3
- package/src/test/commands/createShapes.test.ts +1 -2
- package/src/test/commands/deletePage.test.ts +1 -84
- package/src/test/commands/deleteShapes.test.ts +1 -2
- package/src/test/commands/distributeShapes.test.tsx +10 -11
- package/src/test/commands/getSvgString.test.ts +1 -2
- package/src/test/commands/packShapes.test.ts +4 -5
- package/src/test/commands/resizeShape.test.ts +1 -2
- package/src/test/commands/rotateShapes.test.ts +6 -7
- package/src/test/commands/setCamera.test.ts +3 -4
- package/src/test/commands/setCurrentPage.test.ts +2 -3
- package/src/test/commands/stackShapes.test.ts +10 -11
- package/src/test/commands/stretch.test.tsx +12 -13
- package/src/test/createDeepLink.test.tsx +1 -2
- package/src/test/cropping.test.ts +2 -3
- package/src/test/drawing.test.ts +1 -2
- package/src/test/flipShapes.test.ts +3 -4
- package/src/test/frames.test.ts +24 -25
- package/src/test/getCulledShapes.test.tsx +2 -3
- package/src/test/groups.test.tsx +2 -2
- package/src/test/handleDeepLink.test.tsx +1 -2
- package/src/test/maxShapes.test.ts +2 -3
- package/src/test/modifiers.test.ts +4 -5
- package/src/test/navigation.test.ts +9 -264
- package/src/test/panning.test.ts +1 -2
- package/src/test/perf/perf.test.ts +1 -2
- package/src/test/registerDeepLinkListener.test.tsx +9 -10
- package/src/test/resizing.test.ts +38 -39
- package/src/test/select.test.tsx +3 -4
- package/src/test/selection-omnibus.test.ts +10 -11
- package/src/test/shapeutils.test.ts +48 -398
- package/src/test/translating.test.ts +9 -10
- package/tldraw.css +627 -726
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -268
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/layout.js +0 -76
- package/dist-cjs/lib/ui/components/primitives/layout.js.map +0 -7
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -245
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/layout.mjs +0 -46
- package/dist-esm/lib/ui/components/primitives/layout.mjs.map +0 -7
- package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -327
- package/src/lib/ui/components/primitives/layout.tsx +0 -107
- package/src/test/inner-outer-margin.test.ts +0 -315
|
@@ -94,7 +94,7 @@ export function updateArrowTargetState({
|
|
|
94
94
|
const target = editor.getShapeAtPoint(pointInPageSpace, {
|
|
95
95
|
hitInside: true,
|
|
96
96
|
hitFrameInside: true,
|
|
97
|
-
margin: arrowKind === 'elbow' ? 8 :
|
|
97
|
+
margin: arrowKind === 'elbow' ? 8 : 0,
|
|
98
98
|
filter: (targetShape) => {
|
|
99
99
|
return (
|
|
100
100
|
!targetShape.isLocked &&
|
|
@@ -187,7 +187,6 @@ export function updateArrowTargetState({
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
const shouldSnapCenter = !isExact && precise && targetGeometryInTargetSpace.isClosed
|
|
190
|
-
// const shouldSnapEdges = !isExact && (precise || !targetGeometryInTargetSpace.isClosed)
|
|
191
190
|
const shouldSnapEdges =
|
|
192
191
|
!isExact && ((precise && arrowKind === 'elbow') || !targetGeometryInTargetSpace.isClosed)
|
|
193
192
|
const shouldSnapEdgePoints =
|
|
@@ -98,7 +98,7 @@ export function ElbowArrowDebug({ arrow }: { arrow: TLArrowShape }) {
|
|
|
98
98
|
y={fullBox.minY - 3}
|
|
99
99
|
fontSize={10}
|
|
100
100
|
fill="black"
|
|
101
|
-
stroke="var(--
|
|
101
|
+
stroke="var(--color-background)"
|
|
102
102
|
strokeWidth={2}
|
|
103
103
|
paintOrder="stroke"
|
|
104
104
|
>
|
|
@@ -109,7 +109,7 @@ export function ElbowArrowDebug({ arrow }: { arrow: TLArrowShape }) {
|
|
|
109
109
|
y={info.A.expanded.y}
|
|
110
110
|
fontSize={10}
|
|
111
111
|
fill="black"
|
|
112
|
-
stroke="var(--
|
|
112
|
+
stroke="var(--color-background)"
|
|
113
113
|
strokeWidth={2}
|
|
114
114
|
paintOrder="stroke"
|
|
115
115
|
>
|
|
@@ -121,7 +121,7 @@ export function ElbowArrowDebug({ arrow }: { arrow: TLArrowShape }) {
|
|
|
121
121
|
y={info.B.expanded.y}
|
|
122
122
|
fontSize={10}
|
|
123
123
|
fill="black"
|
|
124
|
-
stroke="var(--
|
|
124
|
+
stroke="var(--color-background)"
|
|
125
125
|
strokeWidth={2}
|
|
126
126
|
paintOrder="stroke"
|
|
127
127
|
>
|
|
@@ -118,7 +118,6 @@ export class Pointing extends StateNode {
|
|
|
118
118
|
const change = util.onHandleDrag?.(shape, {
|
|
119
119
|
handle: { ...startHandle, x: 0, y: 0 },
|
|
120
120
|
isPrecise: true,
|
|
121
|
-
isCreatingShape: true,
|
|
122
121
|
initial: initial,
|
|
123
122
|
})
|
|
124
123
|
|
|
@@ -146,7 +145,6 @@ export class Pointing extends StateNode {
|
|
|
146
145
|
const change = util.onHandleDrag?.(shape, {
|
|
147
146
|
handle: { ...startHandle, x: 0, y: 0 },
|
|
148
147
|
isPrecise: this.isPrecise,
|
|
149
|
-
isCreatingShape: true,
|
|
150
148
|
initial: initial,
|
|
151
149
|
})
|
|
152
150
|
|
|
@@ -164,7 +162,6 @@ export class Pointing extends StateNode {
|
|
|
164
162
|
const change = util.onHandleDrag?.(this.editor.getShape(shape)!, {
|
|
165
163
|
handle: { ...endHandle, x: point.x, y: point.y },
|
|
166
164
|
isPrecise: false,
|
|
167
|
-
isCreatingShape: true,
|
|
168
165
|
initial: initial,
|
|
169
166
|
})
|
|
170
167
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TestEditor } from '../../../test/TestEditor'
|
|
2
|
+
import { DrawShapeTool } from './DrawShapeTool'
|
|
2
3
|
|
|
3
4
|
let editor: TestEditor
|
|
4
5
|
|
|
@@ -9,6 +10,10 @@ afterEach(() => {
|
|
|
9
10
|
editor?.dispose()
|
|
10
11
|
})
|
|
11
12
|
|
|
13
|
+
describe(DrawShapeTool, () => {
|
|
14
|
+
return
|
|
15
|
+
})
|
|
16
|
+
|
|
12
17
|
describe('When in the idle state', () => {
|
|
13
18
|
it('Returns to select on cancel', () => {
|
|
14
19
|
editor.setCurrentTool('draw')
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
VecLike,
|
|
15
15
|
drawShapeMigrations,
|
|
16
16
|
drawShapeProps,
|
|
17
|
-
getColorValue,
|
|
18
17
|
last,
|
|
19
18
|
lerp,
|
|
20
19
|
rng,
|
|
@@ -52,6 +51,10 @@ export class DrawShapeUtil extends ShapeUtil<TLDrawShape> {
|
|
|
52
51
|
maxPointsPerShape: 600,
|
|
53
52
|
}
|
|
54
53
|
|
|
54
|
+
override canTabTo() {
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
|
|
55
58
|
override hideResizeHandles(shape: TLDrawShape) {
|
|
56
59
|
return getIsDot(shape)
|
|
57
60
|
}
|
|
@@ -290,7 +293,7 @@ function DrawShapeSvg({ shape, zoomOverride }: { shape: TLDrawShape; zoomOverrid
|
|
|
290
293
|
<path
|
|
291
294
|
d={svgInk(allPointsFromSegments, options)}
|
|
292
295
|
strokeLinecap="round"
|
|
293
|
-
fill={
|
|
296
|
+
fill={theme[shape.props.color].solid}
|
|
294
297
|
/>
|
|
295
298
|
</>
|
|
296
299
|
)
|
|
@@ -314,8 +317,8 @@ function DrawShapeSvg({ shape, zoomOverride }: { shape: TLDrawShape; zoomOverrid
|
|
|
314
317
|
<path
|
|
315
318
|
d={solidStrokePath}
|
|
316
319
|
strokeLinecap="round"
|
|
317
|
-
fill={isDot ?
|
|
318
|
-
stroke={
|
|
320
|
+
fill={isDot ? theme[shape.props.color].solid : 'none'}
|
|
321
|
+
stroke={theme[shape.props.color].solid}
|
|
319
322
|
strokeWidth={sw}
|
|
320
323
|
strokeDasharray={isDot ? 'none' : getDrawShapeStrokeDashArray(shape, sw, dotAdjustment)}
|
|
321
324
|
strokeDashoffset="0"
|
|
@@ -144,7 +144,7 @@ export class EmbedShapeUtil extends BaseBoxShapeUtil<TLEmbedShape> {
|
|
|
144
144
|
border: 0,
|
|
145
145
|
boxShadow: getRotatedBoxShadow(pageRotation),
|
|
146
146
|
borderRadius: embedInfo?.definition.overrideOutlineRadius ?? 8,
|
|
147
|
-
background: embedInfo?.definition.backgroundColor ?? 'var(--
|
|
147
|
+
background: embedInfo?.definition.backgroundColor ?? 'var(--color-background)',
|
|
148
148
|
width: w,
|
|
149
149
|
height: h,
|
|
150
150
|
}}
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
compact,
|
|
20
20
|
frameShapeMigrations,
|
|
21
21
|
frameShapeProps,
|
|
22
|
-
getColorValue,
|
|
23
22
|
getDefaultColorTheme,
|
|
24
23
|
lerp,
|
|
25
24
|
resizeBox,
|
|
@@ -220,30 +219,29 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|
|
220
219
|
[shape.id]
|
|
221
220
|
)
|
|
222
221
|
|
|
222
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
223
|
+
const zoomLevel = useValue('zoom level', () => this.editor.getZoomLevel(), [this.editor])
|
|
224
|
+
|
|
223
225
|
const showFrameColors = this.options.showColors
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
? getColorValue(theme, colorToUse, 'frameHeadingFill')
|
|
232
|
-
: theme.background
|
|
233
|
-
const frameHeadingText = getColorValue(theme, colorToUse, 'frameText')
|
|
226
|
+
|
|
227
|
+
const color = theme[shape.props.color]
|
|
228
|
+
const frameFill = showFrameColors ? color.frame.fill : theme.black.frame.fill
|
|
229
|
+
const frameStroke = showFrameColors ? color.frame.stroke : theme.black.frame.stroke
|
|
230
|
+
const frameHeadingStroke = showFrameColors ? color.frame.headingStroke : theme.background
|
|
231
|
+
const frameHeadingFill = showFrameColors ? color.frame.headingFill : theme.background
|
|
232
|
+
const frameHeadingText = showFrameColors ? color.frame.text : theme.text
|
|
234
233
|
|
|
235
234
|
return (
|
|
236
235
|
<>
|
|
237
236
|
<SVGContainer>
|
|
238
237
|
<rect
|
|
239
238
|
className={classNames('tl-frame__body', { 'tl-frame__creating': isCreating })}
|
|
239
|
+
width={shape.props.w + 1 / zoomLevel}
|
|
240
|
+
height={shape.props.h + 1 / zoomLevel}
|
|
240
241
|
fill={frameFill}
|
|
241
242
|
stroke={frameStroke}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
height: `calc(${shape.props.h}px + 1px / var(--tl-zoom))`,
|
|
245
|
-
transform: `translate(calc(-0.5px / var(--tl-zoom)), calc(-0.5px / var(--tl-zoom)))`,
|
|
246
|
-
}}
|
|
243
|
+
y={-0.5 / zoomLevel}
|
|
244
|
+
x={-0.5 / zoomLevel}
|
|
247
245
|
/>
|
|
248
246
|
</SVGContainer>
|
|
249
247
|
{isCreating ? null : (
|
|
@@ -281,16 +279,13 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|
|
281
279
|
const text = createTextJsxFromSpans(this.editor, spans, opts)
|
|
282
280
|
|
|
283
281
|
const showFrameColors = this.options.showColors
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
? getColorValue(theme, colorToUse, 'frameHeadingFill')
|
|
292
|
-
: theme.background
|
|
293
|
-
const frameHeadingText = getColorValue(theme, colorToUse, 'frameText')
|
|
282
|
+
|
|
283
|
+
const color = theme[shape.props.color]
|
|
284
|
+
const frameFill = showFrameColors ? color.frame.fill : theme.black.frame.fill
|
|
285
|
+
const frameStroke = showFrameColors ? color.frame.stroke : theme.black.frame.stroke
|
|
286
|
+
const frameHeadingStroke = showFrameColors ? color.frame.headingStroke : theme.background
|
|
287
|
+
const frameHeadingFill = showFrameColors ? color.frame.headingFill : theme.background
|
|
288
|
+
const frameHeadingText = showFrameColors ? color.frame.text : theme.text
|
|
294
289
|
|
|
295
290
|
return (
|
|
296
291
|
<>
|
|
@@ -64,7 +64,7 @@ export const FrameHeading = memo(function FrameHeading({
|
|
|
64
64
|
overflow: isEditing ? 'visible' : 'hidden',
|
|
65
65
|
maxWidth: `calc(var(--tl-zoom) * ${
|
|
66
66
|
side === 0 || side === 2 ? Math.ceil(width) : Math.ceil(height)
|
|
67
|
-
}px + ${showColors ? '0px' : 'var(--
|
|
67
|
+
}px + ${showColors ? '0px' : 'var(--frame-offset-width)'})`,
|
|
68
68
|
bottom: '100%',
|
|
69
69
|
transform: `${translation} scale(var(--tl-scale)) translateX(${offsetX}px)`,
|
|
70
70
|
}}
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
exhaustiveSwitchError,
|
|
19
19
|
geoShapeMigrations,
|
|
20
20
|
geoShapeProps,
|
|
21
|
-
getColorValue,
|
|
22
21
|
getDefaultColorTheme,
|
|
23
22
|
getFontsFromRichText,
|
|
24
23
|
isEqual,
|
|
@@ -221,7 +220,7 @@ export class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
|
|
|
221
220
|
verticalAlign={verticalAlign}
|
|
222
221
|
richText={richText}
|
|
223
222
|
isSelected={isOnlySelected}
|
|
224
|
-
labelColor={
|
|
223
|
+
labelColor={theme[props.labelColor].solid}
|
|
225
224
|
wrap
|
|
226
225
|
/>
|
|
227
226
|
</HTMLContainer>
|
|
@@ -279,7 +278,7 @@ export class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {
|
|
|
279
278
|
align={props.align}
|
|
280
279
|
verticalAlign={props.verticalAlign}
|
|
281
280
|
richText={props.richText}
|
|
282
|
-
labelColor={
|
|
281
|
+
labelColor={theme[props.labelColor].solid}
|
|
283
282
|
bounds={bounds}
|
|
284
283
|
padding={LABEL_PADDING}
|
|
285
284
|
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TLGeoShape } from '@tldraw/editor'
|
|
2
2
|
import { ShapeFill } from '../../shared/ShapeFill'
|
|
3
3
|
import { STROKE_SIZES } from '../../shared/default-shape-constants'
|
|
4
4
|
import { useDefaultColorTheme } from '../../shared/useDefaultColorTheme'
|
|
@@ -33,7 +33,7 @@ export function GeoShapeBody({
|
|
|
33
33
|
strokeWidth,
|
|
34
34
|
forceSolid,
|
|
35
35
|
randomSeed: shape.id,
|
|
36
|
-
props: { fill: 'none', stroke:
|
|
36
|
+
props: { fill: 'none', stroke: theme[color].solid },
|
|
37
37
|
})}
|
|
38
38
|
</>
|
|
39
39
|
)
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
TLHighlightShapeProps,
|
|
11
11
|
TLResizeInfo,
|
|
12
12
|
VecLike,
|
|
13
|
-
getColorValue,
|
|
14
13
|
highlightShapeMigrations,
|
|
15
14
|
highlightShapeProps,
|
|
16
15
|
last,
|
|
@@ -52,6 +51,9 @@ export class HighlightShapeUtil extends ShapeUtil<TLHighlightShape> {
|
|
|
52
51
|
overlayOpacity: 0.35,
|
|
53
52
|
}
|
|
54
53
|
|
|
54
|
+
override canTabTo() {
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
55
57
|
override hideResizeHandles(shape: TLHighlightShape) {
|
|
56
58
|
return getIsDot(shape)
|
|
57
59
|
}
|
|
@@ -290,12 +292,7 @@ function HighlightRenderer({
|
|
|
290
292
|
: getShapeDot(shape.props.segments[0].points[0])
|
|
291
293
|
|
|
292
294
|
const colorSpace = useColorSpace()
|
|
293
|
-
|
|
294
|
-
const color = getColorValue(
|
|
295
|
-
theme,
|
|
296
|
-
shape.props.color,
|
|
297
|
-
colorSpace === 'p3' ? 'highlightP3' : 'highlightSrgb'
|
|
298
|
-
)
|
|
295
|
+
const color = theme[shape.props.color].highlight[colorSpace]
|
|
299
296
|
|
|
300
297
|
return (
|
|
301
298
|
<path
|
|
@@ -314,9 +314,9 @@ const ImageShape = memo(function ImageShape({ shape }: { shape: TLImageShape })
|
|
|
314
314
|
overflow: 'hidden',
|
|
315
315
|
width: shape.props.w,
|
|
316
316
|
height: shape.props.h,
|
|
317
|
-
color: 'var(--
|
|
318
|
-
backgroundColor: 'var(--
|
|
319
|
-
border: '1px solid var(--
|
|
317
|
+
color: 'var(--color-text-3)',
|
|
318
|
+
backgroundColor: 'var(--color-low)',
|
|
319
|
+
border: '1px solid var(--color-low-border)',
|
|
320
320
|
}}
|
|
321
321
|
>
|
|
322
322
|
<div
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
sortByIndex,
|
|
8
8
|
structuredClone,
|
|
9
9
|
} from '@tldraw/editor'
|
|
10
|
-
import { vi } from 'vitest'
|
|
11
10
|
import { TestEditor } from '../../../test/TestEditor'
|
|
12
11
|
import { TL } from '../../../test/test-jsx'
|
|
13
12
|
|
|
@@ -17,7 +16,7 @@ mockUniqueId(() => 'id' + nextId++)
|
|
|
17
16
|
let editor: TestEditor
|
|
18
17
|
const id = createShapeId('line1')
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
jest.useFakeTimers()
|
|
21
20
|
|
|
22
21
|
beforeEach(() => {
|
|
23
22
|
editor = new TestEditor()
|
|
@@ -339,12 +338,12 @@ describe('Misc', () => {
|
|
|
339
338
|
|
|
340
339
|
expect(editor.getShapePageBounds(box)!.maxX).not.toEqual(editor.getShapePageBounds(line)!.maxX)
|
|
341
340
|
editor.alignShapes(editor.getSelectedShapeIds(), 'right')
|
|
342
|
-
|
|
341
|
+
jest.advanceTimersByTime(1000)
|
|
343
342
|
expect(editor.getShapePageBounds(box)!.maxX).toEqual(editor.getShapePageBounds(line)!.maxX)
|
|
344
343
|
|
|
345
344
|
expect(editor.getShapePageBounds(box)!.maxY).not.toEqual(editor.getShapePageBounds(line)!.maxY)
|
|
346
345
|
editor.alignShapes(editor.getSelectedShapeIds(), 'bottom')
|
|
347
|
-
|
|
346
|
+
jest.advanceTimersByTime(1000)
|
|
348
347
|
expect(editor.getShapePageBounds(box)!.maxY).toEqual(editor.getShapePageBounds(line)!.maxY)
|
|
349
348
|
})
|
|
350
349
|
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
WeakCache,
|
|
13
13
|
ZERO_INDEX_KEY,
|
|
14
14
|
assert,
|
|
15
|
-
getColorValue,
|
|
16
15
|
getIndexAbove,
|
|
17
16
|
getIndexBetween,
|
|
18
17
|
getIndices,
|
|
@@ -36,6 +35,9 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
36
35
|
static override props = lineShapeProps
|
|
37
36
|
static override migrations = lineShapeMigrations
|
|
38
37
|
|
|
38
|
+
override canTabTo() {
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
39
41
|
override hideResizeHandles() {
|
|
40
42
|
return true
|
|
41
43
|
}
|
|
@@ -146,6 +148,8 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
override onHandleDrag(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
|
|
151
|
+
// we should only ever be dragging vertex handles
|
|
152
|
+
if (handle.type !== 'vertex') return
|
|
149
153
|
const newPoint = maybeSnapToGrid(new Vec(handle.x, handle.y), this.editor)
|
|
150
154
|
return {
|
|
151
155
|
...shape,
|
|
@@ -159,25 +163,6 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
|
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
override onHandleDragStart(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
|
|
163
|
-
// For line shapes, if we're dragging a "create" handle, then
|
|
164
|
-
// create a new vertex handle at that point; and make this handle
|
|
165
|
-
// the handle that we're dragging.
|
|
166
|
-
if (handle.type === 'create') {
|
|
167
|
-
return {
|
|
168
|
-
...shape,
|
|
169
|
-
props: {
|
|
170
|
-
...shape.props,
|
|
171
|
-
points: {
|
|
172
|
-
...shape.props.points,
|
|
173
|
-
[handle.index]: { id: handle.index, index: handle.index, x: handle.x, y: handle.y },
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return
|
|
179
|
-
}
|
|
180
|
-
|
|
181
166
|
component(shape: TLLineShape) {
|
|
182
167
|
return (
|
|
183
168
|
<SVGContainer style={{ minWidth: 50, minHeight: 50 }}>
|
|
@@ -347,10 +332,6 @@ function LineShapeSvg({
|
|
|
347
332
|
strokeWidth,
|
|
348
333
|
forceSolid,
|
|
349
334
|
randomSeed: shape.id,
|
|
350
|
-
props: {
|
|
351
|
-
transform: `scale(${scale})`,
|
|
352
|
-
stroke: getColorValue(theme, color, 'solid'),
|
|
353
|
-
fill: 'none',
|
|
354
|
-
},
|
|
335
|
+
props: { transform: `scale(${scale})`, stroke: theme[color].solid, fill: 'none' },
|
|
355
336
|
})
|
|
356
337
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Misc
|
|
3
|
+
exports[`Misc resizes: line shape after resize 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"id": "shape:line1",
|
|
6
6
|
"index": "a1",
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
Vec,
|
|
18
18
|
WeakCache,
|
|
19
19
|
exhaustiveSwitchError,
|
|
20
|
-
getColorValue,
|
|
21
20
|
getDefaultColorTheme,
|
|
22
21
|
getFontsFromRichText,
|
|
23
22
|
isEqual,
|
|
@@ -289,7 +288,7 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
|
|
|
289
288
|
style={{
|
|
290
289
|
width: nw,
|
|
291
290
|
height: nh,
|
|
292
|
-
backgroundColor:
|
|
291
|
+
backgroundColor: theme[color].note.fill,
|
|
293
292
|
borderBottom: hideShadows
|
|
294
293
|
? isDarkMode
|
|
295
294
|
? `${2 * scale}px solid rgb(20, 20, 20)`
|
|
@@ -309,11 +308,7 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
|
|
|
309
308
|
verticalAlign={verticalAlign}
|
|
310
309
|
richText={richText}
|
|
311
310
|
isSelected={isSelected}
|
|
312
|
-
labelColor={
|
|
313
|
-
labelColor === 'black'
|
|
314
|
-
? getColorValue(theme, color, 'noteText')
|
|
315
|
-
: getColorValue(theme, labelColor, 'fill')
|
|
316
|
-
}
|
|
311
|
+
labelColor={labelColor === 'black' ? theme[color].note.text : theme[labelColor].fill}
|
|
317
312
|
wrap
|
|
318
313
|
padding={LABEL_PADDING * scale}
|
|
319
314
|
hasCustomTabBehavior
|
|
@@ -348,10 +343,9 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
|
|
|
348
343
|
align={shape.props.align}
|
|
349
344
|
verticalAlign={shape.props.verticalAlign}
|
|
350
345
|
richText={shape.props.richText}
|
|
351
|
-
labelColor={
|
|
346
|
+
labelColor={theme[shape.props.color].note.text}
|
|
352
347
|
bounds={bounds}
|
|
353
348
|
padding={LABEL_PADDING}
|
|
354
|
-
showTextOutline={false}
|
|
355
349
|
/>
|
|
356
350
|
)
|
|
357
351
|
|
|
@@ -362,7 +356,7 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
|
|
|
362
356
|
rx={1}
|
|
363
357
|
width={NOTE_SIZE}
|
|
364
358
|
height={bounds.h}
|
|
365
|
-
fill={
|
|
359
|
+
fill={theme[shape.props.color].note.fill}
|
|
366
360
|
/>
|
|
367
361
|
{textLabel}
|
|
368
362
|
</>
|
|
@@ -138,7 +138,7 @@ describe('PathBuilder', () => {
|
|
|
138
138
|
.toGeometry()
|
|
139
139
|
|
|
140
140
|
expect(geometry?.toSimpleSvgPath()).toMatchInlineSnapshot(
|
|
141
|
-
`"M0,0L100,100L100,
|
|
141
|
+
`"M0,0L100,100L100,0L91.23532468849007,-7.455843959357096L81.64709960511827,-13.25483368860933L71.44121219537817,-17.39696918901332L60.82354990476352,-19.882250461825734L50.000000178767834,-20.71067750830319L39.17645046288481,-19.882250329702327L28.558788202608024,-17.396968927279783L18.35290084343114,-13.254833302292194L8.764675830847777,-7.455843455996203L6.103515630684342e-7,6.103515559630068e-7L-7.4558434559962,8.764675830847771L-13.254833302292194,18.35290084343114L-17.396968927279772,28.55878820260801L-19.882250329702327,39.17645046288479L-20.710677508303192,50.00000017876782L-19.88225046182574,60.823549904763496L-17.39696918901333,71.44121219537817L-13.254833688609331,81.64709960511824L-7.455843959357106,91.23532468849007L-1.4210854715202004e-14,99.99999999999999L0,0Z"`
|
|
142
142
|
)
|
|
143
143
|
})
|
|
144
144
|
})
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
Geometry2dFilters,
|
|
11
11
|
Geometry2dOptions,
|
|
12
12
|
getPerfectDashProps,
|
|
13
|
-
getVerticesCountForArcLength,
|
|
14
13
|
Group2d,
|
|
15
14
|
modulate,
|
|
16
15
|
PerfectDashTerminal,
|
|
@@ -122,7 +121,6 @@ export interface CubicBezierToPathBuilderCommand extends PathBuilderCommandBase
|
|
|
122
121
|
type: 'cubic'
|
|
123
122
|
cp1: VecModel
|
|
124
123
|
cp2: VecModel
|
|
125
|
-
resolution?: number
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
/** @internal */
|
|
@@ -319,17 +317,8 @@ export class PathBuilder {
|
|
|
319
317
|
// Calculate the sweep angle
|
|
320
318
|
const sweepAngle = endAngle - startAngle
|
|
321
319
|
|
|
322
|
-
// Calculate the approximate arc length. General ellipse arc length is expensive - there's
|
|
323
|
-
// no closed form solution, so we have to do iterative numerical approximation. As we only
|
|
324
|
-
// use this to control the resolution of later approximations, let's cheat and just use the
|
|
325
|
-
// circular arc length with the largest radius:
|
|
326
|
-
const approximateArcLength = Math.max(rx1, ry1) * Math.abs(sweepAngle)
|
|
327
|
-
|
|
328
320
|
// Approximate the arc using cubic bezier curves
|
|
329
321
|
const numSegments = Math.min(4, Math.ceil(Math.abs(sweepAngle) / (Math.PI / 2)))
|
|
330
|
-
const resolutionPerSegment = Math.ceil(
|
|
331
|
-
getVerticesCountForArcLength(approximateArcLength) / numSegments
|
|
332
|
-
)
|
|
333
322
|
const anglePerSegment = sweepAngle / numSegments
|
|
334
323
|
|
|
335
324
|
// Helper function to compute point on ellipse
|
|
@@ -375,16 +364,7 @@ export class PathBuilder {
|
|
|
375
364
|
const cp2y = end.y - handleScale * d2.y
|
|
376
365
|
|
|
377
366
|
const bezierOpts = i === 0 ? opts : { ...opts, mergeWithPrevious: true }
|
|
378
|
-
this.
|
|
379
|
-
end.x,
|
|
380
|
-
end.y,
|
|
381
|
-
cp1x,
|
|
382
|
-
cp1y,
|
|
383
|
-
cp2x,
|
|
384
|
-
cp2y,
|
|
385
|
-
bezierOpts,
|
|
386
|
-
resolutionPerSegment
|
|
387
|
-
)
|
|
367
|
+
this.cubicBezierTo(end.x, end.y, cp1x, cp1y, cp2x, cp2y, bezierOpts)
|
|
388
368
|
}
|
|
389
369
|
|
|
390
370
|
return this
|
|
@@ -398,18 +378,6 @@ export class PathBuilder {
|
|
|
398
378
|
cp2X: number,
|
|
399
379
|
cp2Y: number,
|
|
400
380
|
opts?: PathBuilderCommandOpts
|
|
401
|
-
) {
|
|
402
|
-
return this.cubicBezierToWithResolution(x, y, cp1X, cp1Y, cp2X, cp2Y, opts)
|
|
403
|
-
}
|
|
404
|
-
private cubicBezierToWithResolution(
|
|
405
|
-
x: number,
|
|
406
|
-
y: number,
|
|
407
|
-
cp1X: number,
|
|
408
|
-
cp1Y: number,
|
|
409
|
-
cp2X: number,
|
|
410
|
-
cp2Y: number,
|
|
411
|
-
opts?: PathBuilderCommandOpts,
|
|
412
|
-
resolution?: number
|
|
413
381
|
) {
|
|
414
382
|
this.assertHasMoveTo()
|
|
415
383
|
this.commands.push({
|
|
@@ -420,7 +388,6 @@ export class PathBuilder {
|
|
|
420
388
|
cp2: { x: cp2X, y: cp2Y },
|
|
421
389
|
isClose: false,
|
|
422
390
|
opts,
|
|
423
|
-
resolution,
|
|
424
391
|
})
|
|
425
392
|
return this
|
|
426
393
|
}
|
|
@@ -1005,7 +972,6 @@ export class PathBuilderGeometry2d extends Geometry2d {
|
|
|
1005
972
|
cp1: Vec.From(command.cp1),
|
|
1006
973
|
cp2: Vec.From(command.cp2),
|
|
1007
974
|
end: Vec.From(command),
|
|
1008
|
-
resolution: command.resolution,
|
|
1009
975
|
})
|
|
1010
976
|
)
|
|
1011
977
|
break
|
|
@@ -128,7 +128,6 @@ export const RichTextLabel = React.memo(function RichTextLabel({
|
|
|
128
128
|
return (
|
|
129
129
|
<div
|
|
130
130
|
className={`${cssPrefix}-label tl-text-wrapper tl-rich-text-wrapper`}
|
|
131
|
-
aria-hidden={!isEditing}
|
|
132
131
|
data-font={font}
|
|
133
132
|
data-align={align}
|
|
134
133
|
data-hastext={!isEmpty}
|
|
@@ -194,7 +193,6 @@ export interface RichTextSVGProps {
|
|
|
194
193
|
wrap?: boolean
|
|
195
194
|
labelColor: string
|
|
196
195
|
padding: number
|
|
197
|
-
showTextOutline?: boolean
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
/**
|
|
@@ -212,7 +210,6 @@ export function RichTextSVG({
|
|
|
212
210
|
wrap,
|
|
213
211
|
labelColor,
|
|
214
212
|
padding,
|
|
215
|
-
showTextOutline = true,
|
|
216
213
|
}: RichTextSVGProps) {
|
|
217
214
|
const editor = useEditor()
|
|
218
215
|
const html = renderHtmlFromRichText(editor, richText)
|
|
@@ -248,7 +245,6 @@ export function RichTextSVG({
|
|
|
248
245
|
wordWrap: 'break-word' as const,
|
|
249
246
|
overflowWrap: 'break-word' as const,
|
|
250
247
|
whiteSpace: 'pre-wrap',
|
|
251
|
-
textShadow: showTextOutline ? 'var(--tl-text-outline)' : 'none',
|
|
252
248
|
}
|
|
253
249
|
|
|
254
250
|
return (
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getColorValue,
|
|
3
2
|
TLDefaultColorStyle,
|
|
4
3
|
TLDefaultColorTheme,
|
|
5
4
|
TLDefaultFillStyle,
|
|
@@ -30,13 +29,13 @@ export const ShapeFill = React.memo(function ShapeFill({
|
|
|
30
29
|
return null
|
|
31
30
|
}
|
|
32
31
|
case 'solid': {
|
|
33
|
-
return <path fill={
|
|
32
|
+
return <path fill={theme[color].semi} d={d} />
|
|
34
33
|
}
|
|
35
34
|
case 'semi': {
|
|
36
35
|
return <path fill={theme.solid} d={d} />
|
|
37
36
|
}
|
|
38
37
|
case 'fill': {
|
|
39
|
-
return <path fill={
|
|
38
|
+
return <path fill={theme[color].fill} d={d} />
|
|
40
39
|
}
|
|
41
40
|
case 'pattern': {
|
|
42
41
|
return <PatternFill theme={theme} color={color} fill={fill} d={d} scale={scale} />
|
|
@@ -54,13 +53,13 @@ export function PatternFill({ d, color, theme }: ShapeFillProps) {
|
|
|
54
53
|
|
|
55
54
|
return (
|
|
56
55
|
<>
|
|
57
|
-
<path fill={
|
|
56
|
+
<path fill={theme[color].pattern} d={d} />
|
|
58
57
|
<path
|
|
59
58
|
fill={
|
|
60
59
|
svgExport
|
|
61
60
|
? `url(#${getHashPatternZoomName(1, theme.id)})`
|
|
62
61
|
: teenyTiny
|
|
63
|
-
?
|
|
62
|
+
? theme[color].semi
|
|
64
63
|
: `url(#${getHashPatternZoomName(zoomLevel, theme.id)})`
|
|
65
64
|
}
|
|
66
65
|
d={d}
|
|
@@ -21,7 +21,6 @@ export function SvgTextLabel({
|
|
|
21
21
|
bounds,
|
|
22
22
|
padding = 16,
|
|
23
23
|
stroke = true,
|
|
24
|
-
showTextOutline = true,
|
|
25
24
|
}: {
|
|
26
25
|
fontSize: number
|
|
27
26
|
font: TLDefaultFontStyle
|
|
@@ -34,7 +33,6 @@ export function SvgTextLabel({
|
|
|
34
33
|
bounds: Box
|
|
35
34
|
padding?: number
|
|
36
35
|
stroke?: boolean
|
|
37
|
-
showTextOutline?: boolean
|
|
38
36
|
}) {
|
|
39
37
|
const editor = useEditor()
|
|
40
38
|
const theme = useDefaultColorTheme()
|
|
@@ -70,10 +68,10 @@ export function SvgTextLabel({
|
|
|
70
68
|
const mainSpans = createTextJsxFromSpans(editor, spans, opts)
|
|
71
69
|
|
|
72
70
|
let outlineSpans = null
|
|
73
|
-
if (
|
|
71
|
+
if (stroke) {
|
|
74
72
|
opts.fill = theme.background
|
|
75
73
|
opts.stroke = theme.background
|
|
76
|
-
opts.strokeWidth =
|
|
74
|
+
opts.strokeWidth = 2
|
|
77
75
|
outlineSpans = createTextJsxFromSpans(editor, spans, opts)
|
|
78
76
|
}
|
|
79
77
|
|