@bigbluebutton/tldraw 2.0.0-alpha.34 → 2.0.0-alpha.35
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.js +4 -4
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/lib/Tldraw.js +1 -2
- package/dist-cjs/lib/Tldraw.js.map +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +1 -1
- package/dist-cjs/lib/canvas/TldrawHoveredShapeIndicator.js +1 -2
- package/dist-cjs/lib/canvas/TldrawHoveredShapeIndicator.js.map +1 -1
- package/dist-cjs/lib/canvas/TldrawScribble.js +1 -2
- package/dist-cjs/lib/canvas/TldrawScribble.js.map +1 -1
- package/dist-cjs/lib/canvas/TldrawSelectionBackground.js +1 -2
- package/dist-cjs/lib/canvas/TldrawSelectionBackground.js.map +1 -1
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +1 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +1 -1
- package/dist-cjs/lib/defaultExternalContentHandlers.js +3 -6
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +7 -14
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/toolStates/Idle.js +1 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Idle.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +6 -12
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +1 -1
- package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js +12 -24
- package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +1 -1
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js +1 -2
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/FrameShapeTool.js +4 -8
- package/dist-cjs/lib/shapes/frame/FrameShapeTool.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +3 -6
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -2
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +4 -8
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +1 -1
- package/dist-cjs/lib/shapes/geo/toolStates/Idle.js +1 -2
- package/dist-cjs/lib/shapes/geo/toolStates/Idle.js.map +1 -1
- package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js +2 -4
- package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js.map +1 -1
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +5 -10
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/line/components/svg.js +1 -2
- package/dist-cjs/lib/shapes/line/components/svg.js.map +1 -1
- package/dist-cjs/lib/shapes/line/toolStates/Pointing.js +5 -10
- package/dist-cjs/lib/shapes/line/toolStates/Pointing.js.map +1 -1
- package/dist-cjs/lib/shapes/poll/components/CustomizedAxisTick.js +1 -2
- package/dist-cjs/lib/shapes/poll/components/CustomizedAxisTick.js.map +1 -1
- package/dist-cjs/lib/shapes/poll/components/poll-content.js +1 -2
- package/dist-cjs/lib/shapes/poll/components/poll-content.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/TextHelpers.js +2 -4
- package/dist-cjs/lib/shapes/shared/TextHelpers.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/createTextSvgElementFromSpans.js +1 -2
- package/dist-cjs/lib/shapes/shared/createTextSvgElementFromSpans.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/defaultStyleDefs.js +8 -16
- package/dist-cjs/lib/shapes/shared/defaultStyleDefs.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/freehand/getStrokePoints.js +6 -12
- package/dist-cjs/lib/shapes/shared/freehand/getStrokePoints.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/freehand/setStrokePointRadii.js +1 -2
- package/dist-cjs/lib/shapes/shared/freehand/setStrokePointRadii.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/freehand/svgInk.js +2 -4
- package/dist-cjs/lib/shapes/shared/freehand/svgInk.js.map +1 -1
- package/dist-cjs/lib/shapes/shared/useEditableText.js +5 -10
- package/dist-cjs/lib/shapes/shared/useEditableText.js.map +1 -1
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +6 -12
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/text/toolStates/Idle.js +1 -2
- package/dist-cjs/lib/shapes/text/toolStates/Idle.js.map +1 -1
- package/dist-cjs/lib/shapes/text/toolStates/Pointing.js +1 -2
- package/dist-cjs/lib/shapes/text/toolStates/Pointing.js.map +1 -1
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +2 -4
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +1 -1
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +2 -4
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js +25 -30
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js +12 -24
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/TranslatingCrop.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/TranslatingCrop.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Cropping.js +8 -16
- package/dist-cjs/lib/tools/SelectTool/childStates/Cropping.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +3 -6
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js +2 -4
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +21 -42
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingCropHandle.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingCropHandle.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +5 -10
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +2 -4
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js +1 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +4 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +1 -1
- package/dist-cjs/lib/tools/SelectTool/children/DraggingHandle.js +3 -6
- package/dist-cjs/lib/tools/SelectTool/children/DraggingHandle.js.map +1 -1
- package/dist-cjs/lib/tools/selection-logic/updateHoveredId.js +1 -2
- package/dist-cjs/lib/tools/selection-logic/updateHoveredId.js.map +1 -1
- package/dist-cjs/lib/ui/assetUrls.js +1 -2
- package/dist-cjs/lib/ui/assetUrls.js.map +1 -1
- package/dist-cjs/lib/ui/components/ActionsMenu.js +2 -4
- package/dist-cjs/lib/ui/components/ActionsMenu.js.map +1 -1
- package/dist-cjs/lib/ui/components/BackToContent.js +1 -2
- package/dist-cjs/lib/ui/components/BackToContent.js.map +1 -1
- package/dist-cjs/lib/ui/components/ContextMenu.js +3 -6
- package/dist-cjs/lib/ui/components/ContextMenu.js.map +1 -1
- package/dist-cjs/lib/ui/components/DebugPanel.js +2 -4
- package/dist-cjs/lib/ui/components/DebugPanel.js.map +1 -1
- package/dist-cjs/lib/ui/components/EditLinkDialog.js +2 -4
- package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +1 -1
- package/dist-cjs/lib/ui/components/EmbedDialog.js +1 -2
- package/dist-cjs/lib/ui/components/EmbedDialog.js.map +1 -1
- package/dist-cjs/lib/ui/components/FollowingIndicator.js +2 -4
- package/dist-cjs/lib/ui/components/FollowingIndicator.js.map +1 -1
- package/dist-cjs/lib/ui/components/HelpMenu.js +2 -4
- package/dist-cjs/lib/ui/components/HelpMenu.js.map +1 -1
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog.js +2 -4
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog.js.map +1 -1
- package/dist-cjs/lib/ui/components/Menu.js +5 -10
- package/dist-cjs/lib/ui/components/Menu.js.map +1 -1
- package/dist-cjs/lib/ui/components/NavigationZone/Minimap.js +3 -6
- package/dist-cjs/lib/ui/components/NavigationZone/Minimap.js.map +1 -1
- package/dist-cjs/lib/ui/components/PageMenu/PageMenu.js +5 -10
- package/dist-cjs/lib/ui/components/PageMenu/PageMenu.js.map +1 -1
- package/dist-cjs/lib/ui/components/PenModeToggle.js +1 -2
- package/dist-cjs/lib/ui/components/PenModeToggle.js.map +1 -1
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +1 -2
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +1 -1
- package/dist-cjs/lib/ui/components/StylePanel/StylePanel.js +1 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanel.js.map +1 -1
- package/dist-cjs/lib/ui/components/Toasts.js +1 -2
- package/dist-cjs/lib/ui/components/Toasts.js.map +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +1 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +1 -1
- package/dist-cjs/lib/ui/components/TrashButton.js +1 -2
- package/dist-cjs/lib/ui/components/TrashButton.js.map +1 -1
- package/dist-cjs/lib/ui/components/primitives/ButtonPicker.js +2 -4
- package/dist-cjs/lib/ui/components/primitives/ButtonPicker.js.map +1 -1
- package/dist-cjs/lib/ui/components/primitives/Input.js +1 -2
- package/dist-cjs/lib/ui/components/primitives/Input.js.map +1 -1
- package/dist-cjs/lib/ui/components/primitives/Slider.js +1 -2
- package/dist-cjs/lib/ui/components/primitives/Slider.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/clipboard/pasteExcalidrawContent.js +2 -4
- package/dist-cjs/lib/ui/hooks/clipboard/pasteExcalidrawContent.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/menuHelpers.js +5 -10
- package/dist-cjs/lib/ui/hooks/menuHelpers.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useActions.js +73 -146
- package/dist-cjs/lib/ui/hooks/useActions.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +6 -12
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useHighDpiCanvas.js +1 -2
- package/dist-cjs/lib/ui/hooks/useHighDpiCanvas.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useInsertMedia.js +1 -2
- package/dist-cjs/lib/ui/hooks/useInsertMedia.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +8 -16
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useMenuIsOpen.js +1 -2
- package/dist-cjs/lib/ui/hooks/useMenuIsOpen.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useMenuSchema.js +2 -4
- package/dist-cjs/lib/ui/hooks/useMenuSchema.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/usePreloadAssets.js +2 -4
- package/dist-cjs/lib/ui/hooks/usePreloadAssets.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/usePreloadIcons.js +1 -2
- package/dist-cjs/lib/ui/hooks/usePreloadIcons.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/usePrint.js +2 -4
- package/dist-cjs/lib/ui/hooks/usePrint.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useRevelantStyles.js +1 -2
- package/dist-cjs/lib/ui/hooks/useRevelantStyles.js.map +1 -1
- package/dist-cjs/lib/utils/assets/is-gif-animated.js +9 -0
- package/dist-cjs/lib/utils/assets/is-gif-animated.js.map +1 -1
- package/dist-cjs/lib/utils/export/export.js +2 -4
- package/dist-cjs/lib/utils/export/export.js.map +1 -1
- package/dist-cjs/lib/utils/export/exportAs.js +1 -2
- package/dist-cjs/lib/utils/export/exportAs.js.map +1 -1
- package/dist-cjs/lib/utils/frames/frames.js +4 -8
- package/dist-cjs/lib/utils/frames/frames.js.map +1 -1
- package/dist-cjs/lib/utils/static-assets/assetUrls.js +1 -2
- package/dist-cjs/lib/utils/static-assets/assetUrls.js.map +1 -1
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +10 -20
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +1 -1
- package/dist-cjs/lib/utils/tldr/file.js +1 -2
- package/dist-cjs/lib/utils/tldr/file.js.map +1 -1
- package/dist-esm/lib/Tldraw.mjs +1 -2
- package/dist-esm/lib/Tldraw.mjs.map +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +1 -1
- package/dist-esm/lib/canvas/TldrawHoveredShapeIndicator.mjs +1 -2
- package/dist-esm/lib/canvas/TldrawHoveredShapeIndicator.mjs.map +1 -1
- package/dist-esm/lib/canvas/TldrawScribble.mjs +1 -2
- package/dist-esm/lib/canvas/TldrawScribble.mjs.map +1 -1
- package/dist-esm/lib/canvas/TldrawSelectionBackground.mjs +1 -2
- package/dist-esm/lib/canvas/TldrawSelectionBackground.mjs.map +1 -1
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +1 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +1 -1
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +3 -6
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +1 -1
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +7 -14
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/arrow/toolStates/Idle.mjs +1 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Idle.mjs.map +1 -1
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +6 -12
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +1 -1
- package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs +12 -24
- package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +1 -1
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs +1 -2
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs +4 -8
- package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +3 -6
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -2
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +4 -8
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +1 -1
- package/dist-esm/lib/shapes/geo/toolStates/Idle.mjs +1 -2
- package/dist-esm/lib/shapes/geo/toolStates/Idle.mjs.map +1 -1
- package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs +2 -4
- package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs.map +1 -1
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +5 -10
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/line/components/svg.mjs +1 -2
- package/dist-esm/lib/shapes/line/components/svg.mjs.map +1 -1
- package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs +5 -10
- package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs.map +1 -1
- package/dist-esm/lib/shapes/poll/components/CustomizedAxisTick.mjs +1 -2
- package/dist-esm/lib/shapes/poll/components/CustomizedAxisTick.mjs.map +1 -1
- package/dist-esm/lib/shapes/poll/components/poll-content.mjs +1 -2
- package/dist-esm/lib/shapes/poll/components/poll-content.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/TextHelpers.mjs +2 -4
- package/dist-esm/lib/shapes/shared/TextHelpers.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/createTextSvgElementFromSpans.mjs +1 -2
- package/dist-esm/lib/shapes/shared/createTextSvgElementFromSpans.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/defaultStyleDefs.mjs +8 -16
- package/dist-esm/lib/shapes/shared/defaultStyleDefs.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/freehand/getStrokePoints.mjs +6 -12
- package/dist-esm/lib/shapes/shared/freehand/getStrokePoints.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/freehand/setStrokePointRadii.mjs +1 -2
- package/dist-esm/lib/shapes/shared/freehand/setStrokePointRadii.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/freehand/svgInk.mjs +2 -4
- package/dist-esm/lib/shapes/shared/freehand/svgInk.mjs.map +1 -1
- package/dist-esm/lib/shapes/shared/useEditableText.mjs +5 -10
- package/dist-esm/lib/shapes/shared/useEditableText.mjs.map +1 -1
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +6 -12
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/text/toolStates/Idle.mjs +1 -2
- package/dist-esm/lib/shapes/text/toolStates/Idle.mjs.map +1 -1
- package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs +1 -2
- package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs.map +1 -1
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +2 -4
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +2 -4
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs +25 -30
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs +12 -24
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/TranslatingCrop.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/TranslatingCrop.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Cropping.mjs +8 -16
- package/dist-esm/lib/tools/SelectTool/childStates/Cropping.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +3 -6
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs +2 -4
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +21 -42
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/PointingCropHandle.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingCropHandle.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +5 -10
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +2 -4
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs +1 -2
- package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +4 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +1 -1
- package/dist-esm/lib/tools/SelectTool/children/DraggingHandle.mjs +3 -6
- package/dist-esm/lib/tools/SelectTool/children/DraggingHandle.mjs.map +1 -1
- package/dist-esm/lib/tools/selection-logic/updateHoveredId.mjs +1 -2
- package/dist-esm/lib/tools/selection-logic/updateHoveredId.mjs.map +1 -1
- package/dist-esm/lib/ui/assetUrls.mjs +1 -2
- package/dist-esm/lib/ui/assetUrls.mjs.map +1 -1
- package/dist-esm/lib/ui/components/ActionsMenu.mjs +2 -4
- package/dist-esm/lib/ui/components/ActionsMenu.mjs.map +1 -1
- package/dist-esm/lib/ui/components/BackToContent.mjs +1 -2
- package/dist-esm/lib/ui/components/BackToContent.mjs.map +1 -1
- package/dist-esm/lib/ui/components/ContextMenu.mjs +3 -6
- package/dist-esm/lib/ui/components/ContextMenu.mjs.map +1 -1
- package/dist-esm/lib/ui/components/DebugPanel.mjs +2 -4
- package/dist-esm/lib/ui/components/DebugPanel.mjs.map +1 -1
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs +2 -4
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +1 -1
- package/dist-esm/lib/ui/components/EmbedDialog.mjs +1 -2
- package/dist-esm/lib/ui/components/EmbedDialog.mjs.map +1 -1
- package/dist-esm/lib/ui/components/FollowingIndicator.mjs +2 -4
- package/dist-esm/lib/ui/components/FollowingIndicator.mjs.map +1 -1
- package/dist-esm/lib/ui/components/HelpMenu.mjs +2 -4
- package/dist-esm/lib/ui/components/HelpMenu.mjs.map +1 -1
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog.mjs +2 -4
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog.mjs.map +1 -1
- package/dist-esm/lib/ui/components/Menu.mjs +5 -10
- package/dist-esm/lib/ui/components/Menu.mjs.map +1 -1
- package/dist-esm/lib/ui/components/NavigationZone/Minimap.mjs +3 -6
- package/dist-esm/lib/ui/components/NavigationZone/Minimap.mjs.map +1 -1
- package/dist-esm/lib/ui/components/PageMenu/PageMenu.mjs +5 -10
- package/dist-esm/lib/ui/components/PageMenu/PageMenu.mjs.map +1 -1
- package/dist-esm/lib/ui/components/PenModeToggle.mjs +1 -2
- package/dist-esm/lib/ui/components/PenModeToggle.mjs.map +1 -1
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +1 -2
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +1 -1
- package/dist-esm/lib/ui/components/StylePanel/StylePanel.mjs +1 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanel.mjs.map +1 -1
- package/dist-esm/lib/ui/components/Toasts.mjs +1 -2
- package/dist-esm/lib/ui/components/Toasts.mjs.map +1 -1
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +1 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +1 -1
- package/dist-esm/lib/ui/components/TrashButton.mjs +1 -2
- package/dist-esm/lib/ui/components/TrashButton.mjs.map +1 -1
- package/dist-esm/lib/ui/components/primitives/ButtonPicker.mjs +2 -4
- package/dist-esm/lib/ui/components/primitives/ButtonPicker.mjs.map +1 -1
- package/dist-esm/lib/ui/components/primitives/Input.mjs +1 -2
- package/dist-esm/lib/ui/components/primitives/Input.mjs.map +1 -1
- package/dist-esm/lib/ui/components/primitives/Slider.mjs +1 -2
- package/dist-esm/lib/ui/components/primitives/Slider.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/clipboard/pasteExcalidrawContent.mjs +2 -4
- package/dist-esm/lib/ui/hooks/clipboard/pasteExcalidrawContent.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/menuHelpers.mjs +5 -10
- package/dist-esm/lib/ui/hooks/menuHelpers.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useActions.mjs +73 -146
- package/dist-esm/lib/ui/hooks/useActions.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +6 -12
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useHighDpiCanvas.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useHighDpiCanvas.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useInsertMedia.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useInsertMedia.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +8 -16
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useMenuIsOpen.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useMenuIsOpen.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useMenuSchema.mjs +2 -4
- package/dist-esm/lib/ui/hooks/useMenuSchema.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/usePreloadAssets.mjs +2 -4
- package/dist-esm/lib/ui/hooks/usePreloadAssets.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/usePreloadIcons.mjs +1 -2
- package/dist-esm/lib/ui/hooks/usePreloadIcons.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/usePrint.mjs +2 -4
- package/dist-esm/lib/ui/hooks/usePrint.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useRevelantStyles.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useRevelantStyles.mjs.map +1 -1
- package/dist-esm/lib/utils/assets/is-gif-animated.mjs +9 -0
- package/dist-esm/lib/utils/assets/is-gif-animated.mjs.map +1 -1
- package/dist-esm/lib/utils/export/export.mjs +2 -4
- package/dist-esm/lib/utils/export/export.mjs.map +1 -1
- package/dist-esm/lib/utils/export/exportAs.mjs +1 -2
- package/dist-esm/lib/utils/export/exportAs.mjs.map +1 -1
- package/dist-esm/lib/utils/frames/frames.mjs +4 -8
- package/dist-esm/lib/utils/frames/frames.mjs.map +1 -1
- package/dist-esm/lib/utils/static-assets/assetUrls.mjs +1 -2
- package/dist-esm/lib/utils/static-assets/assetUrls.mjs.map +1 -1
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +10 -20
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +1 -1
- package/dist-esm/lib/utils/tldr/file.mjs +1 -2
- package/dist-esm/lib/utils/tldr/file.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/shapes/video/VideoShapeUtil.tsx"],
|
|
4
4
|
"sourcesContent": ["import {\n\tBaseBoxShapeUtil,\n\tHTMLContainer,\n\tTLVideoShape,\n\ttoDomPrecision,\n\ttrack,\n\tuseIsEditing,\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n} from '@bigbluebutton/editor'\nimport React from 'react'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { usePrefersReducedMotion } from '../shared/usePrefersReducedMotion'\n\n/** @public */\nexport class VideoShapeUtil extends BaseBoxShapeUtil<TLVideoShape> {\n\tstatic override type = 'video' as const\n\tstatic override props = videoShapeProps\n\tstatic override migrations = videoShapeMigrations\n\n\toverride canEdit = () => true\n\toverride isAspectRatioLocked = () => true\n\n\toverride getDefaultProps(): TLVideoShape['props'] {\n\t\treturn {\n\t\t\tw: 100,\n\t\t\th: 100,\n\t\t\tassetId: null,\n\t\t\ttime: 0,\n\t\t\tplaying: true,\n\t\t\turl: '',\n\t\t}\n\t}\n\n\tcomponent(shape: TLVideoShape) {\n\t\treturn <TLVideoUtilComponent shape={shape} videoUtil={this} />\n\t}\n\n\tindicator(shape: TLVideoShape) {\n\t\treturn <rect width={toDomPrecision(shape.props.w)} height={toDomPrecision(shape.props.h)} />\n\t}\n\n\toverride toSvg(shape: TLVideoShape) {\n\t\tconst g = document.createElementNS('http://www.w3.org/2000/svg', 'g')\n\t\tconst image = document.createElementNS('http://www.w3.org/2000/svg', 'image')\n\t\timage.setAttributeNS('http://www.w3.org/1999/xlink', 'href', serializeVideo(shape.id))\n\t\timage.setAttribute('width', shape.props.w.toString())\n\t\timage.setAttribute('height', shape.props.h.toString())\n\t\tg.appendChild(image)\n\n\t\treturn g\n\t}\n}\n\n// Function from v1, could be improved bu explicitly using this.model.time (?)\nfunction serializeVideo(id: string): string {\n\tconst splitId = id.split(':')[1]\n\tconst video = document.querySelector(`.tl-video-shape-${splitId}`) as HTMLVideoElement\n\tif (video) {\n\t\tconst canvas = document.createElement('canvas')\n\t\tcanvas.width = video.videoWidth\n\t\tcanvas.height = video.videoHeight\n\t\tcanvas.getContext('2d')!.drawImage(video, 0, 0)\n\t\treturn canvas.toDataURL('image/png')\n\t} else throw new Error('Video with id ' + splitId + ' not found')\n}\n\nconst TLVideoUtilComponent = track(function TLVideoUtilComponent(props: {\n\tshape: TLVideoShape\n\tvideoUtil: VideoShapeUtil\n}) {\n\tconst { shape, videoUtil } = props\n\tconst showControls =\n\t\tvideoUtil.editor.getShapeGeometry(shape).bounds.w * videoUtil.editor.getZoomLevel() >= 110\n\tconst asset = shape.props.assetId ? videoUtil.editor.getAsset(shape.props.assetId) : null\n\tconst { time, playing } = shape.props\n\tconst isEditing = useIsEditing(shape.id)\n\tconst prefersReducedMotion = usePrefersReducedMotion()\n\n\tconst rVideo = React.useRef<HTMLVideoElement>(null!)\n\n\tconst handlePlay = React.useCallback<React.ReactEventHandler<HTMLVideoElement>>(\n\t\t(e) => {\n\t\t\tconst video = e.currentTarget\n\n\t\t\tvideoUtil.editor.updateShapes([\n\t\t\t\t{\n\t\t\t\t\ttype: 'video',\n\t\t\t\t\tid: shape.id,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\tplaying: true,\n\t\t\t\t\t\ttime: video.currentTime,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t])\n\t\t},\n\t\t[shape.id, videoUtil.editor]\n\t)\n\n\tconst handlePause = React.useCallback<React.ReactEventHandler<HTMLVideoElement>>(\n\t\t(e) => {\n\t\t\tconst video = e.currentTarget\n\n\t\t\tvideoUtil.editor.updateShapes([\n\t\t\t\t{\n\t\t\t\t\ttype: 'video',\n\t\t\t\t\tid: shape.id,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\tplaying: false,\n\t\t\t\t\t\ttime: video.currentTime,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t])\n\t\t},\n\t\t[shape.id, videoUtil.editor]\n\t)\n\n\tconst handleSetCurrentTime = React.useCallback<React.ReactEventHandler<HTMLVideoElement>>(\n\t\t(e) => {\n\t\t\tconst video = e.currentTarget\n\n\t\t\tif (isEditing) {\n\t\t\t\tvideoUtil.editor.updateShapes([\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'video',\n\t\t\t\t\t\tid: shape.id,\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\ttime: video.currentTime,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t])\n\t\t\t}\n\t\t},\n\t\t[isEditing, shape.id, videoUtil.editor]\n\t)\n\n\tconst [isLoaded, setIsLoaded] = React.useState(false)\n\n\tconst handleLoadedData = React.useCallback<React.ReactEventHandler<HTMLVideoElement>>(\n\t\t(e) => {\n\t\t\tconst video = e.currentTarget\n\t\t\tif (time !== video.currentTime) {\n\t\t\t\tvideo.currentTime = time\n\t\t\t}\n\n\t\t\tif (!playing) {\n\t\t\t\tvideo.pause()\n\t\t\t}\n\n\t\t\tsetIsLoaded(true)\n\t\t},\n\t\t[playing, time]\n\t)\n\n\t// If the current time changes and we're not editing the video, update the video time\n\tReact.useEffect(() => {\n\t\tconst video = rVideo.current\n\n\t\tif (!video) return\n\n\t\tif (isLoaded && !isEditing && time !== video.currentTime) {\n\t\t\tvideo.currentTime = time\n\t\t}\n\n\t\tif (isEditing) {\n\t\t\tif (document.activeElement !== video) {\n\t\t\t\tvideo.focus()\n\t\t\t}\n\t\t}\n\t}, [isEditing, isLoaded, time])\n\n\tReact.useEffect(() => {\n\t\tif (prefersReducedMotion) {\n\t\t\tconst video = rVideo.current\n\t\t\tvideo.pause()\n\t\t\tvideo.currentTime = 0\n\t\t}\n\t}, [rVideo, prefersReducedMotion])\n\n\treturn (\n\t\t<>\n\t\t\t<HTMLContainer id={shape.id}>\n\t\t\t\t<div className=\"tl-counter-scaled\">\n\t\t\t\t\t{asset?.props.src ? (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tref={rVideo}\n\t\t\t\t\t\t\tstyle={isEditing ? { pointerEvents: 'all' } : undefined}\n\t\t\t\t\t\t\tclassName={`tl-video tl-video-shape-${shape.id.split(':')[1]}`}\n\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\tplaysInline\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tdisableRemotePlayback\n\t\t\t\t\t\t\tdisablePictureInPicture\n\t\t\t\t\t\t\tcontrols={isEditing && showControls}\n\t\t\t\t\t\t\tonPlay={handlePlay}\n\t\t\t\t\t\t\tonPause={handlePause}\n\t\t\t\t\t\t\tonTimeUpdate={handleSetCurrentTime}\n\t\t\t\t\t\t\tonLoadedData={handleLoadedData}\n\t\t\t\t\t\t\thidden={!isLoaded}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source src={asset.props.src} />\n\t\t\t\t\t\t</video>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t</HTMLContainer>\n\t\t\t{'url' in shape.props && shape.props.url && (\n\t\t\t\t<HyperlinkButton url={shape.props.url} zoomLevel={videoUtil.editor.getZoomLevel()} />\n\t\t\t)}\n\t\t</>\n\t)\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCS;AAnCT,oBASO;AACP,mBAAkB;AAClB,6BAAgC;AAChC,qCAAwC;AAGjC,MAAM,uBAAuB,+BAA+B;AAAA,EAClE,OAAgB,OAAO;AAAA,EACvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,UAAU,MAAM;AAAA,EAChB,sBAAsB,MAAM;AAAA,EAE5B,kBAAyC;AACjD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG;AAAA,MACH,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,KAAK;AAAA,IACN;AAAA,EACD;AAAA,EAEA,UAAU,OAAqB;AAC9B,WAAO,4CAAC,wBAAqB,OAAc,WAAW,MAAM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AAQ,CAAC;AAAA,QAET,sDAAC,YAAO,KAAK,MAAM,MAAM,KAAK;AAAA;AAAA,IAC/B,IACG,MACL,GACD;AAAA,IACC,SAAS,MAAM,SAAS,MAAM,MAAM,OACpC,4CAAC,0CAAgB,KAAK,MAAM,MAAM,KAAK,WAAW,UAAU,OAAO,aAAa,GAAG;AAAA,KAErF;AAEF,CAAC;",
|
|
6
6
|
"names": ["TLVideoUtilComponent", "React"]
|
|
7
7
|
}
|
|
@@ -35,8 +35,7 @@ class Erasing extends import_editor.StateNode {
|
|
|
35
35
|
const { originPagePoint } = this.editor.inputs;
|
|
36
36
|
this.excludedShapeIds = new Set(
|
|
37
37
|
this.editor.getCurrentPageShapes().filter((shape) => {
|
|
38
|
-
if (this.editor.isShapeOrAncestorLocked(shape))
|
|
39
|
-
return true;
|
|
38
|
+
if (this.editor.isShapeOrAncestorLocked(shape)) return true;
|
|
40
39
|
if (this.editor.isShapeOfType(shape, "group") || this.editor.isShapeOfType(shape, "frame")) {
|
|
41
40
|
const pointInShapeShape = this.editor.getPointInShapeSpace(shape, originPagePoint);
|
|
42
41
|
const geometry = this.editor.getShapeGeometry(shape);
|
|
@@ -82,8 +81,7 @@ class Erasing extends import_editor.StateNode {
|
|
|
82
81
|
this.pushPointToScribble();
|
|
83
82
|
const erasing = new Set(erasingShapeIds);
|
|
84
83
|
for (const shape of currentPageShapes) {
|
|
85
|
-
if (this.editor.isShapeOfType(shape, "group"))
|
|
86
|
-
continue;
|
|
84
|
+
if (this.editor.isShapeOfType(shape, "group")) continue;
|
|
87
85
|
const pageMask = this.editor.getShapeMask(shape.id);
|
|
88
86
|
if (pageMask && !(0, import_editor.pointInPolygon)(currentPagePoint, pageMask)) {
|
|
89
87
|
continue;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/tools/EraserTool/childStates/Erasing.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n\tHIT_TEST_MARGIN,\n\tStateNode,\n\tTLEventHandlers,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLPointerEventInfo,\n\tTLShapeId,\n\tpointInPolygon,\n} from '@bigbluebutton/editor'\n\nexport class Erasing extends StateNode {\n\tstatic override id = 'erasing'\n\n\tprivate info = {} as TLPointerEventInfo\n\tprivate scribbleId = 'id'\n\tprivate markId = ''\n\tprivate excludedShapeIds = new Set<TLShapeId>()\n\n\toverride onEnter = (info: TLPointerEventInfo) => {\n\t\tthis.markId = 'erase scribble begin'\n\t\tthis.editor.mark(this.markId)\n\t\tthis.info = info\n\n\t\tconst { originPagePoint } = this.editor.inputs\n\t\tthis.excludedShapeIds = new Set(\n\t\t\tthis.editor\n\t\t\t\t.getCurrentPageShapes()\n\t\t\t\t.filter((shape) => {\n\t\t\t\t\t//If the shape is locked, we shouldn't erase it\n\t\t\t\t\tif (this.editor.isShapeOrAncestorLocked(shape)) return true\n\t\t\t\t\t//If the shape is a group or frame, check we're inside it when we start erasing\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group') ||\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLFrameShape>(shape, 'frame')\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst pointInShapeShape = this.editor.getPointInShapeSpace(shape, originPagePoint)\n\t\t\t\t\t\tconst geometry = this.editor.getShapeGeometry(shape)\n\t\t\t\t\t\treturn geometry.bounds.containsPoint(pointInShapeShape)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t})\n\t\t\t\t.map((shape) => shape.id)\n\t\t)\n\n\t\tconst scribble = this.editor.scribbles.addScribble({\n\t\t\tcolor: 'muted-1',\n\t\t\tsize: 12,\n\t\t})\n\t\tthis.scribbleId = scribble.id\n\n\t\tthis.update()\n\t}\n\n\tprivate pushPointToScribble = () => {\n\t\tconst { x, y } = this.editor.inputs.currentPagePoint\n\t\tthis.editor.scribbles.addPoint(this.scribbleId, x, y)\n\t}\n\n\toverride onExit = () => {\n\t\tthis.editor.scribbles.stop(this.scribbleId)\n\t}\n\n\toverride onPointerMove = () => {\n\t\tthis.update()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel: TLEventHandlers['onCancel'] = () => {\n\t\tthis.cancel()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\tupdate() {\n\t\tconst erasingShapeIds = this.editor.getErasingShapeIds()\n\t\tconst zoomLevel = this.editor.getZoomLevel()\n\t\tconst currentPageShapes = this.editor.getCurrentPageShapes()\n\t\tconst {\n\t\t\tinputs: { currentPagePoint, previousPagePoint },\n\t\t} = this.editor\n\n\t\tconst { excludedShapeIds } = this\n\n\t\tthis.pushPointToScribble()\n\n\t\tconst erasing = new Set<TLShapeId>(erasingShapeIds)\n\n\t\tfor (const shape of currentPageShapes) {\n\t\t\tif (this.editor.isShapeOfType<TLGroupShape>(shape, 'group')) continue\n\n\t\t\t// Avoid testing masked shapes, unless the pointer is inside the mask\n\t\t\tconst pageMask = this.editor.getShapeMask(shape.id)\n\t\t\tif (pageMask && !pointInPolygon(currentPagePoint, pageMask)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Hit test the shape using a line segment\n\t\t\tconst geometry = this.editor.getShapeGeometry(shape)\n\t\t\tconst A = this.editor.getPointInShapeSpace(shape, previousPagePoint)\n\t\t\tconst B = this.editor.getPointInShapeSpace(shape, currentPagePoint)\n\n\t\t\tif (geometry.hitTestLineSegment(A, B, HIT_TEST_MARGIN / zoomLevel)) {\n\t\t\t\terasing.add(this.editor.getOutermostSelectableShape(shape).id)\n\t\t\t}\n\t\t}\n\n\t\t// Remove the hit shapes, except if they're in the list of excluded shapes\n\t\t// (these excluded shapes will be any frames or groups the pointer was inside of\n\t\t// when the user started erasing)\n\t\tthis.editor.setErasingShapes([...erasing].filter((id) => !excludedShapeIds.has(id)))\n\t}\n\n\tcomplete() {\n\t\tthis.editor.deleteShapes(this.editor.getCurrentPageState().erasingShapeIds)\n\t\tthis.editor.setErasingShapes([])\n\t\tthis.parent.transition('idle')\n\t}\n\n\tcancel() {\n\t\tthis.editor.setErasingShapes([])\n\t\tthis.editor.bailToMark(this.markId)\n\t\tthis.parent.transition('idle', this.info)\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBASO;AAEA,MAAM,gBAAgB,wBAAU;AAAA,EACtC,OAAgB,KAAK;AAAA,EAEb,OAAO,CAAC;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,mBAAmB,oBAAI,IAAe;AAAA,EAErC,UAAU,CAAC,SAA6B;AAChD,SAAK,SAAS;AACd,SAAK,OAAO,KAAK,KAAK,MAAM;AAC5B,SAAK,OAAO;AAEZ,UAAM,EAAE,gBAAgB,IAAI,KAAK,OAAO;AACxC,SAAK,mBAAmB,IAAI;AAAA,MAC3B,KAAK,OACH,qBAAqB,EACrB,OAAO,CAAC,UAAU;AAElB,YAAI,KAAK,OAAO,wBAAwB,KAAK
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBASO;AAEA,MAAM,gBAAgB,wBAAU;AAAA,EACtC,OAAgB,KAAK;AAAA,EAEb,OAAO,CAAC;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,mBAAmB,oBAAI,IAAe;AAAA,EAErC,UAAU,CAAC,SAA6B;AAChD,SAAK,SAAS;AACd,SAAK,OAAO,KAAK,KAAK,MAAM;AAC5B,SAAK,OAAO;AAEZ,UAAM,EAAE,gBAAgB,IAAI,KAAK,OAAO;AACxC,SAAK,mBAAmB,IAAI;AAAA,MAC3B,KAAK,OACH,qBAAqB,EACrB,OAAO,CAAC,UAAU;AAElB,YAAI,KAAK,OAAO,wBAAwB,KAAK,EAAG,QAAO;AAE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AACtC,UAAI,KAAK,OAAO,cAA4B,OAAO,OAAO,EAAG;AAG7D,YAAM,WAAW,KAAK,OAAO,aAAa,MAAM,EAAE;AAClD,UAAI,YAAY,KAAC,8BAAe,kBAAkB,QAAQ,GAAG;AAC5D;AAAA,MACD;AAGA,YAAM,WAAW,KAAK,OAAO,iBAAiB,KAAK;AACnD,YAAM,IAAI,KAAK,OAAO,qBAAqB,OAAO,iBAAiB;AACnE,YAAM,IAAI,KAAK,OAAO,qBAAqB,OAAO,gBAAgB;AAElE,UAAI,SAAS,mBAAmB,GAAG,GAAG,gCAAkB,SAAS,GAAG;AACnE,gBAAQ,IAAI,KAAK,OAAO,4BAA4B,KAAK,EAAE,EAAE;AAAA,MAC9D;AAAA,IACD;AAKA,SAAK,OAAO,iBAAiB,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AAAA,EACpF;AAAA,EAEA,WAAW;AACV,SAAK,OAAO,aAAa,KAAK,OAAO,oBAAoB,EAAE,eAAe;AAC1E,SAAK,OAAO,iBAAiB,CAAC,CAAC;AAC/B,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AAAA,EAEA,SAAS;AACR,SAAK,OAAO,iBAAiB,CAAC,CAAC;AAC/B,SAAK,OAAO,WAAW,KAAK,MAAM;AAClC,SAAK,OAAO,WAAW,QAAQ,KAAK,IAAI;AAAA,EACzC;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -79,8 +79,7 @@ class DragAndDropManager {
|
|
|
79
79
|
this.handleDrag(this.editor.inputs.currentPagePoint, shapes);
|
|
80
80
|
if (prevDroppingShapeId) {
|
|
81
81
|
const shape = this.editor.getShape(prevDroppingShapeId);
|
|
82
|
-
if (!shape)
|
|
83
|
-
return;
|
|
82
|
+
if (!shape) return;
|
|
84
83
|
this.editor.getShapeUtil(shape).onDropShapesOver?.(shape, shapes);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/tools/SelectTool/DragAndDropManager.ts"],
|
|
4
4
|
"sourcesContent": ["import { Editor, TLShape, TLShapeId, Vec2d, compact } from '@bigbluebutton/editor'\n\nconst LAG_DURATION = 100\n\n/** @public */\nexport class DragAndDropManager {\n\tconstructor(public editor: Editor) {\n\t\teditor.disposables.add(this.dispose)\n\t}\n\n\tprevDroppingShapeId: TLShapeId | null = null\n\n\tdroppingNodeTimer: ReturnType<typeof setTimeout> | null = null\n\n\tfirst = true\n\n\tupdateDroppingNode(movingShapes: TLShape[], cb: () => void) {\n\t\tif (this.first) {\n\t\t\tthis.prevDroppingShapeId =\n\t\t\t\tthis.editor.getDroppingOverShape(this.editor.inputs.originPagePoint, movingShapes)?.id ??\n\t\t\t\tnull\n\t\t\tthis.first = false\n\t\t}\n\n\t\tif (this.droppingNodeTimer === null) {\n\t\t\tthis.setDragTimer(movingShapes, LAG_DURATION * 10, cb)\n\t\t} else if (this.editor.inputs.pointerVelocity.len() > 0.5) {\n\t\t\tclearInterval(this.droppingNodeTimer)\n\t\t\tthis.setDragTimer(movingShapes, LAG_DURATION, cb)\n\t\t}\n\t}\n\n\tprivate setDragTimer(movingShapes: TLShape[], duration: number, cb: () => void) {\n\t\tthis.droppingNodeTimer = setTimeout(() => {\n\t\t\tthis.editor.batch(() => {\n\t\t\t\tthis.handleDrag(this.editor.inputs.currentPagePoint, movingShapes, cb)\n\t\t\t})\n\t\t\tthis.droppingNodeTimer = null\n\t\t}, duration)\n\t}\n\n\tprivate handleDrag(point: Vec2d, movingShapes: TLShape[], cb?: () => void) {\n\t\tmovingShapes = compact(movingShapes.map((shape) => this.editor.getShape(shape.id)))\n\n\t\tconst nextDroppingShapeId = this.editor.getDroppingOverShape(point, movingShapes)?.id ?? null\n\n\t\t// is the next dropping shape id different than the last one?\n\t\tif (nextDroppingShapeId === this.prevDroppingShapeId) {\n\t\t\treturn\n\t\t}\n\n\t\t// the old previous one\n\t\tconst { prevDroppingShapeId } = this\n\n\t\tconst prevDroppingShape = prevDroppingShapeId && this.editor.getShape(prevDroppingShapeId)\n\t\tconst nextDroppingShape = nextDroppingShapeId && this.editor.getShape(nextDroppingShapeId)\n\n\t\t// Even if we don't have a next dropping shape id (i.e. if we're dropping\n\t\t// onto the page) set the prev to the current, to avoid repeat calls to\n\t\t// the previous parent's onDragShapesOut\n\n\t\tif (prevDroppingShape) {\n\t\t\tthis.editor.getShapeUtil(prevDroppingShape).onDragShapesOut?.(prevDroppingShape, movingShapes)\n\t\t}\n\n\t\tif (nextDroppingShape) {\n\t\t\tconst res = this.editor\n\t\t\t\t.getShapeUtil(nextDroppingShape)\n\t\t\t\t.onDragShapesOver?.(nextDroppingShape, movingShapes)\n\n\t\t\tif (res && res.shouldHint) {\n\t\t\t\tthis.editor.setHintingShapes([nextDroppingShape.id])\n\t\t\t}\n\t\t} else {\n\t\t\t// If we're dropping onto the page, then clear hinting ids\n\t\t\tthis.editor.setHintingShapes([])\n\t\t}\n\n\t\tcb?.()\n\n\t\t// next -> curr\n\t\tthis.prevDroppingShapeId = nextDroppingShapeId\n\t}\n\n\tdropShapes(shapes: TLShape[]) {\n\t\tconst { prevDroppingShapeId } = this\n\n\t\tthis.handleDrag(this.editor.inputs.currentPagePoint, shapes)\n\n\t\tif (prevDroppingShapeId) {\n\t\t\tconst shape = this.editor.getShape(prevDroppingShapeId)\n\t\t\tif (!shape) return\n\t\t\tthis.editor.getShapeUtil(shape).onDropShapesOver?.(shape, shapes)\n\t\t}\n\t}\n\n\tclear() {\n\t\tthis.prevDroppingShapeId = null\n\n\t\tif (this.droppingNodeTimer !== null) {\n\t\t\tclearInterval(this.droppingNodeTimer)\n\t\t}\n\n\t\tthis.droppingNodeTimer = null\n\t\tthis.editor.setHintingShapes([])\n\t\tthis.first = true\n\t}\n\n\tdispose = () => {\n\t\tthis.clear()\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;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YAAM,QAAQ,KAAK,OAAO,SAAS,mBAAmB;AACtD,UAAI,CAAC,MAAO;AACZ,WAAK,OAAO,aAAa,KAAK,EAAE,mBAAmB,OAAO,MAAM;AAAA,IACjE;AAAA,EACD;AAAA,EAEA,QAAQ;AACP,SAAK,sBAAsB;AAE3B,QAAI,KAAK,sBAAsB,MAAM;AACpC,oBAAc,KAAK,iBAAiB;AAAA,IACrC;AAEA,SAAK,oBAAoB;AACzB,SAAK,OAAO,iBAAiB,CAAC,CAAC;AAC/B,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,UAAU,MAAM;AACf,SAAK,MAAM;AAAA,EACZ;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -91,41 +91,36 @@ class Brushing extends import_editor.StateNode {
|
|
|
91
91
|
let A, B, shape, pageBounds, pageTransform, localCorners;
|
|
92
92
|
const { corners } = this.brush;
|
|
93
93
|
const { excludedShapeIds } = this;
|
|
94
|
-
testAllShapes:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
testAllShapes: for (let i = 0, n = currentPageShapes.length; i < n; i++) {
|
|
95
|
+
shape = currentPageShapes[i];
|
|
96
|
+
if (excludedShapeIds.has(shape.id)) continue testAllShapes;
|
|
97
|
+
if (results.has(shape.id)) continue testAllShapes;
|
|
98
|
+
pageBounds = this.editor.getShapePageBounds(shape);
|
|
99
|
+
if (!pageBounds) continue testAllShapes;
|
|
100
|
+
if (this.brush.contains(pageBounds)) {
|
|
101
|
+
this.handleHit(shape, currentPagePoint, currentPageId, results, corners);
|
|
102
|
+
continue testAllShapes;
|
|
103
|
+
}
|
|
104
|
+
if (ctrlKey || this.editor.isShapeOfType(shape, "frame")) {
|
|
105
|
+
continue testAllShapes;
|
|
106
|
+
}
|
|
107
|
+
if (this.brush.collides(pageBounds)) {
|
|
108
|
+
const geometry = this.editor.getShapeGeometry(shape);
|
|
109
|
+
pageTransform = this.editor.getShapePageTransform(shape);
|
|
110
|
+
if (!pageTransform) {
|
|
109
111
|
continue testAllShapes;
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
localCorners = pageTransform.clone().invert().applyToPoints(corners);
|
|
114
|
+
hitTestBrushEdges: for (let i2 = 0; i2 < localCorners.length; i2++) {
|
|
115
|
+
A = localCorners[i2];
|
|
116
|
+
B = localCorners[(i2 + 1) % localCorners.length];
|
|
117
|
+
if (geometry.hitTestLineSegment(A, B, import_editor.HIT_TEST_MARGIN / zoomLevel)) {
|
|
118
|
+
this.handleHit(shape, currentPagePoint, currentPageId, results, corners);
|
|
119
|
+
break hitTestBrushEdges;
|
|
116
120
|
}
|
|
117
|
-
localCorners = pageTransform.clone().invert().applyToPoints(corners);
|
|
118
|
-
hitTestBrushEdges:
|
|
119
|
-
for (let i2 = 0; i2 < localCorners.length; i2++) {
|
|
120
|
-
A = localCorners[i2];
|
|
121
|
-
B = localCorners[(i2 + 1) % localCorners.length];
|
|
122
|
-
if (geometry.hitTestLineSegment(A, B, import_editor.HIT_TEST_MARGIN / zoomLevel)) {
|
|
123
|
-
this.handleHit(shape, currentPagePoint, currentPageId, results, corners);
|
|
124
|
-
break hitTestBrushEdges;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
121
|
}
|
|
128
122
|
}
|
|
123
|
+
}
|
|
129
124
|
this.editor.updateInstanceState({ brush: { ...this.brush.toJson() } });
|
|
130
125
|
this.editor.setSelectedShapes(Array.from(results), { squashing: true });
|
|
131
126
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/tools/SelectTool/childStates/Brushing.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n\tBox2d,\n\tHIT_TEST_MARGIN,\n\tMatrix2d,\n\tStateNode,\n\tTLCancelEvent,\n\tTLEventHandlers,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLInterruptEvent,\n\tTLKeyboardEvent,\n\tTLPageId,\n\tTLPointerEventInfo,\n\tTLShape,\n\tTLShapeId,\n\tTLTickEventHandler,\n\tVec2d,\n\tmoveCameraWhenCloseToEdge,\n\tpointInPolygon,\n\tpolygonsIntersect,\n} from '@bigbluebutton/editor'\n\nexport class Brushing extends StateNode {\n\tstatic override id = 'brushing'\n\n\tinfo = {} as TLPointerEventInfo & { target: 'canvas' }\n\n\tbrush = new Box2d()\n\tinitialSelectedShapeIds: TLShapeId[] = []\n\texcludedShapeIds = new Set<TLShapeId>()\n\n\t// The shape that the brush started on\n\tinitialStartShape: TLShape | null = null\n\n\toverride onEnter = (info: TLPointerEventInfo & { target: 'canvas' }) => {\n\t\tconst { altKey, currentPagePoint } = this.editor.inputs\n\n\t\tif (altKey) {\n\t\t\tthis.parent.transition('scribble_brushing', info)\n\t\t\treturn\n\t\t}\n\n\t\tthis.excludedShapeIds = new Set(\n\t\t\tthis.editor\n\t\t\t\t.getCurrentPageShapes()\n\t\t\t\t.filter(\n\t\t\t\t\t(shape) =>\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group') ||\n\t\t\t\t\t\tthis.editor.isShapeOrAncestorLocked(shape)\n\t\t\t\t)\n\t\t\t\t.map((shape) => shape.id)\n\t\t)\n\n\t\tthis.info = info\n\t\tthis.initialSelectedShapeIds = this.editor.getSelectedShapeIds().slice()\n\t\tthis.initialStartShape = this.editor.getShapesAtPoint(currentPagePoint)[0]\n\t\tthis.onPointerMove()\n\t}\n\n\toverride onExit = () => {\n\t\tthis.initialSelectedShapeIds = []\n\t\tthis.editor.updateInstanceState({ brush: null })\n\t}\n\n\toverride onTick: TLTickEventHandler = () => {\n\t\tmoveCameraWhenCloseToEdge(this.editor)\n\t}\n\n\toverride onPointerMove = () => {\n\t\tthis.hitTestShapes()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel?: TLCancelEvent | undefined = (info) => {\n\t\tthis.editor.setSelectedShapes(this.initialSelectedShapeIds, { squashing: true })\n\t\tthis.parent.transition('idle', info)\n\t}\n\n\toverride onKeyDown: TLEventHandlers['onKeyDown'] = (info) => {\n\t\tif (this.editor.inputs.altKey) {\n\t\t\tthis.parent.transition('scribble_brushing', info)\n\t\t} else {\n\t\t\tthis.hitTestShapes()\n\t\t}\n\t}\n\n\toverride onKeyUp?: TLKeyboardEvent | undefined = () => {\n\t\tthis.hitTestShapes()\n\t}\n\n\tprivate complete() {\n\t\tthis.parent.transition('idle')\n\t}\n\n\tprivate hitTestShapes() {\n\t\tconst zoomLevel = this.editor.getZoomLevel()\n\t\tconst currentPageShapes = this.editor.getCurrentPageShapes()\n\t\tconst currentPageId = this.editor.getCurrentPageId()\n\t\tconst {\n\t\t\tinputs: { originPagePoint, currentPagePoint, shiftKey, ctrlKey },\n\t\t} = this.editor\n\n\t\t// Set the brush to contain the current and origin points\n\t\tthis.brush.setTo(Box2d.FromPoints([originPagePoint, currentPagePoint]))\n\n\t\t// We'll be collecting shape ids\n\t\tconst results = new Set(shiftKey ? this.initialSelectedShapeIds : [])\n\n\t\tlet A: Vec2d,\n\t\t\tB: Vec2d,\n\t\t\tshape: TLShape,\n\t\t\tpageBounds: Box2d | undefined,\n\t\t\tpageTransform: Matrix2d | undefined,\n\t\t\tlocalCorners: Vec2d[]\n\n\t\t// We'll be testing the corners of the brush against the shapes\n\t\tconst { corners } = this.brush\n\n\t\tconst { excludedShapeIds } = this\n\n\t\ttestAllShapes: for (let i = 0, n = currentPageShapes.length; i < n; i++) {\n\t\t\tshape = currentPageShapes[i]\n\t\t\tif (excludedShapeIds.has(shape.id)) continue testAllShapes\n\t\t\tif (results.has(shape.id)) continue testAllShapes\n\n\t\t\tpageBounds = this.editor.getShapePageBounds(shape)\n\t\t\tif (!pageBounds) continue testAllShapes\n\n\t\t\t// If the brush fully wraps a shape, it's almost certainly a hit\n\t\t\tif (this.brush.contains(pageBounds)) {\n\t\t\t\tthis.handleHit(shape, currentPagePoint, currentPageId, results, corners)\n\t\t\t\tcontinue testAllShapes\n\t\t\t}\n\n\t\t\t// Should we even test for a single segment intersections? Only if\n\t\t\t// we're not holding the ctrl key for alternate selection mode\n\t\t\t// (only wraps count!), or if the shape is a frame.\n\t\t\tif (ctrlKey || this.editor.isShapeOfType<TLFrameShape>(shape, 'frame')) {\n\t\t\t\tcontinue testAllShapes\n\t\t\t}\n\n\t\t\t// If the brush collides the page bounds, then do hit tests against\n\t\t\t// each of the brush's four sides.\n\t\t\tif (this.brush.collides(pageBounds)) {\n\t\t\t\t// Shapes expect to hit test line segments in their own coordinate system,\n\t\t\t\t// so we first need to get the brush corners in the shape's local space.\n\t\t\t\tconst geometry = this.editor.getShapeGeometry(shape)\n\n\t\t\t\tpageTransform = this.editor.getShapePageTransform(shape)\n\n\t\t\t\tif (!pageTransform) {\n\t\t\t\t\tcontinue testAllShapes\n\t\t\t\t}\n\n\t\t\t\t// Check whether any of the the brush edges intersect the shape\n\t\t\t\tlocalCorners = pageTransform.clone().invert().applyToPoints(corners)\n\n\t\t\t\thitTestBrushEdges: for (let i = 0; i < localCorners.length; i++) {\n\t\t\t\t\tA = localCorners[i]\n\t\t\t\t\tB = localCorners[(i + 1) % localCorners.length]\n\n\t\t\t\t\tif (geometry.hitTestLineSegment(A, B, HIT_TEST_MARGIN / zoomLevel)) {\n\t\t\t\t\t\tthis.handleHit(shape, currentPagePoint, currentPageId, results, corners)\n\t\t\t\t\t\tbreak hitTestBrushEdges\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.editor.updateInstanceState({ brush: { ...this.brush.toJson() } })\n\t\tthis.editor.setSelectedShapes(Array.from(results), { squashing: true })\n\t}\n\n\toverride onInterrupt: TLInterruptEvent = () => {\n\t\tthis.editor.updateInstanceState({ brush: null })\n\t}\n\n\tprivate handleHit(\n\t\tshape: TLShape,\n\t\tcurrentPagePoint: Vec2d,\n\t\tcurrentPageId: TLPageId,\n\t\tresults: Set<TLShapeId>,\n\t\tcorners: Vec2d[]\n\t) {\n\t\tif (shape.parentId === currentPageId) {\n\t\t\tresults.add(shape.id)\n\t\t\treturn\n\t\t}\n\n\t\t// Find the outermost selectable shape, check to see if it has a\n\t\t// page mask; and if so, check to see if the brush intersects it\n\t\tconst selectedShape = this.editor.getOutermostSelectableShape(shape)\n\t\tconst pageMask = this.editor.getShapeMask(selectedShape.id)\n\n\t\tif (\n\t\t\tpageMask &&\n\t\t\t!polygonsIntersect(pageMask, corners) &&\n\t\t\t!pointInPolygon(currentPagePoint, pageMask)\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tresults.add(selectedShape.id)\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAoBO;AAEA,MAAM,iBAAiB,wBAAU;AAAA,EACvC,OAAgB,KAAK;AAAA,EAErB,OAAO,CAAC;AAAA,EAER,QAAQ,IAAI,oBAAM;AAAA,EAClB,0BAAuC,CAAC;AAAA,EACxC,mBAAmB,oBAAI,IAAe;AAAA;AAAA,EAGtC,oBAAoC;AAAA,EAE3B,UAAU,CAAC,SAAoD;AACvE,UAAM,EAAE,QAAQ,iBAAiB,IAAI,KAAK,OAAO;AAEjD,QAAI,QAAQ;AACX,WAAK,OAAO,WAAW,qBAAqB,IAAI;AAChD;AAAA,IACD;AAEA,SAAK,mBAAmB,IAAI;AAAA,MAC3B,KAAK,OACH,qBAAqB,EACrB;AAAA,QACA,CAAC,UACA,KAAK,OAAO,cAA4B,OAAO,OAAO,KACtD,KAAK,OAAO,wBAAwB,KAAK;AAAA,MAC3C,EACC,IAAI,CA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AA4B,KAAK;AACnE,UAAM,WAAW,KAAK,OAAO,aAAa,cAAc,EAAE;AAE1D,QACC,YACA,KAAC,iCAAkB,UAAU,OAAO,KACpC,KAAC,8BAAe,kBAAkB,QAAQ,GACzC;AACD;AAAA,IACD;AAEA,YAAQ,IAAI,cAAc,EAAE;AAAA,EAC7B;AACD;",
|
|
6
6
|
"names": ["i"]
|
|
7
7
|
}
|
|
@@ -50,8 +50,7 @@ class Idle extends import_editor.StateNode {
|
|
|
50
50
|
this.editor.setCurrentTool("select.idle", {});
|
|
51
51
|
};
|
|
52
52
|
onPointerDown = (info) => {
|
|
53
|
-
if (this.editor.getIsMenuOpen())
|
|
54
|
-
return;
|
|
53
|
+
if (this.editor.getIsMenuOpen()) return;
|
|
55
54
|
if (info.ctrlKey) {
|
|
56
55
|
this.cancel();
|
|
57
56
|
this.editor.root.handleEvent(info);
|
|
@@ -130,17 +129,13 @@ class Idle extends import_editor.StateNode {
|
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
131
|
onDoubleClick = (info) => {
|
|
133
|
-
if (this.editor.inputs.shiftKey || info.phase !== "up")
|
|
134
|
-
return;
|
|
132
|
+
if (this.editor.inputs.shiftKey || info.phase !== "up") return;
|
|
135
133
|
const croppingShapeId = this.editor.getCroppingShapeId();
|
|
136
|
-
if (!croppingShapeId)
|
|
137
|
-
return;
|
|
134
|
+
if (!croppingShapeId) return;
|
|
138
135
|
const shape = this.editor.getShape(croppingShapeId);
|
|
139
|
-
if (!shape)
|
|
140
|
-
return;
|
|
136
|
+
if (!shape) return;
|
|
141
137
|
const util = this.editor.getShapeUtil(shape);
|
|
142
|
-
if (!util)
|
|
143
|
-
return;
|
|
138
|
+
if (!util) return;
|
|
144
139
|
if (info.target === "selection") {
|
|
145
140
|
util.onDoubleClickEdge?.(shape);
|
|
146
141
|
}
|
|
@@ -177,21 +172,14 @@ class Idle extends import_editor.StateNode {
|
|
|
177
172
|
} = this;
|
|
178
173
|
const shiftKey = keys.has("ShiftLeft");
|
|
179
174
|
const delta = new import_editor.Vec2d(0, 0);
|
|
180
|
-
if (keys.has("ArrowLeft"))
|
|
181
|
-
|
|
182
|
-
if (keys.has("
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
if (keys.has("ArrowDown"))
|
|
187
|
-
delta.y -= 1;
|
|
188
|
-
if (delta.equals(new import_editor.Vec2d(0, 0)))
|
|
189
|
-
return;
|
|
190
|
-
if (shiftKey)
|
|
191
|
-
delta.mul(10);
|
|
175
|
+
if (keys.has("ArrowLeft")) delta.x += 1;
|
|
176
|
+
if (keys.has("ArrowRight")) delta.x -= 1;
|
|
177
|
+
if (keys.has("ArrowUp")) delta.y += 1;
|
|
178
|
+
if (keys.has("ArrowDown")) delta.y -= 1;
|
|
179
|
+
if (delta.equals(new import_editor.Vec2d(0, 0))) return;
|
|
180
|
+
if (shiftKey) delta.mul(10);
|
|
192
181
|
const shape = this.editor.getShape(this.editor.getCroppingShapeId());
|
|
193
|
-
if (!shape)
|
|
194
|
-
return;
|
|
182
|
+
if (!shape) return;
|
|
195
183
|
const partial = (0, import_crop_helpers.getTranslateCroppedImageChange)(this.editor, shape, delta);
|
|
196
184
|
if (partial) {
|
|
197
185
|
if (!ephemeral) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n\tStateNode,\n\tTLEventHandlers,\n\tTLExitEventHandler,\n\tTLGroupShape,\n\tVec2d,\n} from '@bigbluebutton/editor'\nimport { getHitShapeOnCanvasPointerDown } from '../../../../selection-logic/getHitShapeOnCanvasPointerDown'\nimport { ShapeWithCrop, getTranslateCroppedImageChange } from './crop_helpers'\n\nexport class Idle extends StateNode {\n\tstatic override id = 'idle'\n\n\toverride onEnter = () => {\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: 'default', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\n\t\tconst onlySelectedShape = this.editor.getOnlySelectedShape()\n\n\t\t// well this fucking sucks. what the fuck.\n\t\t// it's possible for a user to enter cropping, then undo\n\t\t// (which clears the cropping id) but still remain in this state.\n\t\tthis.editor.on('change-history', this.cleanupCroppingState)\n\n\t\tif (onlySelectedShape) {\n\t\t\tthis.editor.mark('crop')\n\t\t\tthis.editor.setCroppingShape(onlySelectedShape.id)\n\t\t}\n\t}\n\n\toverride onExit: TLExitEventHandler = () => {\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: 'default', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\n\t\tthis.editor.off('change-history', this.cleanupCroppingState)\n\t}\n\n\toverride onCancel: TLEventHandlers['onCancel'] = () => {\n\t\tthis.editor.setCroppingShape(null)\n\t\tthis.editor.setCurrentTool('select.idle', {})\n\t}\n\n\toverride onPointerDown: TLEventHandlers['onPointerDown'] = (info) => {\n\t\tif (this.editor.getIsMenuOpen()) return\n\n\t\tif (info.ctrlKey) {\n\t\t\tthis.cancel()\n\t\t\t// feed the event back into the statechart\n\t\t\tthis.editor.root.handleEvent(info)\n\t\t\treturn\n\t\t}\n\n\t\tswitch (info.target) {\n\t\t\tcase 'canvas': {\n\t\t\t\tconst hitShape = getHitShapeOnCanvasPointerDown(this.editor)\n\t\t\t\tif (hitShape && !this.editor.isShapeOfType<TLGroupShape>(hitShape, 'group')) {\n\t\t\t\t\tthis.onPointerDown({\n\t\t\t\t\t\t...info,\n\t\t\t\t\t\tshape: hitShape,\n\t\t\t\t\t\ttarget: 'shape',\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tthis.cancel()\n\t\t\t\t// feed the event back into the statechart\n\t\t\t\tthis.editor.root.handleEvent(info)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'shape': {\n\t\t\t\tif (info.shape.id === this.editor.getCroppingShapeId()) {\n\t\t\t\t\tthis.editor.setCurrentTool('select.crop.pointing_crop', info)\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tif (this.editor.getShapeUtil(info.shape)?.canCrop(info.shape)) {\n\t\t\t\t\t\tthis.editor.setCroppingShape(info.shape.id)\n\t\t\t\t\t\tthis.editor.setSelectedShapes([info.shape.id])\n\t\t\t\t\t\tthis.editor.setCurrentTool('select.crop.pointing_crop', info)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.cancel()\n\t\t\t\t\t\t// feed the event back into the statechart\n\t\t\t\t\t\tthis.editor.root.handleEvent(info)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'selection': {\n\t\t\t\tswitch (info.handle) {\n\t\t\t\t\tcase 'mobile_rotate':\n\t\t\t\t\tcase 'top_left_rotate':\n\t\t\t\t\tcase 'top_right_rotate':\n\t\t\t\t\tcase 'bottom_left_rotate':\n\t\t\t\t\tcase 'bottom_right_rotate': {\n\t\t\t\t\t\tthis.editor.setCurrentTool('select.pointing_rotate_handle', {\n\t\t\t\t\t\t\t...info,\n\t\t\t\t\t\t\tonInteractionEnd: 'select.crop',\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase 'top':\n\t\t\t\t\tcase 'right':\n\t\t\t\t\tcase 'bottom':\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.editor.setCurrentTool('select.pointing_crop_handle', {\n\t\t\t\t\t\t\t...info,\n\t\t\t\t\t\t\tonInteractionEnd: 'select.crop',\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase 'top_left':\n\t\t\t\t\tcase 'top_right':\n\t\t\t\t\tcase 'bottom_left':\n\t\t\t\t\tcase 'bottom_right': {\n\t\t\t\t\t\tthis.editor.setCurrentTool('select.pointing_crop_handle', {\n\t\t\t\t\t\t\t...info,\n\t\t\t\t\t\t\tonInteractionEnd: 'select.crop',\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tthis.cancel()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\toverride onDoubleClick: TLEventHandlers['onDoubleClick'] = (info) => {\n\t\t// Without this, the double click's \"settle\" would trigger the reset\n\t\t// after the user double clicked the edge to begin cropping\n\t\tif (this.editor.inputs.shiftKey || info.phase !== 'up') return\n\n\t\tconst croppingShapeId = this.editor.getCroppingShapeId()\n\t\tif (!croppingShapeId) return\n\t\tconst shape = this.editor.getShape(croppingShapeId)\n\t\tif (!shape) return\n\n\t\tconst util = this.editor.getShapeUtil(shape)\n\t\tif (!util) return\n\n\t\tif (info.target === 'selection') {\n\t\t\tutil.onDoubleClickEdge?.(shape)\n\t\t}\n\t}\n\n\toverride onKeyDown: TLEventHandlers['onKeyDown'] = () => {\n\t\tthis.nudgeCroppingImage(false)\n\t}\n\n\toverride onKeyRepeat: TLEventHandlers['onKeyRepeat'] = () => {\n\t\tthis.nudgeCroppingImage(true)\n\t}\n\n\toverride onKeyUp: TLEventHandlers['onKeyUp'] = (info) => {\n\t\tswitch (info.code) {\n\t\t\tcase 'Enter': {\n\t\t\t\tthis.editor.setCroppingShape(null)\n\t\t\t\tthis.editor.setCurrentTool('select.idle', {})\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate cancel() {\n\t\tthis.editor.setCroppingShape(null)\n\t\tthis.editor.setCurrentTool('select.idle', {})\n\t}\n\n\tprivate cleanupCroppingState = () => {\n\t\tif (!this.editor.getCroppingShapeId()) {\n\t\t\tthis.editor.setCurrentTool('select.idle', {})\n\t\t}\n\t}\n\n\tprivate nudgeCroppingImage(ephemeral = false) {\n\t\tconst {\n\t\t\teditor: {\n\t\t\t\tinputs: { keys },\n\t\t\t},\n\t\t} = this\n\n\t\t// We want to use the \"actual\" shift key state,\n\t\t// not the one that's in the editor.inputs.shiftKey,\n\t\t// because that one uses a short timeout on release\n\t\tconst shiftKey = keys.has('ShiftLeft')\n\n\t\tconst delta = new Vec2d(0, 0)\n\n\t\tif (keys.has('ArrowLeft')) delta.x += 1\n\t\tif (keys.has('ArrowRight')) delta.x -= 1\n\t\tif (keys.has('ArrowUp')) delta.y += 1\n\t\tif (keys.has('ArrowDown')) delta.y -= 1\n\n\t\tif (delta.equals(new Vec2d(0, 0))) return\n\n\t\tif (shiftKey) delta.mul(10)\n\n\t\tconst shape = this.editor.getShape(this.editor.getCroppingShapeId()!) as ShapeWithCrop\n\t\tif (!shape) return\n\t\tconst partial = getTranslateCroppedImageChange(this.editor, shape, delta)\n\n\t\tif (partial) {\n\t\t\tif (!ephemeral) {\n\t\t\t\t// We don't want to create new marks if the user\n\t\t\t\t// is just holding down the arrow keys\n\t\t\t\tthis.editor.mark('translate crop')\n\t\t\t}\n\n\t\t\tthis.editor.updateShapes<ShapeWithCrop>([partial])\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMO;AACP,4CAA+C;AAC/C,0BAA8D;AAEvD,MAAM,aAAa,wBAAU;AAAA,EACnC,OAAgB,KAAK;AAAA,EAEZ,UAAU,MAAM;AACxB,SAAK,OAAO;AAAA,MACX,EAAE,QAAQ,EAAE,MAAM,WAAW,UAAU,EAAE,EAAE;AAAA,MAC3C,EAAE,WAAW,KAAK;AAAA,IACnB;AAEA,UAAM,oBAAoB,KAAK,OAAO,qBAAqB;AAK3D,SAAK,OAAO,GAAG,kBAAkB,KAAK,oBAAoB;AAE1D,QAAI,mBAAmB;AACtB,WAAK,OAAO,KAAK,MAAM;AACvB,WAAK,OAAO,iBAAiB,kBAAkB,EAAE;AAAA,IAClD;AAAA,EACD;AAAA,EAES,SAA6B,MAAM;AAC3C,SAAK,OAAO;AAAA,MACX,EAAE,QAAQ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C,WAAK,OAAO,eAAe,eAAe,CAAC,CAAC;AAAA,IAC7C;AAAA,EACD;AAAA,EAEQ,mBAAmB,YAAY,OAAO;AAC7C,UAAM;AAAA,MACL,QAAQ;AAAA,QACP,QAAQ,EAAE,KAAK;AAAA,MAChB;AAAA,IACD,IAAI;AAKJ,UAAM,WAAW,KAAK,IAAI,WAAW;AAErC,UAAM,QAAQ,IAAI,oBAAM,GAAG,CAAC;AAE5B,QAAI,KAAK,IAAI,WAAW,EAAG,OAAM,KAAK;AACtC,QAAI,KAAK,IAAI,YAAY,EAAG,OAAM,KAAK;AACvC,QAAI,KAAK,IAAI,SAAS,EAAG,OAAM,KAAK;AACpC,QAAI,KAAK,IAAI,WAAW,EAAG,OAAM,KAAK;AAEtC,QAAI,MAAM,OAAO,IAAI,oBAAM,GAAG,CAAC,CAAC,EAAG;AAEnC,QAAI,SAAU,OAAM,IAAI,EAAE;AAE1B,UAAM,QAAQ,KAAK,OAAO,SAAS,KAAK,OAAO,mBAAmB,CAAE;AACpE,QAAI,CAAC,MAAO;AACZ,UAAM,cAAU,oDAA+B,KAAK,QAAQ,OAAO,KAAK;AAExE,QAAI,SAAS;AACZ,UAAI,CAAC,WAAW;AAGf,aAAK,OAAO,KAAK,gBAAgB;AAAA,MAClC;AAEA,WAAK,OAAO,aAA4B,CAAC,OAAO,CAAC;AAAA,IAClD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -88,8 +88,7 @@ class TranslatingCrop extends import_editor.StateNode {
|
|
|
88
88
|
}
|
|
89
89
|
updateShapes() {
|
|
90
90
|
const shape = this.snapshot.shape;
|
|
91
|
-
if (!shape)
|
|
92
|
-
return;
|
|
91
|
+
if (!shape) return;
|
|
93
92
|
const { originPagePoint, currentPagePoint } = this.editor.inputs;
|
|
94
93
|
const delta = currentPagePoint.clone().sub(originPagePoint);
|
|
95
94
|
const partial = (0, import_crop_helpers.getTranslateCroppedImageChange)(this.editor, shape, delta);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/lib/tools/SelectTool/childStates/Crop/children/TranslatingCrop.ts"],
|
|
4
4
|
"sourcesContent": ["import { StateNode, TLEventHandlers, TLPointerEventInfo } from '@bigbluebutton/editor'\nimport { ShapeWithCrop, getTranslateCroppedImageChange } from './crop_helpers'\n\ntype Snapshot = ReturnType<TranslatingCrop['createSnapshot']>\n\nexport class TranslatingCrop extends StateNode {\n\tstatic override id = 'translating_crop'\n\n\tinfo = {} as TLPointerEventInfo & {\n\t\ttarget: 'shape'\n\t\tisCreating?: boolean\n\t\tonInteractionEnd?: string\n\t}\n\n\tmarkId = 'translating crop'\n\n\tprivate snapshot = {} as any as Snapshot\n\n\toverride onEnter = (\n\t\tinfo: TLPointerEventInfo & {\n\t\t\ttarget: 'shape'\n\t\t\tisCreating?: boolean\n\t\t\tonInteractionEnd?: string\n\t\t}\n\t) => {\n\t\tthis.info = info\n\t\tthis.snapshot = this.createSnapshot()\n\n\t\tthis.editor.mark(this.markId)\n\t\tthis.editor.setCursor({ type: 'move', rotation: 0 })\n\t\tthis.updateShapes()\n\t}\n\n\toverride onExit = () => {\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: 'default', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\t}\n\n\toverride onPointerMove = () => {\n\t\tthis.updateShapes()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel: TLEventHandlers['onCancel'] = () => {\n\t\tthis.cancel()\n\t}\n\n\toverride onKeyDown: TLEventHandlers['onKeyDown'] = (info) => {\n\t\tswitch (info.key) {\n\t\t\tcase 'Alt':\n\t\t\tcase 'Shift': {\n\t\t\t\tthis.updateShapes()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\toverride onKeyUp: TLEventHandlers['onKeyUp'] = (info) => {\n\t\tswitch (info.key) {\n\t\t\tcase 'Enter': {\n\t\t\t\tthis.complete()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcase 'Alt':\n\t\t\tcase 'Shift': {\n\t\t\t\tthis.updateShapes()\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected complete() {\n\t\tthis.updateShapes()\n\t\tthis.editor.setCurrentTool('select.crop.idle', this.info)\n\t}\n\n\tprivate cancel() {\n\t\tthis.editor.bailToMark(this.markId)\n\t\tthis.editor.setCurrentTool('select.crop.idle', this.info)\n\t}\n\n\tprivate createSnapshot() {\n\t\tconst shape = this.editor.getOnlySelectedShape() as ShapeWithCrop\n\t\treturn { shape }\n\t}\n\n\tprotected updateShapes() {\n\t\tconst shape = this.snapshot.shape as ShapeWithCrop\n\n\t\tif (!shape) return\n\n\t\tconst { originPagePoint, currentPagePoint } = this.editor.inputs\n\t\tconst delta = currentPagePoint.clone().sub(originPagePoint)\n\t\tconst partial = getTranslateCroppedImageChange(this.editor, shape, delta)\n\n\t\tif (partial) {\n\t\t\tthis.editor.updateShapes([partial], { squashing: true })\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+D;AAC/D,0BAA8D;AAIvD,MAAM,wBAAwB,wBAAU;AAAA,EAC9C,OAAgB,KAAK;AAAA,EAErB,OAAO,CAAC;AAAA,EAMR,SAAS;AAAA,EAED,WAAW,CAAC;AAAA,EAEX,UAAU,CAClB,SAKI;AACJ,SAAK,OAAO;AACZ,SAAK,WAAW,KAAK,eAAe;AAEpC,SAAK,OAAO,KAAK,KAAK,MAAM;AAC5B,SAAK,OAAO,UAAU,EAAE,MAAM,QAAQ,UAAU,EAAE,CAAC;AACnD,SAAK,aAAa;AAAA,EACnB;AAAA,EAES,SAAS,MAAM;AACvB,SAAK,OAAO;AAAA,MACX,EAAE,QA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AAC/C,WAAO,EAAE,MAAM;AAAA,EAChB;AAAA,EAEU,eAAe;AACxB,UAAM,QAAQ,KAAK,SAAS;AAE5B,QAAI,CAAC,MAAO;AAEZ,UAAM,EAAE,iBAAiB,iBAAiB,IAAI,KAAK,OAAO;AAC1D,UAAM,QAAQ,iBAAiB,MAAM,EAAE,IAAI,eAAe;AAC1D,UAAM,cAAU,oDAA+B,KAAK,QAAQ,OAAO,KAAK;AAExE,QAAI,SAAS;AACZ,WAAK,OAAO,aAAa,CAAC,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,IACxD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,8 +50,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
50
50
|
};
|
|
51
51
|
updateCursor() {
|
|
52
52
|
const selectedShape = this.editor.getSelectedShapes()[0];
|
|
53
|
-
if (!selectedShape)
|
|
54
|
-
return;
|
|
53
|
+
if (!selectedShape) return;
|
|
55
54
|
const cursorType = import_PointingResizeHandle.CursorTypeMap[this.info.handle];
|
|
56
55
|
this.editor.updateInstanceState({
|
|
57
56
|
cursor: {
|
|
@@ -66,11 +65,9 @@ class Cropping extends import_editor.StateNode {
|
|
|
66
65
|
});
|
|
67
66
|
updateShapes() {
|
|
68
67
|
const { shape, cursorHandleOffset } = this.snapshot;
|
|
69
|
-
if (!shape)
|
|
70
|
-
return;
|
|
68
|
+
if (!shape) return;
|
|
71
69
|
const util = this.editor.getShapeUtil("image");
|
|
72
|
-
if (!util)
|
|
73
|
-
return;
|
|
70
|
+
if (!util) return;
|
|
74
71
|
const props = shape.props;
|
|
75
72
|
const currentPagePoint = this.editor.inputs.currentPagePoint.clone().sub(cursorHandleOffset);
|
|
76
73
|
const originPagePoint = this.editor.inputs.originPagePoint.clone().sub(cursorHandleOffset);
|
|
@@ -86,8 +83,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
86
83
|
case "top":
|
|
87
84
|
case "top_left":
|
|
88
85
|
case "top_right": {
|
|
89
|
-
if (h < import_crop_constants.MIN_CROP_SIZE)
|
|
90
|
-
break;
|
|
86
|
+
if (h < import_crop_constants.MIN_CROP_SIZE) break;
|
|
91
87
|
hasCropChanged = true;
|
|
92
88
|
newCrop.topLeft.y = newCrop.topLeft.y + change.y / h;
|
|
93
89
|
const heightAfterCrop = h * (newCrop.bottomRight.y - newCrop.topLeft.y);
|
|
@@ -107,8 +103,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
107
103
|
case "bottom":
|
|
108
104
|
case "bottom_left":
|
|
109
105
|
case "bottom_right": {
|
|
110
|
-
if (h < import_crop_constants.MIN_CROP_SIZE)
|
|
111
|
-
break;
|
|
106
|
+
if (h < import_crop_constants.MIN_CROP_SIZE) break;
|
|
112
107
|
hasCropChanged = true;
|
|
113
108
|
newCrop.bottomRight.y = Math.min(1, newCrop.bottomRight.y + change.y / h);
|
|
114
109
|
const heightAfterCrop = h * (newCrop.bottomRight.y - newCrop.topLeft.y);
|
|
@@ -122,8 +117,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
122
117
|
case "left":
|
|
123
118
|
case "top_left":
|
|
124
119
|
case "bottom_left": {
|
|
125
|
-
if (w < import_crop_constants.MIN_CROP_SIZE)
|
|
126
|
-
break;
|
|
120
|
+
if (w < import_crop_constants.MIN_CROP_SIZE) break;
|
|
127
121
|
hasCropChanged = true;
|
|
128
122
|
newCrop.topLeft.x = newCrop.topLeft.x + change.x / w;
|
|
129
123
|
const widthAfterCrop = w * (newCrop.bottomRight.x - newCrop.topLeft.x);
|
|
@@ -143,8 +137,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
143
137
|
case "right":
|
|
144
138
|
case "top_right":
|
|
145
139
|
case "bottom_right": {
|
|
146
|
-
if (w < import_crop_constants.MIN_CROP_SIZE)
|
|
147
|
-
break;
|
|
140
|
+
if (w < import_crop_constants.MIN_CROP_SIZE) break;
|
|
148
141
|
hasCropChanged = true;
|
|
149
142
|
newCrop.bottomRight.x = Math.min(1, newCrop.bottomRight.x + change.x / w);
|
|
150
143
|
const widthAfterCrop = w * (newCrop.bottomRight.x - newCrop.topLeft.x);
|
|
@@ -154,8 +147,7 @@ class Cropping extends import_editor.StateNode {
|
|
|
154
147
|
break;
|
|
155
148
|
}
|
|
156
149
|
}
|
|
157
|
-
if (!hasCropChanged)
|
|
158
|
-
return;
|
|
150
|
+
if (!hasCropChanged) return;
|
|
159
151
|
newPoint.add(pointDelta.rot(shape.rotation));
|
|
160
152
|
const partial = {
|
|
161
153
|
id: shape.id,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/tools/SelectTool/childStates/Cropping.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n\tSelectionHandle,\n\tStateNode,\n\tTLBaseShape,\n\tTLEnterEventHandler,\n\tTLEventHandlers,\n\tTLImageShape,\n\tTLImageShapeCrop,\n\tTLPointerEventInfo,\n\tTLShapePartial,\n\tVec2d,\n\tdeepCopy,\n} from '@bigbluebutton/editor'\nimport { MIN_CROP_SIZE } from './Crop/crop-constants'\nimport { CursorTypeMap } from './PointingResizeHandle'\n\ntype Snapshot = ReturnType<Cropping['createSnapshot']>\n\nexport class Cropping extends StateNode {\n\tstatic override id = 'cropping'\n\n\tinfo = {} as TLPointerEventInfo & {\n\t\ttarget: 'selection'\n\t\thandle: SelectionHandle\n\t\tonInteractionEnd?: string\n\t}\n\n\tmarkId = ''\n\n\tprivate snapshot = {} as any as Snapshot\n\n\toverride onEnter: TLEnterEventHandler = (\n\t\tinfo: TLPointerEventInfo & {\n\t\t\ttarget: 'selection'\n\t\t\thandle: SelectionHandle\n\t\t\tonInteractionEnd?: string\n\t\t}\n\t) => {\n\t\tthis.info = info\n\t\tthis.markId = 'cropping'\n\t\tthis.editor.mark(this.markId)\n\t\tthis.snapshot = this.createSnapshot()\n\t\tthis.updateShapes()\n\t}\n\n\toverride onPointerMove: TLEventHandlers['onPointerMove'] = () => {\n\t\tthis.updateShapes()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel: TLEventHandlers['onCancel'] = () => {\n\t\tthis.cancel()\n\t}\n\n\tprivate updateCursor() {\n\t\tconst selectedShape = this.editor.getSelectedShapes()[0]\n\t\tif (!selectedShape) return\n\n\t\tconst cursorType = CursorTypeMap[this.info.handle!]\n\t\tthis.editor.updateInstanceState({\n\t\t\tcursor: {\n\t\t\t\ttype: cursorType,\n\t\t\t\trotation: selectedShape.rotation,\n\t\t\t},\n\t\t})\n\t}\n\n\tprivate getDefaultCrop = (): TLImageShapeCrop => ({\n\t\ttopLeft: { x: 0, y: 0 },\n\t\tbottomRight: { x: 1, y: 1 },\n\t})\n\n\tprivate updateShapes() {\n\t\tconst { shape, cursorHandleOffset } = this.snapshot\n\n\t\tif (!shape) return\n\t\tconst util = this.editor.getShapeUtil<TLImageShape>('image')\n\t\tif (!util) return\n\n\t\tconst props = shape.props\n\n\t\tconst currentPagePoint = this.editor.inputs.currentPagePoint.clone().sub(cursorHandleOffset)\n\t\tconst originPagePoint = this.editor.inputs.originPagePoint.clone().sub(cursorHandleOffset)\n\n\t\tconst change = currentPagePoint.clone().sub(originPagePoint).rot(-shape.rotation)\n\n\t\tconst crop = props.crop ?? this.getDefaultCrop()\n\t\tconst newCrop = deepCopy(crop)\n\n\t\tconst newPoint = new Vec2d(shape.x, shape.y)\n\t\tconst pointDelta = new Vec2d(0, 0)\n\n\t\t// original (uncropped) width and height of shape\n\t\tconst w = (1 / (crop.bottomRight.x - crop.topLeft.x)) * props.w\n\t\tconst h = (1 / (crop.bottomRight.y - crop.topLeft.y)) * props.h\n\n\t\tlet hasCropChanged = false\n\n\t\t// Set y dimension\n\t\tswitch (this.info.handle) {\n\t\t\tcase 'top':\n\t\t\tcase 'top_left':\n\t\t\tcase 'top_right': {\n\t\t\t\tif (h < MIN_CROP_SIZE) break\n\t\t\t\thasCropChanged = true\n\t\t\t\t// top\n\t\t\t\tnewCrop.topLeft.y = newCrop.topLeft.y + change.y / h\n\t\t\t\tconst heightAfterCrop = h * (newCrop.bottomRight.y - newCrop.topLeft.y)\n\n\t\t\t\tif (heightAfterCrop < MIN_CROP_SIZE) {\n\t\t\t\t\tnewCrop.topLeft.y = newCrop.bottomRight.y - MIN_CROP_SIZE / h\n\t\t\t\t\tpointDelta.y = (newCrop.topLeft.y - crop.topLeft.y) * h\n\t\t\t\t} else {\n\t\t\t\t\tif (newCrop.topLeft.y <= 0) {\n\t\t\t\t\t\tnewCrop.topLeft.y = 0\n\t\t\t\t\t\tpointDelta.y = (newCrop.topLeft.y - crop.topLeft.y) * h\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpointDelta.y = change.y\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'bottom':\n\t\t\tcase 'bottom_left':\n\t\t\tcase 'bottom_right': {\n\t\t\t\tif (h < MIN_CROP_SIZE) break\n\t\t\t\thasCropChanged = true\n\t\t\t\t// bottom\n\t\t\t\tnewCrop.bottomRight.y = Math.min(1, newCrop.bottomRight.y + change.y / h)\n\t\t\t\tconst heightAfterCrop = h * (newCrop.bottomRight.y - newCrop.topLeft.y)\n\n\t\t\t\tif (heightAfterCrop < MIN_CROP_SIZE) {\n\t\t\t\t\tnewCrop.bottomRight.y = newCrop.topLeft.y + MIN_CROP_SIZE / h\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Set x dimension\n\t\tswitch (this.info.handle) {\n\t\t\tcase 'left':\n\t\t\tcase 'top_left':\n\t\t\tcase 'bottom_left': {\n\t\t\t\tif (w < MIN_CROP_SIZE) break\n\t\t\t\thasCropChanged = true\n\t\t\t\t// left\n\t\t\t\tnewCrop.topLeft.x = newCrop.topLeft.x + change.x / w\n\t\t\t\tconst widthAfterCrop = w * (newCrop.bottomRight.x - newCrop.topLeft.x)\n\n\t\t\t\tif (widthAfterCrop < MIN_CROP_SIZE) {\n\t\t\t\t\tnewCrop.topLeft.x = newCrop.bottomRight.x - MIN_CROP_SIZE / w\n\t\t\t\t\tpointDelta.x = (newCrop.topLeft.x - crop.topLeft.x) * w\n\t\t\t\t} else {\n\t\t\t\t\tif (newCrop.topLeft.x <= 0) {\n\t\t\t\t\t\tnewCrop.topLeft.x = 0\n\t\t\t\t\t\tpointDelta.x = (newCrop.topLeft.x - crop.topLeft.x) * w\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpointDelta.x = change.x\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'right':\n\t\t\tcase 'top_right':\n\t\t\tcase 'bottom_right': {\n\t\t\t\tif (w < MIN_CROP_SIZE) break\n\t\t\t\thasCropChanged = true\n\t\t\t\t// right\n\t\t\t\tnewCrop.bottomRight.x = Math.min(1, newCrop.bottomRight.x + change.x / w)\n\t\t\t\tconst widthAfterCrop = w * (newCrop.bottomRight.x - newCrop.topLeft.x)\n\n\t\t\t\tif (widthAfterCrop < MIN_CROP_SIZE) {\n\t\t\t\t\tnewCrop.bottomRight.x = newCrop.topLeft.x + MIN_CROP_SIZE / w\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (!hasCropChanged) return\n\n\t\tnewPoint.add(pointDelta.rot(shape.rotation))\n\n\t\tconst partial: TLShapePartial<\n\t\t\tTLBaseShape<string, { w: number; h: number; crop: TLImageShapeCrop }>\n\t\t> = {\n\t\t\tid: shape.id,\n\t\t\ttype: shape.type,\n\t\t\tx: newPoint.x,\n\t\t\ty: newPoint.y,\n\t\t\tprops: {\n\t\t\t\tcrop: newCrop,\n\t\t\t\tw: (newCrop.bottomRight.x - newCrop.topLeft.x) * w,\n\t\t\t\th: (newCrop.bottomRight.y - newCrop.topLeft.y) * h,\n\t\t\t},\n\t\t}\n\n\t\tthis.editor.updateShapes([partial], { squashing: true })\n\t\tthis.updateCursor()\n\t}\n\n\tprivate complete() {\n\t\tif (this.info.onInteractionEnd) {\n\t\t\tthis.editor.setCurrentTool(this.info.onInteractionEnd, this.info)\n\t\t} else {\n\t\t\tthis.editor.setCroppingShape(null)\n\t\t\tthis.parent.transition('idle')\n\t\t}\n\t}\n\n\tprivate cancel() {\n\t\tthis.editor.bailToMark(this.markId)\n\t\tif (this.info.onInteractionEnd) {\n\t\t\tthis.editor.setCurrentTool(this.info.onInteractionEnd, this.info)\n\t\t} else {\n\t\t\tthis.editor.setCroppingShape(null)\n\t\t\tthis.parent.transition('idle')\n\t\t}\n\t}\n\n\tprivate createSnapshot() {\n\t\tconst selectionRotation = this.editor.getSelectionRotation()\n\t\tconst {\n\t\t\tinputs: { originPagePoint },\n\t\t} = this.editor\n\n\t\tconst shape = this.editor.getOnlySelectedShape() as TLImageShape\n\n\t\tconst selectionBounds = this.editor.getSelectionRotatedPageBounds()!\n\n\t\tconst dragHandlePoint = Vec2d.RotWith(\n\t\t\tselectionBounds.getHandlePoint(this.info.handle!),\n\t\t\tselectionBounds.point,\n\t\t\tselectionRotation\n\t\t)\n\n\t\tconst cursorHandleOffset = Vec2d.Sub(originPagePoint, dragHandlePoint)\n\n\t\treturn {\n\t\t\tshape,\n\t\t\tcursorHandleOffset,\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAYO;AACP,4BAA8B;AAC9B,kCAA8B;AAIvB,MAAM,iBAAiB,wBAAU;AAAA,EACvC,OAAgB,KAAK;AAAA,EAErB,OAAO,CAAC;AAAA,EAMR,SAAS;AAAA,EAED,WAAW,CAAC;AAAA,EAEX,UAA+B,CACvC,SAKI;AACJ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO,KAAK,KAAK,MAAM;AAC5B,SAAK,WAAW,KAAK,eAAe;AACpC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,IAAI;AACjC,WAAK,OAAO,WAAW,MAAM;AAAA,IAC9B;AAAA,EACD;AAAA,EAEQ,iBAAiB;AACxB,UAAM,oBAAoB,KAAK,OAAO,qBAAqB;AAC3D,UAAM;AAAA,MACL,QAAQ,EAAE,gBAAgB;AAAA,IAC3B,IAAI,KAAK;AAET,UAAM,QAAQ,KAAK,OAAO,qBAAqB;AAE/C,UAAM,kBAAkB,KAAK,OAAO,8BAA8B;AAElE,UAAM,kBAAkB,oBAAM;AAAA,MAC7B,gBAAgB,eAAe,KAAK,KAAK,MAAO;AAAA,MAChD,gBAAgB;AAAA,MAChB;AAAA,IACD;AAEA,UAAM,qBAAqB,oBAAM,IAAI,iBAAiB,eAAe;AAErE,WAAO;AAAA,MACN;AAAA,MACA;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,8 +41,7 @@ class DraggingHandle extends import_editor.StateNode {
|
|
|
41
41
|
this.parent.setCurrentToolIdMask(info.onInteractionEnd);
|
|
42
42
|
this.shapeId = shape.id;
|
|
43
43
|
this.markId = isCreating ? `creating:${shape.id}` : "dragging handle";
|
|
44
|
-
if (!isCreating)
|
|
45
|
-
this.editor.mark(this.markId);
|
|
44
|
+
if (!isCreating) this.editor.mark(this.markId);
|
|
46
45
|
this.initialHandle = (0, import_editor.deepCopy)(handle);
|
|
47
46
|
this.initialPageTransform = this.editor.getShapePageTransform(shape);
|
|
48
47
|
this.initialPageRotation = this.initialPageTransform.rotation();
|
|
@@ -166,8 +165,7 @@ class DraggingHandle extends import_editor.StateNode {
|
|
|
166
165
|
} = editor;
|
|
167
166
|
const initial = this.info.shape;
|
|
168
167
|
const shape = editor.getShape(shapeId);
|
|
169
|
-
if (!shape)
|
|
170
|
-
return;
|
|
168
|
+
if (!shape) return;
|
|
171
169
|
const util = editor.getShapeUtil(shape);
|
|
172
170
|
let point = currentPagePoint.clone().sub(initialPagePoint).rot(-initialPageRotation).add(initialHandle);
|
|
173
171
|
if (shiftKey && initialAdjacentHandle && initialHandle.id !== "middle") {
|
|
@@ -179,8 +177,7 @@ class DraggingHandle extends import_editor.StateNode {
|
|
|
179
177
|
editor.snaps.clear();
|
|
180
178
|
if (initialHandle.canSnap && (isSnapMode ? !ctrlKey : ctrlKey)) {
|
|
181
179
|
const pageTransform = editor.getShapePageTransform(shape.id);
|
|
182
|
-
if (!pageTransform)
|
|
183
|
-
throw Error("Expected a page transform");
|
|
180
|
+
if (!pageTransform) throw Error("Expected a page transform");
|
|
184
181
|
const handleIndex = editor.getShapeHandles(shape).filter(({ type }) => type === "vertex").sort(import_editor.sortByIndex).findIndex(({ index }) => initialHandle.index === index);
|
|
185
182
|
const additionalSegments = util.getOutlineSegments(shape).map((segment) => import_editor.Matrix2d.applyToPoints(pageTransform, segment)).filter((_segment, i) => i !== handleIndex - 1 && i !== handleIndex);
|
|
186
183
|
const snapDelta = snaps.getSnappingHandleDelta({
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/tools/SelectTool/childStates/DraggingHandle.ts"],
|
|
4
4
|
"sourcesContent": ["import {\n\tMatrix2d,\n\tStateNode,\n\tTLArrowShape,\n\tTLArrowShapeTerminal,\n\tTLCancelEvent,\n\tTLEnterEventHandler,\n\tTLEventHandlers,\n\tTLHandle,\n\tTLKeyboardEvent,\n\tTLPointerEventInfo,\n\tTLShapeId,\n\tTLShapePartial,\n\tVec2d,\n\tdeepCopy,\n\tsnapAngle,\n\tsortByIndex,\n} from '@bigbluebutton/editor'\n\nexport class DraggingHandle extends StateNode {\n\tstatic override id = 'dragging_handle'\n\n\tshapeId = '' as TLShapeId\n\tinitialHandle = {} as TLHandle\n\tinitialAdjacentHandle = null as TLHandle | null\n\tinitialPagePoint = {} as Vec2d\n\n\tmarkId = ''\n\tinitialPageTransform: any\n\tinitialPageRotation: any\n\n\tinfo = {} as TLPointerEventInfo & {\n\t\tshape: TLArrowShape\n\t\ttarget: 'handle'\n\t\tonInteractionEnd?: string\n\t\tisCreating: boolean\n\t}\n\n\tisPrecise = false\n\tisPreciseId = null as TLShapeId | null\n\tpointingId = null as TLShapeId | null\n\n\toverride onEnter: TLEnterEventHandler = (\n\t\tinfo: TLPointerEventInfo & {\n\t\t\tshape: TLArrowShape\n\t\t\ttarget: 'handle'\n\t\t\tonInteractionEnd?: string\n\t\t\tisCreating: boolean\n\t\t}\n\t) => {\n\t\tconst { shape, isCreating, handle } = info\n\t\tthis.info = info\n\t\tthis.parent.setCurrentToolIdMask(info.onInteractionEnd)\n\t\tthis.shapeId = shape.id\n\t\tthis.markId = isCreating ? `creating:${shape.id}` : 'dragging handle'\n\t\tif (!isCreating) this.editor.mark(this.markId)\n\t\tthis.initialHandle = deepCopy(handle)\n\t\tthis.initialPageTransform = this.editor.getShapePageTransform(shape)!\n\t\tthis.initialPageRotation = this.initialPageTransform.rotation()\n\t\tthis.initialPagePoint = this.editor.inputs.originPagePoint.clone()\n\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: isCreating ? 'cross' : 'grabbing', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\n\t\t// <!-- Only relevant to arrows\n\t\tconst handles = this.editor.getShapeHandles(shape)!.sort(sortByIndex)\n\t\tconst index = handles.findIndex((h) => h.id === info.handle.id)\n\n\t\t// Find the adjacent handle\n\t\tthis.initialAdjacentHandle = null\n\n\t\t// Start from the handle and work forward\n\t\tfor (let i = index + 1; i < handles.length; i++) {\n\t\t\tconst handle = handles[i]\n\t\t\tif (handle.type === 'vertex' && handle.id !== 'middle' && handle.id !== info.handle.id) {\n\t\t\t\tthis.initialAdjacentHandle = handle\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// If still no handle, start from the end and work backward\n\t\tif (!this.initialAdjacentHandle) {\n\t\t\tfor (let i = handles.length - 1; i >= 0; i--) {\n\t\t\t\tconst handle = handles[i]\n\t\t\t\tif (handle.type === 'vertex' && handle.id !== 'middle' && handle.id !== info.handle.id) {\n\t\t\t\t\tthis.initialAdjacentHandle = handle\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst initialTerminal = shape.props[info.handle.id as 'start' | 'end']\n\n\t\tthis.isPrecise = false\n\n\t\tif (initialTerminal?.type === 'binding') {\n\t\t\tthis.editor.setHintingShapes([initialTerminal.boundShapeId])\n\n\t\t\tthis.isPrecise = initialTerminal.isPrecise\n\t\t\tif (this.isPrecise) {\n\t\t\t\tthis.isPreciseId = initialTerminal.boundShapeId\n\t\t\t} else {\n\t\t\t\tthis.resetExactTimeout()\n\t\t\t}\n\t\t} else {\n\t\t\tthis.editor.setHintingShapes([])\n\t\t}\n\t\t// -->\n\n\t\tthis.update()\n\n\t\tthis.editor.select(this.shapeId)\n\t}\n\n\t// Only relevant to arrows\n\tprivate exactTimeout = -1 as any\n\n\t// Only relevant to arrows\n\tprivate resetExactTimeout() {\n\t\tif (this.exactTimeout !== -1) {\n\t\t\tthis.clearExactTimeout()\n\t\t}\n\n\t\tthis.exactTimeout = setTimeout(() => {\n\t\t\tif (this.getIsActive() && !this.isPrecise) {\n\t\t\t\tthis.isPrecise = true\n\t\t\t\tthis.isPreciseId = this.pointingId\n\t\t\t\tthis.update()\n\t\t\t}\n\t\t\tthis.exactTimeout = -1\n\t\t}, 750)\n\t}\n\n\t// Only relevant to arrows\n\tprivate clearExactTimeout() {\n\t\tif (this.exactTimeout !== -1) {\n\t\t\tclearTimeout(this.exactTimeout)\n\t\t\tthis.exactTimeout = -1\n\t\t}\n\t}\n\n\toverride onPointerMove: TLEventHandlers['onPointerMove'] = () => {\n\t\tthis.update()\n\t}\n\n\toverride onKeyDown: TLKeyboardEvent | undefined = () => {\n\t\tthis.update()\n\t}\n\n\toverride onKeyUp: TLKeyboardEvent | undefined = () => {\n\t\tthis.update()\n\t}\n\n\toverride onPointerUp: TLEventHandlers['onPointerUp'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onComplete: TLEventHandlers['onComplete'] = () => {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel: TLCancelEvent = () => {\n\t\tthis.cancel()\n\t}\n\n\toverride onExit = () => {\n\t\tthis.parent.setCurrentToolIdMask(undefined)\n\t\tthis.editor.setHintingShapes([])\n\t\tthis.editor.snaps.clear()\n\t\tthis.editor.updateInstanceState(\n\t\t\t{ cursor: { type: 'default', rotation: 0 } },\n\t\t\t{ ephemeral: true }\n\t\t)\n\t}\n\n\tprivate complete() {\n\t\tthis.editor.snaps.clear()\n\n\t\tconst { onInteractionEnd } = this.info\n\t\tif (this.editor.getInstanceState().isToolLocked && onInteractionEnd) {\n\t\t\t// Return to the tool that was active before this one,\n\t\t\t// but only if tool lock is turned on!\n\t\t\tthis.editor.setCurrentTool(onInteractionEnd, { shapeId: this.shapeId })\n\t\t\treturn\n\t\t}\n\n\t\tthis.parent.transition('idle')\n\t}\n\n\tprivate cancel() {\n\t\tthis.editor.bailToMark(this.markId)\n\t\tthis.editor.snaps.clear()\n\n\t\tconst { onInteractionEnd } = this.info\n\t\tif (onInteractionEnd) {\n\t\t\t// Return to the tool that was active before this one,\n\t\t\t// whether tool lock is turned on or not!\n\t\t\tthis.editor.setCurrentTool(onInteractionEnd, { shapeId: this.shapeId })\n\t\t\treturn\n\t\t}\n\n\t\tthis.parent.transition('idle')\n\t}\n\n\tprivate update() {\n\t\tconst { editor, shapeId, initialPagePoint } = this\n\t\tconst { initialHandle, initialPageRotation, initialAdjacentHandle } = this\n\t\tconst hintingShapeIds = this.editor.getHintingShapeIds()\n\t\tconst isSnapMode = this.editor.user.getIsSnapMode()\n\t\tconst {\n\t\t\tsnaps,\n\t\t\tinputs: { currentPagePoint, shiftKey, ctrlKey, altKey, pointerVelocity },\n\t\t} = editor\n\n\t\tconst initial = this.info.shape\n\t\tconst shape = editor.getShape(shapeId)\n\t\tif (!shape) return\n\t\tconst util = editor.getShapeUtil(shape)\n\n\t\tlet point = currentPagePoint\n\t\t\t.clone()\n\t\t\t.sub(initialPagePoint)\n\t\t\t.rot(-initialPageRotation)\n\t\t\t.add(initialHandle)\n\n\t\tif (shiftKey && initialAdjacentHandle && initialHandle.id !== 'middle') {\n\t\t\tconst angle = Vec2d.Angle(initialAdjacentHandle, point)\n\t\t\tconst snappedAngle = snapAngle(angle, 24)\n\t\t\tconst angleDifference = snappedAngle - angle\n\t\t\tpoint = Vec2d.RotWith(point, initialAdjacentHandle, angleDifference)\n\t\t}\n\n\t\t// Clear any existing snaps\n\t\teditor.snaps.clear()\n\n\t\tif (initialHandle.canSnap && (isSnapMode ? !ctrlKey : ctrlKey)) {\n\t\t\t// We're snapping\n\t\t\tconst pageTransform = editor.getShapePageTransform(shape.id)\n\t\t\tif (!pageTransform) throw Error('Expected a page transform')\n\n\t\t\t// We want to skip the segments that include the handle, so\n\t\t\t// find the index of the handle that shares the same index property\n\t\t\t// as the initial dragging handle; this catches a quirk of create handles\n\t\t\tconst handleIndex = editor\n\t\t\t\t.getShapeHandles(shape)!\n\t\t\t\t.filter(({ type }) => type === 'vertex')\n\t\t\t\t.sort(sortByIndex)\n\t\t\t\t.findIndex(({ index }) => initialHandle.index === index)\n\n\t\t\t// Get all the outline segments from the shape\n\t\t\tconst additionalSegments = util\n\t\t\t\t.getOutlineSegments(shape)\n\t\t\t\t.map((segment) => Matrix2d.applyToPoints(pageTransform, segment))\n\t\t\t\t.filter((_segment, i) => i !== handleIndex - 1 && i !== handleIndex)\n\n\t\t\tconst snapDelta = snaps.getSnappingHandleDelta({\n\t\t\t\tadditionalSegments,\n\t\t\t\thandlePoint: Matrix2d.applyToPoint(pageTransform, point),\n\t\t\t})\n\n\t\t\tif (snapDelta) {\n\t\t\t\tsnapDelta.rot(-editor.getShapeParentTransform(shape)!.rotation())\n\t\t\t\tpoint.add(snapDelta)\n\t\t\t}\n\t\t}\n\n\t\tconst changes = util.onHandleChange?.(shape, {\n\t\t\thandle: {\n\t\t\t\t...initialHandle,\n\t\t\t\tx: point.x,\n\t\t\t\ty: point.y,\n\t\t\t},\n\t\t\tisPrecise: this.isPrecise || altKey,\n\t\t\tinitial: initial,\n\t\t})\n\n\t\tconst next: TLShapePartial<any> = { ...shape, ...changes }\n\n\t\t// Arrows\n\t\tif (initialHandle.canBind) {\n\t\t\tconst bindingAfter = (next.props as any)[initialHandle.id] as TLArrowShapeTerminal | undefined\n\n\t\t\tif (bindingAfter?.type === 'binding') {\n\t\t\t\tif (hintingShapeIds[0] !== bindingAfter.boundShapeId) {\n\t\t\t\t\teditor.setHintingShapes([bindingAfter.boundShapeId])\n\t\t\t\t\tthis.pointingId = bindingAfter.boundShapeId\n\t\t\t\t\tthis.isPrecise = pointerVelocity.len() < 0.5 || altKey\n\t\t\t\t\tthis.isPreciseId = this.isPrecise ? bindingAfter.boundShapeId : null\n\t\t\t\t\tthis.resetExactTimeout()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (hintingShapeIds.length > 0) {\n\t\t\t\t\teditor.setHintingShapes([])\n\t\t\t\t\tthis.pointingId = null\n\t\t\t\t\tthis.isPrecise = false\n\t\t\t\t\tthis.isPreciseId = null\n\t\t\t\t\tthis.resetExactTimeout()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (changes) {\n\t\t\teditor.updateShapes([next], { squashing: true })\n\t\t}\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAiBO;AAEA,MAAM,uBAAuB,wBAAU;AAAA,EAC7C,OAAgB,KAAK;AAAA,EAErB,UAAU;AAAA,EACV,gBAAgB,CAAC;AAAA,EACjB,wBAAwB;AAAA,EACxB,mBAAmB,CAAC;AAAA,EAEpB,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EAEA,OAAO,CAAC;AAAA,EAOR,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EAEJ,UAA+B,CACvC,SAMI;AACJ,UAAM,EAAE,OAAO,YAAY,OAAO,I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|
|
29
29
|
onEnter = () => {
|
|
30
30
|
const editingShape = this.editor.getEditingShape();
|
|
31
|
-
if (!editingShape)
|
|
32
|
-
throw Error("Entered editing state without an editing shape");
|
|
31
|
+
if (!editingShape) throw Error("Entered editing state without an editing shape");
|
|
33
32
|
(0, import_updateHoveredId.updateHoveredId)(this.editor);
|
|
34
33
|
this.editor.select(editingShape);
|
|
35
34
|
};
|
|
36
35
|
onExit = () => {
|
|
37
36
|
const { editingShapeId } = this.editor.getCurrentPageState();
|
|
38
|
-
if (!editingShapeId)
|
|
39
|
-
return;
|
|
37
|
+
if (!editingShapeId) return;
|
|
40
38
|
this.editor.setEditingShape(null);
|
|
41
39
|
const shape = this.editor.getShape(editingShapeId);
|
|
42
40
|
const util = this.editor.getShapeUtil(shape);
|