@tomorrowevening/theatre-studio 1.0.5 → 1.0.6
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/index.js +105 -56
- package/package.json +1 -1
- package/dist/IDBStorage.js +0 -19
- package/dist/PaneManager.js +0 -112
- package/dist/Scrub.js +0 -134
- package/dist/Studio.js +0 -405
- package/dist/StudioBundle.js +0 -21
- package/dist/StudioStore/StudioStore.js +0 -163
- package/dist/StudioStore/createTransactionPrivateApi.js +0 -204
- package/dist/StudioStore/generateDiskStateRevision.js +0 -4
- package/dist/StudioStore/persistStateOfStudio.js +0 -61
- package/dist/TheatreStudio.js +0 -154
- package/dist/UI/UI.js +0 -65
- package/dist/UI/UINonSSRBits.js +0 -60
- package/dist/UIRoot/PanelsRoot.js +0 -19
- package/dist/UIRoot/PointerCapturing.js +0 -96
- package/dist/UIRoot/ProvideTheme.js +0 -9
- package/dist/UIRoot/UIRoot.js +0 -79
- package/dist/UIRoot/useKeyboardShortcuts.js +0 -158
- package/dist/checkForUpdates.js +0 -86
- package/dist/css.js +0 -116
- package/dist/getStudio.js +0 -10
- package/dist/notify.js +0 -328
- package/dist/panels/BasePanel/BasePanel.js +0 -74
- package/dist/panels/BasePanel/ExtensionPaneWrapper.js +0 -138
- package/dist/panels/BasePanel/PanelDragZone.js +0 -88
- package/dist/panels/BasePanel/PanelResizeHandle.js +0 -184
- package/dist/panels/BasePanel/PanelResizers.js +0 -14
- package/dist/panels/BasePanel/PanelWrapper.js +0 -34
- package/dist/panels/BasePanel/common.js +0 -52
- package/dist/panels/DetailPanel/DetailPanel.js +0 -146
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailCompoundPropEditor.js +0 -169
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailSimplePropEditor.js +0 -22
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/SingleRowPropEditor.js +0 -89
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/getDetailRowHighlightBackground.js +0 -7
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/rowIndentationFormulaCSS.js +0 -1
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail.js +0 -28
- package/dist/panels/DetailPanel/EmptyState.js +0 -36
- package/dist/panels/DetailPanel/ObjectDetails.js +0 -52
- package/dist/panels/DetailPanel/ProjectDetails/StateConflictRow.js +0 -86
- package/dist/panels/DetailPanel/ProjectDetails.js +0 -98
- package/dist/panels/OutlinePanel/BaseItem.js +0 -136
- package/dist/panels/OutlinePanel/ObjectsList/ObjectItem.js +0 -14
- package/dist/panels/OutlinePanel/ObjectsList/ObjectsList.js +0 -85
- package/dist/panels/OutlinePanel/OutlinePanel.js +0 -73
- package/dist/panels/OutlinePanel/ProjectsList/ProjectListItem.js +0 -38
- package/dist/panels/OutlinePanel/ProjectsList/ProjectsList.js +0 -22
- package/dist/panels/OutlinePanel/SheetsList/SheetInstanceItem.js +0 -36
- package/dist/panels/OutlinePanel/SheetsList/SheetItem.js +0 -23
- package/dist/panels/OutlinePanel/SheetsList/SheetsList.js +0 -15
- package/dist/panels/OutlinePanel/outlinePanelUtils.js +0 -23
- package/dist/panels/SequenceEditorPanel/DopeSheet/DopeSheet.js +0 -21
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/AnyCompositeRow.js +0 -74
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/Left.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PrimitivePropRow.js +0 -97
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PropWithChildrenRow.js +0 -15
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetObjectRow.js +0 -19
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetRow.js +0 -20
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/usePropHighlightMouseEnter.js +0 -33
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeConnector.js +0 -187
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeDot.js +0 -158
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeEditor.js +0 -32
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeVisualDot.js +0 -61
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/iif.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/useAggregateKeyframeEditorUtils.js +0 -73
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack.js +0 -407
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -108
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/BasicKeyframeConnector.js +0 -185
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover.js +0 -397
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveSegmentEditor.js +0 -136
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/EasingOption.js +0 -52
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/SVGCurveSegment.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/colors.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/shared.js +0 -84
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useFreezableMemo.js +0 -16
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useUIOptionGrid.js +0 -82
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/DeterminePropEditorForSingleKeyframe.js +0 -93
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeDot.js +0 -254
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeEditor.js +0 -22
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useSingleKeyframeInlineEditorPopover.js +0 -11
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useTempTransactionEditingTools.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetBackground.js +0 -24
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetSelectionView.js +0 -272
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/FocusRangeCurtains.js +0 -88
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/HorizontallyScrollableArea.js +0 -215
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget.js +0 -55
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthEditorPopover.js +0 -69
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthIndicator.js +0 -217
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PrimitivePropRow.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PropWithChildrenRow.js +0 -18
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Right.js +0 -30
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Row.js +0 -50
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetObjectRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes.js +0 -92
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine.js +0 -62
- package/dist/panels/SequenceEditorPanel/DopeSheet/selections.js +0 -149
- package/dist/panels/SequenceEditorPanel/DopeSheet/setCollapsedSheetObjectOrCompoundProp.js +0 -10
- package/dist/panels/SequenceEditorPanel/FrameGrid/FrameGrid.js +0 -92
- package/dist/panels/SequenceEditorPanel/FrameGrid/StampsGrid.js +0 -99
- package/dist/panels/SequenceEditorPanel/FrameGrid/createGrid.js +0 -49
- package/dist/panels/SequenceEditorPanel/FrameStampPositionProvider.js +0 -189
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -91
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/Curve.js +0 -87
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/CurveHandle.js +0 -186
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotNonScalar.js +0 -162
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotScalar.js +0 -209
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorNonScalarDash.js +0 -23
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.js +0 -30
- package/dist/panels/SequenceEditorPanel/GraphEditor/GraphEditor.js +0 -73
- package/dist/panels/SequenceEditorPanel/GraphEditor/PrimitivePropGraph.js +0 -20
- package/dist/panels/SequenceEditorPanel/GraphEditorToggle.js +0 -59
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnap.js +0 -36
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnapHitZoneUI.js +0 -57
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeStrip.js +0 -233
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeThumb.js +0 -217
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeZone.js +0 -181
- package/dist/panels/SequenceEditorPanel/RightOverlay/FrameStamp.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/HorizontalScrollbar.js +0 -235
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerDot.js +0 -184
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerEditorPopover.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/Markers.js +0 -13
- package/dist/panels/SequenceEditorPanel/RightOverlay/Playhead.js +0 -265
- package/dist/panels/SequenceEditorPanel/RightOverlay/PlayheadPositionPopover.js +0 -64
- package/dist/panels/SequenceEditorPanel/RightOverlay/RightOverlay.js +0 -35
- package/dist/panels/SequenceEditorPanel/RightOverlay/TopStrip.js +0 -31
- package/dist/panels/SequenceEditorPanel/SequenceEditorPanel.js +0 -179
- package/dist/panels/SequenceEditorPanel/VerticalScrollContainer.js +0 -42
- package/dist/panels/SequenceEditorPanel/layout/layout.js +0 -166
- package/dist/panels/SequenceEditorPanel/layout/tree.js +0 -139
- package/dist/panels/SequenceEditorPanel/whatPropIsHighlighted.js +0 -58
- package/dist/propEditors/DefaultValueIndicator.js +0 -64
- package/dist/propEditors/NextPrevKeyframeCursors.js +0 -135
- package/dist/propEditors/getNearbyKeyframesOfTrack.js +0 -46
- package/dist/propEditors/simpleEditors/BooleanPropEditor.js +0 -17
- package/dist/propEditors/simpleEditors/FilePropEditor.js +0 -118
- package/dist/propEditors/simpleEditors/ISimplePropEditorReactProps.js +0 -1
- package/dist/propEditors/simpleEditors/ImagePropEditor.js +0 -126
- package/dist/propEditors/simpleEditors/NumberPropEditor.js +0 -9
- package/dist/propEditors/simpleEditors/RgbaPropEditor.js +0 -73
- package/dist/propEditors/simpleEditors/StringLiteralPropEditor.js +0 -10
- package/dist/propEditors/simpleEditors/StringPropEditor.js +0 -6
- package/dist/propEditors/simpleEditors/simplePropEditorByPropType.js +0 -16
- package/dist/propEditors/useEditingToolsForCompoundProp.js +0 -228
- package/dist/propEditors/useEditingToolsForSimpleProp.js +0 -229
- package/dist/propEditors/utils/IEditingTools.js +0 -1
- package/dist/propEditors/utils/PropConfigForType.js +0 -1
- package/dist/propEditors/utils/getPropTypeByPointer.js +0 -48
- package/dist/propEditors/utils/propNameTextCSS.js +0 -7
- package/dist/selectors.js +0 -63
- package/dist/store/index.js +0 -184
- package/dist/store/stateEditors.js +0 -774
- package/dist/store/types/ahistoric.js +0 -1
- package/dist/store/types/ephemeral.js +0 -1
- package/dist/store/types/historic.js +0 -1
- package/dist/store/types/index.js +0 -3
- package/dist/toolbars/ExtensionToolbar/ExtensionToolbar.js +0 -51
- package/dist/toolbars/ExtensionToolbar/Toolset.js +0 -27
- package/dist/toolbars/ExtensionToolbar/tools/ExtensionFlyoutMenu.js +0 -51
- package/dist/toolbars/ExtensionToolbar/tools/IconButton.js +0 -16
- package/dist/toolbars/ExtensionToolbar/tools/Switch.js +0 -20
- package/dist/toolbars/GlobalToolbar.js +0 -142
- package/dist/toolbars/MoreMenu/MoreMenu.js +0 -133
- package/dist/toolbars/PinButton.js +0 -26
- package/dist/uiComponents/DetailPanelButton.js +0 -21
- package/dist/uiComponents/PointerEventsHandler.js +0 -80
- package/dist/uiComponents/Popover/ArrowContext.js +0 -3
- package/dist/uiComponents/Popover/BasicPopover.js +0 -35
- package/dist/uiComponents/Popover/BasicTooltip.js +0 -10
- package/dist/uiComponents/Popover/ErrorTooltip.js +0 -9
- package/dist/uiComponents/Popover/MinimalTooltip.js +0 -6
- package/dist/uiComponents/Popover/PopoverArrow.js +0 -38
- package/dist/uiComponents/Popover/TooltipContext.js +0 -46
- package/dist/uiComponents/Popover/TooltipWrapper.js +0 -103
- package/dist/uiComponents/Popover/usePopover.js +0 -132
- package/dist/uiComponents/Popover/useTooltip.js +0 -33
- package/dist/uiComponents/RoomToClick.js +0 -10
- package/dist/uiComponents/SVGIcon.js +0 -19
- package/dist/uiComponents/ShowMousePosition.js +0 -30
- package/dist/uiComponents/colorPicker/components/EditingProvider.js +0 -15
- package/dist/uiComponents/colorPicker/components/RgbaColorPicker.js +0 -31
- package/dist/uiComponents/colorPicker/components/common/Alpha.js +0 -54
- package/dist/uiComponents/colorPicker/components/common/AlphaColorPicker.js +0 -28
- package/dist/uiComponents/colorPicker/components/common/Hue.js +0 -41
- package/dist/uiComponents/colorPicker/components/common/Interactive.js +0 -142
- package/dist/uiComponents/colorPicker/components/common/Pointer.js +0 -39
- package/dist/uiComponents/colorPicker/components/common/Saturation.js +0 -44
- package/dist/uiComponents/colorPicker/hooks/useColorManipulation.js +0 -77
- package/dist/uiComponents/colorPicker/hooks/useEventCallback.js +0 -10
- package/dist/uiComponents/colorPicker/hooks/useIsomorphicLayoutEffect.js +0 -5
- package/dist/uiComponents/colorPicker/index.js +0 -1
- package/dist/uiComponents/colorPicker/types.js +0 -1
- package/dist/uiComponents/colorPicker/utils/clamp.js +0 -6
- package/dist/uiComponents/colorPicker/utils/compare.js +0 -25
- package/dist/uiComponents/colorPicker/utils/convert.js +0 -165
- package/dist/uiComponents/colorPicker/utils/round.js +0 -3
- package/dist/uiComponents/colorPicker/utils/validate.js +0 -10
- package/dist/uiComponents/createCursorLock.js +0 -2
- package/dist/uiComponents/form/BasicCheckbox.js +0 -5
- package/dist/uiComponents/form/BasicNumberInput.js +0 -261
- package/dist/uiComponents/form/BasicSelect.js +0 -58
- package/dist/uiComponents/form/BasicStringInput.js +0 -151
- package/dist/uiComponents/form/BasicSwitch.js +0 -60
- package/dist/uiComponents/icons/AddImage.js +0 -6
- package/dist/uiComponents/icons/ArrowClockwise.js +0 -6
- package/dist/uiComponents/icons/ArrowsOutCardinal.js +0 -6
- package/dist/uiComponents/icons/Bell.js +0 -6
- package/dist/uiComponents/icons/Camera.js +0 -7
- package/dist/uiComponents/icons/ChevronDown.js +0 -6
- package/dist/uiComponents/icons/ChevronLeft.js +0 -6
- package/dist/uiComponents/icons/ChevronRight.js +0 -6
- package/dist/uiComponents/icons/Cube.js +0 -6
- package/dist/uiComponents/icons/CubeFull.js +0 -6
- package/dist/uiComponents/icons/CubeHalf.js +0 -6
- package/dist/uiComponents/icons/CubeRendered.js +0 -7
- package/dist/uiComponents/icons/Details.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronLeft.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronRight.js +0 -6
- package/dist/uiComponents/icons/Ellipsis.js +0 -6
- package/dist/uiComponents/icons/EllipsisFill.js +0 -6
- package/dist/uiComponents/icons/GlobeSimple.js +0 -6
- package/dist/uiComponents/icons/Outline.js +0 -6
- package/dist/uiComponents/icons/Package.js +0 -6
- package/dist/uiComponents/icons/Resize.js +0 -7
- package/dist/uiComponents/icons/Trash.js +0 -6
- package/dist/uiComponents/icons/index.js +0 -20
- package/dist/uiComponents/isSafari.js +0 -2
- package/dist/uiComponents/onPointerOutside.js +0 -19
- package/dist/uiComponents/selects/BasicSelect.js +0 -24
- package/dist/uiComponents/simpleContextMenu/ContextMenu/BaseMenu.js +0 -40
- package/dist/uiComponents/simpleContextMenu/ContextMenu/ContextMenu.js +0 -87
- package/dist/uiComponents/simpleContextMenu/ContextMenu/Item.js +0 -37
- package/dist/uiComponents/simpleContextMenu/useContextMenu.js +0 -20
- package/dist/uiComponents/simpleContextMenu/useRequestContextMenu.js +0 -22
- package/dist/uiComponents/toolbar/ToolbarDropdownSelect.js +0 -7
- package/dist/uiComponents/toolbar/ToolbarIconButton.js +0 -74
- package/dist/uiComponents/toolbar/ToolbarSwitchSelect.js +0 -12
- package/dist/uiComponents/toolbar/ToolbarSwitchSelectContainer.js +0 -9
- package/dist/uiComponents/useBoundingClientRect.js +0 -13
- package/dist/uiComponents/useDebugRefreshEvery.js +0 -19
- package/dist/uiComponents/useDrag.js +0 -199
- package/dist/uiComponents/useHotspot.js +0 -30
- package/dist/uiComponents/useHover.js +0 -23
- package/dist/uiComponents/useHoverWithoutDescendants.js +0 -33
- package/dist/uiComponents/useKeyDown.js +0 -9
- package/dist/uiComponents/useKeyDownCallback.js +0 -28
- package/dist/uiComponents/useLockSet.js +0 -17
- package/dist/uiComponents/useLogger.js +0 -16
- package/dist/uiComponents/useOnClickOutside.js +0 -25
- package/dist/uiComponents/useOnKeyDown.js +0 -12
- package/dist/uiComponents/usePresence.js +0 -156
- package/dist/uiComponents/useValToAtom.js +0 -11
- package/dist/utils/absoluteDims.js +0 -7
- package/dist/utils/contextualWebComponents.js +0 -44
- package/dist/utils/copyToClipboard.js +0 -28
- package/dist/utils/derive-utils.js +0 -61
- package/dist/utils/devStringify.js +0 -20
- package/dist/utils/invariant.js +0 -79
- package/dist/utils/isMac.js +0 -2
- package/dist/utils/keyboardUtils.js +0 -23
- package/dist/utils/mousePositionD.js +0 -18
- package/dist/utils/redux/actionCreator.js +0 -15
- package/dist/utils/redux/actionCreator.test.js +0 -35
- package/dist/utils/redux/actionReducersBundle.js +0 -18
- package/dist/utils/redux/atomFromReduxStore.js +0 -11
- package/dist/utils/redux/configureStore.js +0 -18
- package/dist/utils/redux/pointerFriendlySelector.js +0 -8
- package/dist/utils/redux/withHistory/withBatchActions.js +0 -13
- package/dist/utils/redux/withHistory/withHistory.js +0 -157
- package/dist/utils/renderInPortalInContext.js +0 -38
- package/dist/utils/selectClosestHTMLAncestor.js +0 -13
- package/dist/utils/tightJsonStringify.js +0 -27
- package/dist/utils/tightJsonStringify.test.js +0 -25
- package/dist/utils/useRefAndState.js +0 -32
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import { usePrism, useVal } from '@tomorrowevening/theatre-react';
|
|
2
|
-
import { prism, val, pointerToPrism } from '@tomorrowevening/theatre-dataverse';
|
|
3
|
-
import React, { useMemo, Fragment } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
|
|
6
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
7
|
-
import AggregateKeyframeEditor from './AggregateKeyframeEditor/AggregateKeyframeEditor';
|
|
8
|
-
import { collectAggregateSnapPositionsObjectOrCompound } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes';
|
|
9
|
-
import { useLogger } from '@tomorrowevening/theatre-studio/uiComponents/useLogger';
|
|
10
|
-
import { getAggregateKeyframeEditorUtilsPrismFn } from './AggregateKeyframeEditor/useAggregateKeyframeEditorUtils';
|
|
11
|
-
import DopeSnap from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/RightOverlay/DopeSnap';
|
|
12
|
-
import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
|
|
13
|
-
import { useLockFrameStampPositionRef } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/FrameStampPositionProvider';
|
|
14
|
-
import { useCssCursorLock } from '@tomorrowevening/theatre-studio/uiComponents/PointerEventsHandler';
|
|
15
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
16
|
-
import { decodePathToProp, doesPathStartWith, encodePathToProp, } from '@tomorrowevening/theatre-shared/utils/addresses';
|
|
17
|
-
import KeyframeSnapTarget, { snapPositionsStateD, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget';
|
|
18
|
-
import { emptyObject } from '@tomorrowevening/theatre-shared/utils';
|
|
19
|
-
import { collectKeyframeSnapPositions, snapToNone, snapToSome, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget';
|
|
20
|
-
import { collectAggregateSnapPositionsSheet } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes';
|
|
21
|
-
const AggregatedKeyframeTrackContainer = styled.div `
|
|
22
|
-
position: relative;
|
|
23
|
-
height: 100%;
|
|
24
|
-
width: 100%;
|
|
25
|
-
`;
|
|
26
|
-
const EMPTY_SELECTION = Object.freeze({
|
|
27
|
-
selectedPositions: new Map(),
|
|
28
|
-
selection: undefined,
|
|
29
|
-
});
|
|
30
|
-
function AggregatedKeyframeTrack_memo(props) {
|
|
31
|
-
const { layoutP, aggregatedKeyframes, viewModel } = props;
|
|
32
|
-
const logger = useLogger('AggregatedKeyframeTrack');
|
|
33
|
-
const [containerRef, containerNode] = useRefAndState(null);
|
|
34
|
-
const { selectedPositions, selection } = useCollectedSelectedPositions(layoutP, aggregatedKeyframes);
|
|
35
|
-
const [contextMenu, _, isOpen] = useAggregatedKeyframeTrackContextMenu(containerNode, props, () => logger._debug('see aggregatedKeyframes', props.aggregatedKeyframes));
|
|
36
|
-
const posKfs = useMemo(() => [...aggregatedKeyframes.byPosition.entries()]
|
|
37
|
-
.sort((a, b) => a[0] - b[0])
|
|
38
|
-
.map(([position, keyframes]) => ({
|
|
39
|
-
position,
|
|
40
|
-
keyframes,
|
|
41
|
-
selected: selectedPositions.get(position),
|
|
42
|
-
allHere: keyframes.length === aggregatedKeyframes.tracks.length,
|
|
43
|
-
})), [aggregatedKeyframes, selectedPositions]);
|
|
44
|
-
const snapPositionsState = useVal(snapPositionsStateD);
|
|
45
|
-
const snapToAllKeyframes = snapPositionsState.mode === 'snapToAll';
|
|
46
|
-
const snapPositions = snapPositionsState.mode === 'snapToSome'
|
|
47
|
-
? snapPositionsState.positions
|
|
48
|
-
: emptyObject;
|
|
49
|
-
const aggregateSnapPositions = useMemo(() => viewModel.type === 'sheet'
|
|
50
|
-
? collectAggregateSnapPositionsSheet(viewModel, snapPositions)
|
|
51
|
-
: collectAggregateSnapPositionsObjectOrCompound(viewModel, snapPositions), [snapPositions]);
|
|
52
|
-
const snapTargets = aggregateSnapPositions.map((position) => (React.createElement(KeyframeSnapTarget, { key: 'snap-target-' + position, layoutP: layoutP, leaf: viewModel, position: position })));
|
|
53
|
-
const keyframeEditorProps = useMemo(() => posKfs.map(({ position, keyframes }, index) => ({
|
|
54
|
-
position,
|
|
55
|
-
editorProps: {
|
|
56
|
-
index,
|
|
57
|
-
layoutP,
|
|
58
|
-
viewModel,
|
|
59
|
-
aggregateKeyframes: posKfs,
|
|
60
|
-
selection: selectedPositions.has(position) ? selection : undefined,
|
|
61
|
-
},
|
|
62
|
-
})), [posKfs, viewModel, selectedPositions]);
|
|
63
|
-
const [isDragging] = useDragForAggregateKeyframeDot(containerNode, (position) => {
|
|
64
|
-
return keyframeEditorProps.find((editorProp) => editorProp.position === position)?.editorProps;
|
|
65
|
-
}, {
|
|
66
|
-
onClickFromDrag(dragStartEvent) {
|
|
67
|
-
// TODO Aggregate inline keyframe editor
|
|
68
|
-
// openEditor(dragStartEvent, ref.current!)
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
const keyframeEditors = keyframeEditorProps.map((props, i) => (React.createElement(Fragment, { key: 'agg-' + posKfs[i].keyframes[0].kf.id },
|
|
72
|
-
snapToAllKeyframes && (React.createElement(KeyframeSnapTarget, { layoutP: layoutP, leaf: viewModel, position: props.position })),
|
|
73
|
-
React.createElement(AggregateKeyframeEditor, { ...props.editorProps }))));
|
|
74
|
-
return (React.createElement(AggregatedKeyframeTrackContainer, { ref: containerRef, style: {
|
|
75
|
-
background: isOpen ? '#444850 ' : 'unset',
|
|
76
|
-
} },
|
|
77
|
-
keyframeEditors,
|
|
78
|
-
snapTargets,
|
|
79
|
-
contextMenu));
|
|
80
|
-
}
|
|
81
|
-
const AggregatedKeyframeTrack = React.memo(AggregatedKeyframeTrack_memo);
|
|
82
|
-
export default AggregatedKeyframeTrack;
|
|
83
|
-
export var AggregateKeyframePositionIsSelected;
|
|
84
|
-
(function (AggregateKeyframePositionIsSelected) {
|
|
85
|
-
AggregateKeyframePositionIsSelected[AggregateKeyframePositionIsSelected["AllSelected"] = 0] = "AllSelected";
|
|
86
|
-
AggregateKeyframePositionIsSelected[AggregateKeyframePositionIsSelected["AtLeastOneUnselected"] = 1] = "AtLeastOneUnselected";
|
|
87
|
-
AggregateKeyframePositionIsSelected[AggregateKeyframePositionIsSelected["NoneSelected"] = 2] = "NoneSelected";
|
|
88
|
-
})(AggregateKeyframePositionIsSelected || (AggregateKeyframePositionIsSelected = {}));
|
|
89
|
-
const { AllSelected, AtLeastOneUnselected, NoneSelected } = AggregateKeyframePositionIsSelected;
|
|
90
|
-
/** Helper to put together the selected positions */
|
|
91
|
-
function useCollectedSelectedPositions(layoutP, aggregatedKeyframes) {
|
|
92
|
-
return usePrism(() => val(collectedSelectedPositions(layoutP, aggregatedKeyframes)), [layoutP, aggregatedKeyframes]);
|
|
93
|
-
}
|
|
94
|
-
function collectedSelectedPositions(layoutP, aggregatedKeyframes) {
|
|
95
|
-
return prism(() => {
|
|
96
|
-
const selectionAtom = val(layoutP.selectionAtom);
|
|
97
|
-
const selection = val(selectionAtom.pointer.current);
|
|
98
|
-
if (!selection)
|
|
99
|
-
return EMPTY_SELECTION;
|
|
100
|
-
const selectedAtPositions = new Map();
|
|
101
|
-
for (const [position, kfsWithTrack] of aggregatedKeyframes.byPosition) {
|
|
102
|
-
const positionIsSelected = allOrSomeOrNoneSelected(kfsWithTrack, selection);
|
|
103
|
-
if (positionIsSelected !== undefined &&
|
|
104
|
-
positionIsSelected !== NoneSelected) {
|
|
105
|
-
selectedAtPositions.set(position, positionIsSelected);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
selectedPositions: selectedAtPositions,
|
|
110
|
-
selection: val(selectionAtom.pointer.current),
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function allOrSomeOrNoneSelected(keyframeWithTracks, selection) {
|
|
115
|
-
let positionIsSelected = undefined;
|
|
116
|
-
for (const { track, kf } of keyframeWithTracks) {
|
|
117
|
-
const kfIsSelected = selection.byObjectKey[track.sheetObject.address.objectKey]?.byTrackId[track.id]?.byKeyframeId?.[kf.id] === true;
|
|
118
|
-
if (positionIsSelected === undefined) {
|
|
119
|
-
if (kfIsSelected) {
|
|
120
|
-
positionIsSelected = AllSelected;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
positionIsSelected = NoneSelected;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else if (kfIsSelected) {
|
|
127
|
-
if (positionIsSelected === NoneSelected) {
|
|
128
|
-
positionIsSelected = AtLeastOneUnselected;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
if (positionIsSelected === AllSelected) {
|
|
133
|
-
positionIsSelected = AtLeastOneUnselected;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return positionIsSelected;
|
|
138
|
-
}
|
|
139
|
-
function useAggregatedKeyframeTrackContextMenu(node, props, debugOnOpen) {
|
|
140
|
-
return useContextMenu(node, {
|
|
141
|
-
onOpen: debugOnOpen,
|
|
142
|
-
displayName: 'Aggregate Keyframe Track',
|
|
143
|
-
menuItems: () => {
|
|
144
|
-
const selectionKeyframes = pointerToPrism(getStudio().atomP.ahistoric.clipboard.keyframesWithRelativePaths).getValue() ?? [];
|
|
145
|
-
return [pasteKeyframesContextMenuItem(props, selectionKeyframes)];
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function pasteKeyframesContextMenuItem(props, keyframes) {
|
|
150
|
-
return {
|
|
151
|
-
label: 'Paste Keyframes',
|
|
152
|
-
enabled: keyframes.length > 0,
|
|
153
|
-
callback: () => {
|
|
154
|
-
const sheet = val(props.layoutP.sheet);
|
|
155
|
-
const sequence = sheet.getSequence();
|
|
156
|
-
if (props.viewModel.type === 'sheet') {
|
|
157
|
-
pasteKeyframesSheet(props.viewModel, keyframes, sequence);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
pasteKeyframesObjectOrCompound(props.viewModel, keyframes, sequence);
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Given a list of keyframes that contain paths relative to a common root,
|
|
167
|
-
* (see `copyableKeyframesFromSelection`) this function pastes those keyframes
|
|
168
|
-
* into tracks on either the object (if viewModel.type === 'sheetObject') or
|
|
169
|
-
* the compound prop (if viewModel.type === 'propWithChildren').
|
|
170
|
-
*
|
|
171
|
-
* Our copy & paste behavior is currently roughly described in AGGREGATE_COPY_PASTE.md
|
|
172
|
-
*
|
|
173
|
-
* @see StudioAhistoricState.clipboard
|
|
174
|
-
* @see setClipboardNestedKeyframes
|
|
175
|
-
*/
|
|
176
|
-
function pasteKeyframesSheet(viewModel, keyframes, sequence) {
|
|
177
|
-
const { projectId, sheetId, sheetInstanceId } = viewModel.sheet.address;
|
|
178
|
-
const areKeyframesAllOnSingleTrack = keyframes.every(({ pathToProp }) => pathToProp.length === 0);
|
|
179
|
-
if (areKeyframesAllOnSingleTrack) {
|
|
180
|
-
for (const object of viewModel.children.map((child) => child.sheetObject)) {
|
|
181
|
-
const tracksByObject = pointerToPrism(getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetId]
|
|
182
|
-
.sequence.tracksByObject[object.address.objectKey]).getValue();
|
|
183
|
-
const trackIdsOnObject = Object.keys(tracksByObject?.trackData ?? {});
|
|
184
|
-
pasteKeyframesToMultipleTracks(object.address, trackIdsOnObject, keyframes, sequence);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
const tracksByObject = pointerToPrism(getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetId]
|
|
189
|
-
.sequence.tracksByObject).getValue();
|
|
190
|
-
const placeableKeyframes = keyframes
|
|
191
|
-
.map(({ keyframe, pathToProp }) => {
|
|
192
|
-
const objectKey = pathToProp[0];
|
|
193
|
-
const relativePathToProp = pathToProp.slice(1);
|
|
194
|
-
const pathToPropEncoded = encodePathToProp([...relativePathToProp]);
|
|
195
|
-
const trackIdByPropPath = tracksByObject?.[objectKey]?.trackIdByPropPath ?? {};
|
|
196
|
-
const maybeTrackId = trackIdByPropPath[pathToPropEncoded];
|
|
197
|
-
return maybeTrackId
|
|
198
|
-
? {
|
|
199
|
-
keyframe,
|
|
200
|
-
trackId: maybeTrackId,
|
|
201
|
-
address: {
|
|
202
|
-
objectKey,
|
|
203
|
-
projectId,
|
|
204
|
-
sheetId,
|
|
205
|
-
sheetInstanceId,
|
|
206
|
-
},
|
|
207
|
-
}
|
|
208
|
-
: null;
|
|
209
|
-
})
|
|
210
|
-
.filter((result) => result !== null);
|
|
211
|
-
pasteKeyframesToSpecificTracks(placeableKeyframes, sequence);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function pasteKeyframesObjectOrCompound(viewModel, keyframes, sequence) {
|
|
215
|
-
const { projectId, sheetId, objectKey } = viewModel.sheetObject.address;
|
|
216
|
-
const trackRecords = pointerToPrism(getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetId]
|
|
217
|
-
.sequence.tracksByObject[objectKey]).getValue();
|
|
218
|
-
const areKeyframesAllOnSingleTrack = keyframes.every(({ pathToProp }) => pathToProp.length === 0);
|
|
219
|
-
if (areKeyframesAllOnSingleTrack) {
|
|
220
|
-
const trackIdsOnObject = Object.keys(trackRecords?.trackData ?? {});
|
|
221
|
-
if (viewModel.type === 'sheetObject') {
|
|
222
|
-
pasteKeyframesToMultipleTracks(viewModel.sheetObject.address, trackIdsOnObject, keyframes, sequence);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
const trackIdByPropPath = trackRecords?.trackIdByPropPath || {};
|
|
226
|
-
const trackIdsOnCompoundProp = Object.entries(trackIdByPropPath)
|
|
227
|
-
.filter(([encodedPath, trackId]) => trackId !== undefined &&
|
|
228
|
-
doesPathStartWith(
|
|
229
|
-
// e.g. a track with path `['position', 'x']` is under the compound track with path `['position']`
|
|
230
|
-
decodePathToProp(encodedPath), viewModel.pathToProp))
|
|
231
|
-
.map(([encodedPath, trackId]) => trackId);
|
|
232
|
-
pasteKeyframesToMultipleTracks(viewModel.sheetObject.address, trackIdsOnCompoundProp, keyframes, sequence);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
const trackIdByPropPath = trackRecords?.trackIdByPropPath || {};
|
|
237
|
-
const rootPath = viewModel.type === 'propWithChildren' ? viewModel.pathToProp : [];
|
|
238
|
-
const placeableKeyframes = keyframes
|
|
239
|
-
.map(({ keyframe, pathToProp: relativePathToProp }) => {
|
|
240
|
-
const pathToPropEncoded = encodePathToProp([
|
|
241
|
-
...rootPath,
|
|
242
|
-
...relativePathToProp,
|
|
243
|
-
]);
|
|
244
|
-
const maybeTrackId = trackIdByPropPath[pathToPropEncoded];
|
|
245
|
-
return maybeTrackId
|
|
246
|
-
? {
|
|
247
|
-
keyframe,
|
|
248
|
-
trackId: maybeTrackId,
|
|
249
|
-
address: viewModel.sheetObject.address,
|
|
250
|
-
}
|
|
251
|
-
: null;
|
|
252
|
-
})
|
|
253
|
-
.filter((result) => result !== null);
|
|
254
|
-
pasteKeyframesToSpecificTracks(placeableKeyframes, sequence);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
function pasteKeyframesToMultipleTracks(address, trackIds, keyframes, sequence) {
|
|
258
|
-
sequence.position = sequence.closestGridPosition(sequence.position);
|
|
259
|
-
const keyframeOffset = earliestKeyframe(keyframes.map(({ keyframe }) => keyframe))?.position;
|
|
260
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
261
|
-
for (const trackId of trackIds) {
|
|
262
|
-
for (const { keyframe } of keyframes) {
|
|
263
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setKeyframeAtPosition({
|
|
264
|
-
...address,
|
|
265
|
-
trackId,
|
|
266
|
-
position: sequence.position + keyframe.position - keyframeOffset,
|
|
267
|
-
handles: keyframe.handles,
|
|
268
|
-
value: keyframe.value,
|
|
269
|
-
snappingFunction: sequence.closestGridPosition,
|
|
270
|
-
type: keyframe.type,
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
function pasteKeyframesToSpecificTracks(keyframesWithTracksToPlaceThemIn, sequence) {
|
|
277
|
-
sequence.position = sequence.closestGridPosition(sequence.position);
|
|
278
|
-
const keyframeOffset = earliestKeyframe(keyframesWithTracksToPlaceThemIn.map(({ keyframe }) => keyframe))?.position;
|
|
279
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
280
|
-
for (const { keyframe, trackId, address, } of keyframesWithTracksToPlaceThemIn) {
|
|
281
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setKeyframeAtPosition({
|
|
282
|
-
...address,
|
|
283
|
-
trackId,
|
|
284
|
-
position: sequence.position + keyframe.position - keyframeOffset,
|
|
285
|
-
handles: keyframe.handles,
|
|
286
|
-
value: keyframe.value,
|
|
287
|
-
snappingFunction: sequence.closestGridPosition,
|
|
288
|
-
type: keyframe.type,
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
function earliestKeyframe(keyframes) {
|
|
294
|
-
let curEarliest = null;
|
|
295
|
-
for (const keyframe of keyframes) {
|
|
296
|
-
if (curEarliest === null || keyframe.position < curEarliest.position) {
|
|
297
|
-
curEarliest = keyframe;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return curEarliest;
|
|
301
|
-
}
|
|
302
|
-
function useDragForAggregateKeyframeDot(containerNode, getPropsForPosition, options) {
|
|
303
|
-
const logger = useLogger('useDragForAggregateKeyframeDot');
|
|
304
|
-
const frameStampLock = useLockFrameStampPositionRef();
|
|
305
|
-
const useDragOpts = useMemo(() => {
|
|
306
|
-
return {
|
|
307
|
-
debugName: 'AggregateKeyframeDot/useDragKeyframe',
|
|
308
|
-
onDragStart(event) {
|
|
309
|
-
logger._debug('onDragStart', { target: event.target });
|
|
310
|
-
const positionToFind = Number(event.target.dataset.pos);
|
|
311
|
-
const props = getPropsForPosition(positionToFind);
|
|
312
|
-
if (!props) {
|
|
313
|
-
logger._debug('no props found for ', { positionToFind });
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
frameStampLock(true, positionToFind);
|
|
317
|
-
const keyframes = prism(getAggregateKeyframeEditorUtilsPrismFn(props)).getValue().cur.keyframes;
|
|
318
|
-
const address = props.viewModel.type === 'sheet'
|
|
319
|
-
? props.viewModel.sheet.address
|
|
320
|
-
: props.viewModel.sheetObject.address;
|
|
321
|
-
const tracksByObject = val(getStudio().atomP.historic.coreByProject[address.projectId]
|
|
322
|
-
.sheetsById[address.sheetId].sequence.tracksByObject);
|
|
323
|
-
// Calculate all the valid snap positions in the sequence editor,
|
|
324
|
-
// excluding the child keyframes of this aggregate, and any selection it is part of.
|
|
325
|
-
const snapPositions = collectKeyframeSnapPositions(tracksByObject, function shouldIncludeKeyfram(keyframe, { trackId, objectKey }) {
|
|
326
|
-
return (
|
|
327
|
-
// we exclude all the child keyframes of this aggregate keyframe from being a snap target
|
|
328
|
-
keyframes.every((kfWithTrack) => keyframe.id !== kfWithTrack.kf.id) &&
|
|
329
|
-
!(
|
|
330
|
-
// if all of the children of the current aggregate keyframe are in a selection,
|
|
331
|
-
(props.selection &&
|
|
332
|
-
// then we exclude them and all other keyframes in the selection from being snap targets
|
|
333
|
-
props.selection.byObjectKey[objectKey]?.byTrackId[trackId]
|
|
334
|
-
?.byKeyframeId[keyframe.id])));
|
|
335
|
-
});
|
|
336
|
-
snapToSome(snapPositions);
|
|
337
|
-
if (props.selection &&
|
|
338
|
-
props.aggregateKeyframes[props.index].selected ===
|
|
339
|
-
AggregateKeyframePositionIsSelected.AllSelected) {
|
|
340
|
-
const { selection, viewModel } = props;
|
|
341
|
-
const handlers = selection
|
|
342
|
-
.getDragHandlers({
|
|
343
|
-
...address,
|
|
344
|
-
domNode: containerNode,
|
|
345
|
-
positionAtStartOfDrag: keyframes[0].kf.position,
|
|
346
|
-
})
|
|
347
|
-
.onDragStart(event);
|
|
348
|
-
return (handlers && {
|
|
349
|
-
...handlers,
|
|
350
|
-
onClick: options.onClickFromDrag,
|
|
351
|
-
onDragEnd: (...args) => {
|
|
352
|
-
handlers.onDragEnd?.(...args);
|
|
353
|
-
snapToNone();
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
const propsAtStartOfDrag = props;
|
|
358
|
-
const toUnitSpace = val(propsAtStartOfDrag.layoutP.scaledSpace.toUnitSpace);
|
|
359
|
-
let tempTransaction;
|
|
360
|
-
return {
|
|
361
|
-
onDrag(dx, dy, event) {
|
|
362
|
-
const newPosition = Math.max(
|
|
363
|
-
// check if our event hovers over a [data-pos] element
|
|
364
|
-
DopeSnap.checkIfMouseEventSnapToPos(event, {
|
|
365
|
-
// ignore: node,
|
|
366
|
-
}) ??
|
|
367
|
-
// if we don't find snapping target, check the distance dragged + original position
|
|
368
|
-
keyframes[0].kf.position + toUnitSpace(dx),
|
|
369
|
-
// sanitize to minimum of zero
|
|
370
|
-
0);
|
|
371
|
-
frameStampLock(true, newPosition);
|
|
372
|
-
tempTransaction?.discard();
|
|
373
|
-
tempTransaction = undefined;
|
|
374
|
-
tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
|
|
375
|
-
for (const keyframe of keyframes) {
|
|
376
|
-
const original = keyframe.kf;
|
|
377
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
|
|
378
|
-
...keyframe.track.sheetObject.address,
|
|
379
|
-
trackId: keyframe.track.id,
|
|
380
|
-
keyframes: [{ ...original, position: newPosition }],
|
|
381
|
-
snappingFunction: val(propsAtStartOfDrag.layoutP.sheet).getSequence().closestGridPosition,
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
},
|
|
386
|
-
onDragEnd(dragHappened) {
|
|
387
|
-
frameStampLock(false, -1);
|
|
388
|
-
if (dragHappened) {
|
|
389
|
-
tempTransaction?.commit();
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
tempTransaction?.discard();
|
|
393
|
-
options.onClickFromDrag(event);
|
|
394
|
-
}
|
|
395
|
-
snapToNone();
|
|
396
|
-
},
|
|
397
|
-
onClick(ev) {
|
|
398
|
-
options.onClickFromDrag(ev);
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
}, [getPropsForPosition, options.onClickFromDrag]);
|
|
404
|
-
const [isDragging] = useDrag(containerNode, useDragOpts);
|
|
405
|
-
useCssCursorLock(isDragging, 'draggingPositionInSequenceEditor', 'ew-resize');
|
|
406
|
-
return [isDragging];
|
|
407
|
-
}
|
package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/BasicKeyframedTrack.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { usePrism, useVal } from '@tomorrowevening/theatre-react';
|
|
2
|
-
import { val } from '@tomorrowevening/theatre-dataverse';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import SingleKeyframeEditor from './KeyframeEditor/SingleKeyframeEditor';
|
|
6
|
-
import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
|
|
7
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
8
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
9
|
-
import { arePathsEqual } from '@tomorrowevening/theatre-shared/utils/addresses';
|
|
10
|
-
import KeyframeSnapTarget, { snapPositionsStateD, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget';
|
|
11
|
-
import { createStudioSheetItemKey } from '@tomorrowevening/theatre-shared/utils/ids';
|
|
12
|
-
const Container = styled.div `
|
|
13
|
-
position: relative;
|
|
14
|
-
height: 100%;
|
|
15
|
-
width: 100%;
|
|
16
|
-
`;
|
|
17
|
-
const BasicKeyframedTrack = React.memo((props) => {
|
|
18
|
-
const { layoutP, trackData, leaf } = props;
|
|
19
|
-
const [containerRef, containerNode] = useRefAndState(null);
|
|
20
|
-
const { selectedKeyframeIds, selection } = usePrism(() => {
|
|
21
|
-
const selectionAtom = val(layoutP.selectionAtom);
|
|
22
|
-
const selectedKeyframeIds = val(selectionAtom.pointer.current.byObjectKey[leaf.sheetObject.address.objectKey].byTrackId[leaf.trackId].byKeyframeId);
|
|
23
|
-
if (selectedKeyframeIds) {
|
|
24
|
-
return {
|
|
25
|
-
selectedKeyframeIds,
|
|
26
|
-
selection: val(selectionAtom.pointer.current),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return {
|
|
31
|
-
selectedKeyframeIds: {},
|
|
32
|
-
selection: undefined,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}, [layoutP, leaf.trackId]);
|
|
36
|
-
const [contextMenu, _, isOpen] = useBasicKeyframedTrackContextMenu(containerNode, props);
|
|
37
|
-
const snapPositionsState = useVal(snapPositionsStateD);
|
|
38
|
-
const snapPositions = snapPositionsState.mode === 'snapToSome'
|
|
39
|
-
? snapPositionsState.positions[leaf.sheetObject.address.objectKey]?.[leaf.trackId]
|
|
40
|
-
: [] ?? [];
|
|
41
|
-
const snapToAllKeyframes = snapPositionsState.mode === 'snapToAll';
|
|
42
|
-
const track = useMemo(() => ({
|
|
43
|
-
data: trackData,
|
|
44
|
-
id: leaf.trackId,
|
|
45
|
-
sheetObject: props.leaf.sheetObject,
|
|
46
|
-
}), [trackData, leaf.trackId]);
|
|
47
|
-
const keyframeEditors = trackData.keyframes.map((kf, index) => (React.createElement(SingleKeyframeEditor, { key: 'keyframe-' + kf.id, itemKey: createStudioSheetItemKey.forTrackKeyframe(leaf.sheetObject, leaf.trackId, kf.id), keyframe: kf, index: index, track: track, layoutP: layoutP, leaf: leaf, selection: selectedKeyframeIds[kf.id] === true ? selection : undefined })));
|
|
48
|
-
const snapTargets = snapPositions.map((position) => (React.createElement(KeyframeSnapTarget, { key: 'snap-target-' + position, layoutP: layoutP, leaf: leaf, position: position })));
|
|
49
|
-
const additionalSnapTargets = !snapToAllKeyframes
|
|
50
|
-
? null
|
|
51
|
-
: trackData.keyframes.map((kf) => (React.createElement(KeyframeSnapTarget, { key: `additionalSnapTarget-${kf.id}`, layoutP: layoutP, leaf: leaf, position: kf.position })));
|
|
52
|
-
return (React.createElement(Container, { ref: containerRef, style: {
|
|
53
|
-
background: isOpen ? '#444850 ' : 'unset',
|
|
54
|
-
} },
|
|
55
|
-
keyframeEditors,
|
|
56
|
-
snapTargets,
|
|
57
|
-
React.createElement(React.Fragment, null, additionalSnapTargets),
|
|
58
|
-
contextMenu));
|
|
59
|
-
});
|
|
60
|
-
BasicKeyframedTrack.displayName = `BasicKeyframedTrack`;
|
|
61
|
-
export default BasicKeyframedTrack;
|
|
62
|
-
function useBasicKeyframedTrackContextMenu(node, props) {
|
|
63
|
-
return useContextMenu(node, {
|
|
64
|
-
displayName: 'Keyframe Track',
|
|
65
|
-
menuItems: () => {
|
|
66
|
-
const selectionKeyframes = val(getStudio().atomP.ahistoric.clipboard.keyframesWithRelativePaths) ?? [];
|
|
67
|
-
return [pasteKeyframesContextMenuItem(props, selectionKeyframes)];
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function pasteKeyframesContextMenuItem(props, keyframes) {
|
|
72
|
-
return {
|
|
73
|
-
label: 'Paste Keyframes',
|
|
74
|
-
enabled: keyframes.length > 0,
|
|
75
|
-
callback: () => {
|
|
76
|
-
const sheet = val(props.layoutP.sheet);
|
|
77
|
-
const sequence = sheet.getSequence();
|
|
78
|
-
const firstPath = keyframes[0]?.pathToProp;
|
|
79
|
-
const singleTrackKeyframes = keyframes
|
|
80
|
-
.filter(({ keyframe, pathToProp }) => arePathsEqual(firstPath, pathToProp))
|
|
81
|
-
.map(({ keyframe, pathToProp }) => keyframe);
|
|
82
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
83
|
-
sequence.position = sequence.closestGridPosition(sequence.position);
|
|
84
|
-
const keyframeOffset = earliestKeyframe(singleTrackKeyframes)?.position;
|
|
85
|
-
for (const keyframe of singleTrackKeyframes) {
|
|
86
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setKeyframeAtPosition({
|
|
87
|
-
...props.leaf.sheetObject.address,
|
|
88
|
-
trackId: props.leaf.trackId,
|
|
89
|
-
position: sequence.position + keyframe.position - keyframeOffset,
|
|
90
|
-
handles: keyframe.handles,
|
|
91
|
-
value: keyframe.value,
|
|
92
|
-
snappingFunction: sequence.closestGridPosition,
|
|
93
|
-
type: keyframe.type,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function earliestKeyframe(keyframes) {
|
|
101
|
-
let curEarliest = null;
|
|
102
|
-
for (const keyframe of keyframes) {
|
|
103
|
-
if (curEarliest === null || keyframe.position < curEarliest.position) {
|
|
104
|
-
curEarliest = keyframe;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return curEarliest;
|
|
108
|
-
}
|