@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,49 +0,0 @@
|
|
|
1
|
-
import { memoize } from 'lodash-es';
|
|
2
|
-
const getFactorsOfNumber = memoize((divisionsPerUnit) => {
|
|
3
|
-
const factors = [];
|
|
4
|
-
for (let i = 1; i <= divisionsPerUnit; i++) {
|
|
5
|
-
if (divisionsPerUnit % i === 0) {
|
|
6
|
-
factors.push(i);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return factors;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Calls cb() for every grid line that must be drawn.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* For the sake of simplicity, I've named the variables as if the sequence's
|
|
16
|
-
* length is counted in seconds, and the sub-unit is called fps
|
|
17
|
-
* (frames per second). But the algorithm should work for any fps rate, and also
|
|
18
|
-
* non-time-based sequences.
|
|
19
|
-
*/
|
|
20
|
-
export default function createGrid({ clippedSpaceRange, clippedSpaceWidth, fps, gapWidth = 120, }, cb) {
|
|
21
|
-
// If fps is 60, then frameLengthInSeconeds would be 1/60 => 0.033
|
|
22
|
-
const frameLengthInSeconeds = 1 / fps;
|
|
23
|
-
// how much of the timeline is visible.
|
|
24
|
-
const clippedSpaceLengthInSeconds = clippedSpaceRange.end - clippedSpaceRange.start; // eg: if start: 1 AND end: 3 THEN length = 2
|
|
25
|
-
// how many pixels of space does one frame take
|
|
26
|
-
const frameWidthInScreenSpace = clippedSpaceWidth / (fps * clippedSpaceLengthInSeconds);
|
|
27
|
-
// Number of frames that fit in the smallest cell possible.
|
|
28
|
-
// a cell is basically the space between two grid lines
|
|
29
|
-
const numberOfFramesFittingInMinimumCellWidth = Math.floor(gapWidth / frameWidthInScreenSpace);
|
|
30
|
-
// Number of frames in each cell, so that lines would be drawn at full seconds
|
|
31
|
-
const numberOfFramesPerCell =
|
|
32
|
-
// if we can't fit a full 60 frames in a cell (or a multiple of 60 frames),
|
|
33
|
-
numberOfFramesFittingInMinimumCellWidth < fps
|
|
34
|
-
? getFactorsOfNumber(fps).find(
|
|
35
|
-
// then try fitting 30 frames, or 20, or 15, and other factors of 60
|
|
36
|
-
(factor) => factor >= numberOfFramesFittingInMinimumCellWidth)
|
|
37
|
-
: // otherwise, determine how many full seconds we can fit in a cell
|
|
38
|
-
fps * Math.floor(numberOfFramesFittingInMinimumCellWidth / fps);
|
|
39
|
-
const cellLengthInSeconds = numberOfFramesPerCell * frameLengthInSeconeds;
|
|
40
|
-
// the number of the first cell we'll draw
|
|
41
|
-
const startCell = Math.floor(clippedSpaceRange.start / cellLengthInSeconds);
|
|
42
|
-
// and the last one
|
|
43
|
-
const endCell = Math.ceil(clippedSpaceRange.end / cellLengthInSeconds);
|
|
44
|
-
for (let cell = startCell; cell <= endCell; cell++) {
|
|
45
|
-
const posInUnitSpace = cell * cellLengthInSeconds;
|
|
46
|
-
const isFullSecond = posInUnitSpace % 1 === 0;
|
|
47
|
-
cb(posInUnitSpace, isFullSecond);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { Atom, prism, val } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
import mousePositionD from '@tomorrowevening/theatre-studio/utils/mousePositionD';
|
|
3
|
-
import { inRange, last } from 'lodash-es';
|
|
4
|
-
import React, { createContext, useCallback, useContext, useLayoutEffect, useMemo, useRef, } from 'react';
|
|
5
|
-
export var FrameStampPositionType;
|
|
6
|
-
(function (FrameStampPositionType) {
|
|
7
|
-
FrameStampPositionType[FrameStampPositionType["hidden"] = 0] = "hidden";
|
|
8
|
-
FrameStampPositionType[FrameStampPositionType["locked"] = 1] = "locked";
|
|
9
|
-
FrameStampPositionType[FrameStampPositionType["snapped"] = 2] = "snapped";
|
|
10
|
-
FrameStampPositionType[FrameStampPositionType["free"] = 3] = "free";
|
|
11
|
-
})(FrameStampPositionType || (FrameStampPositionType = {}));
|
|
12
|
-
const context = createContext(null);
|
|
13
|
-
let lastLockId = 0;
|
|
14
|
-
/**
|
|
15
|
-
* Provides snapping positions to "stamps".
|
|
16
|
-
*
|
|
17
|
-
* One example of a stamp includes the "Keyframe Dot" which show a `⌜⌞⌝⌟` kinda UI
|
|
18
|
-
* around the dot when dragged over.
|
|
19
|
-
*/
|
|
20
|
-
const FrameStampPositionProvider = ({ children, layoutP }) => {
|
|
21
|
-
const locksAtom = useMemo(() => new Atom([]), []);
|
|
22
|
-
const currentD = useMemo(() => prism(() => {
|
|
23
|
-
const pointerPos = prism
|
|
24
|
-
.memo('p', () => pointerPositionInUnitSpace(layoutP), [layoutP])
|
|
25
|
-
.getValue();
|
|
26
|
-
const locks = val(locksAtom.pointer);
|
|
27
|
-
if (locks.length > 0) {
|
|
28
|
-
return last(locks).position;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return pointerPos;
|
|
32
|
-
}
|
|
33
|
-
}), [layoutP]);
|
|
34
|
-
const getLock = useCallback(() => {
|
|
35
|
-
const id = lastLockId++;
|
|
36
|
-
locksAtom.reduce((list) => [
|
|
37
|
-
...list,
|
|
38
|
-
{
|
|
39
|
-
id,
|
|
40
|
-
position: [-1, FrameStampPositionType.hidden],
|
|
41
|
-
},
|
|
42
|
-
]);
|
|
43
|
-
const unlock = () => {
|
|
44
|
-
locksAtom.reduce((list) => list.filter((lock) => lock.id !== id));
|
|
45
|
-
};
|
|
46
|
-
const set = (posInUnitSpace) => {
|
|
47
|
-
locksAtom.reduce((list) => {
|
|
48
|
-
const index = list.findIndex((lock) => lock.id === id);
|
|
49
|
-
if (index === -1) {
|
|
50
|
-
console.warn(`Lock is already freed. This is a bug.`);
|
|
51
|
-
return list;
|
|
52
|
-
}
|
|
53
|
-
const newList = [...list];
|
|
54
|
-
newList.splice(index, 1, {
|
|
55
|
-
id,
|
|
56
|
-
position: [
|
|
57
|
-
posInUnitSpace,
|
|
58
|
-
posInUnitSpace === -1
|
|
59
|
-
? FrameStampPositionType.hidden
|
|
60
|
-
: FrameStampPositionType.locked,
|
|
61
|
-
],
|
|
62
|
-
});
|
|
63
|
-
return newList;
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
set,
|
|
68
|
-
unlock,
|
|
69
|
-
};
|
|
70
|
-
}, []);
|
|
71
|
-
const value = {
|
|
72
|
-
currentD,
|
|
73
|
-
getLock,
|
|
74
|
-
};
|
|
75
|
-
return React.createElement(context.Provider, { value: value }, children);
|
|
76
|
-
};
|
|
77
|
-
export const useFrameStampPositionD = () => useContext(context).currentD;
|
|
78
|
-
/** Version of {@link useLockFrameStampPosition} which allows you to directly set status of a lock. */
|
|
79
|
-
export const useLockFrameStampPositionRef = () => {
|
|
80
|
-
const { getLock } = useContext(context);
|
|
81
|
-
const lockRef = useRef();
|
|
82
|
-
useLayoutEffect(() => {
|
|
83
|
-
return () => {
|
|
84
|
-
lockRef.current?.unlock();
|
|
85
|
-
};
|
|
86
|
-
}, []);
|
|
87
|
-
return useMemo(() => {
|
|
88
|
-
let prevLock = undefined;
|
|
89
|
-
return (shouldLock, posValue) => {
|
|
90
|
-
// Do if shouldLock changed
|
|
91
|
-
if (prevLock?.shouldLock !== shouldLock) {
|
|
92
|
-
if (shouldLock) {
|
|
93
|
-
lockRef.current = getLock();
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
lockRef.current?.unlock();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
// Do if position changed
|
|
100
|
-
if (prevLock?.pos !== posValue) {
|
|
101
|
-
if (shouldLock) {
|
|
102
|
-
lockRef.current?.set(posValue);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// Set arguments we are going to diff against next time
|
|
106
|
-
prevLock = { shouldLock, pos: posValue };
|
|
107
|
-
};
|
|
108
|
-
}, [getLock]);
|
|
109
|
-
};
|
|
110
|
-
export const useLockFrameStampPosition = (shouldLock, val) => {
|
|
111
|
-
const { getLock } = useContext(context);
|
|
112
|
-
const lockRef = useRef();
|
|
113
|
-
useLayoutEffect(() => {
|
|
114
|
-
if (!shouldLock)
|
|
115
|
-
return;
|
|
116
|
-
lockRef.current = getLock();
|
|
117
|
-
return () => {
|
|
118
|
-
lockRef.current.unlock();
|
|
119
|
-
};
|
|
120
|
-
}, [shouldLock, getLock]);
|
|
121
|
-
useLayoutEffect(() => {
|
|
122
|
-
if (shouldLock) {
|
|
123
|
-
lockRef.current.set(val);
|
|
124
|
-
}
|
|
125
|
-
}, [val, shouldLock]);
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* This attribute is used so that when the cursor hovers over a keyframe,
|
|
129
|
-
* the framestamp snaps to the position of that keyframe.
|
|
130
|
-
*
|
|
131
|
-
* Use as a spread in a React element.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```tsx
|
|
135
|
-
* <div {...includeLockFrameStampAttrs(10)}/>
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @remarks
|
|
139
|
-
* Elements that need this behavior must set a data attribute like so:
|
|
140
|
-
* <div data-theatre-lock-framestamp-to="120.55" />
|
|
141
|
-
* Setting this attribute to "hide" hides the stamp.
|
|
142
|
-
*
|
|
143
|
-
* @see lockedCursorCssVarName - CSS variable used to set the cursor on an element that
|
|
144
|
-
* should lock the framestamp. Look for usages.
|
|
145
|
-
* @see pointerEventsAutoInNormalMode - CSS snippet used to correctly set
|
|
146
|
-
* `pointer-events` on an element that should lock the framestamp.
|
|
147
|
-
*
|
|
148
|
-
* See {@link FrameStampPositionProvider}
|
|
149
|
-
*
|
|
150
|
-
*/
|
|
151
|
-
export const includeLockFrameStampAttrs = (value) => ({
|
|
152
|
-
[ATTR_LOCK_FRAMESTAMP]: value === 'hide' ? value : value.toFixed(3),
|
|
153
|
-
});
|
|
154
|
-
const ATTR_LOCK_FRAMESTAMP = 'data-theatre-lock-framestamp-to';
|
|
155
|
-
const pointerPositionInUnitSpace = (layoutP) => {
|
|
156
|
-
return prism(() => {
|
|
157
|
-
const rightDims = val(layoutP.rightDims);
|
|
158
|
-
const clippedSpaceToUnitSpace = val(layoutP.clippedSpace.toUnitSpace);
|
|
159
|
-
const mousePos = val(mousePositionD);
|
|
160
|
-
if (!mousePos)
|
|
161
|
-
return [-1, FrameStampPositionType.hidden];
|
|
162
|
-
for (const el of mousePos.composedPath()) {
|
|
163
|
-
if (!(el instanceof HTMLElement || el instanceof SVGElement))
|
|
164
|
-
break;
|
|
165
|
-
if (el.hasAttribute(ATTR_LOCK_FRAMESTAMP)) {
|
|
166
|
-
const val = el.getAttribute(ATTR_LOCK_FRAMESTAMP);
|
|
167
|
-
if (typeof val !== 'string')
|
|
168
|
-
continue;
|
|
169
|
-
if (val === 'hide')
|
|
170
|
-
return [-1, FrameStampPositionType.hidden];
|
|
171
|
-
const double = parseFloat(val);
|
|
172
|
-
if (isFinite(double) && double >= 0)
|
|
173
|
-
return [double, FrameStampPositionType.snapped];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
const { clientX, clientY } = mousePos;
|
|
177
|
-
const { screenX: x, screenY: y, width: rightWidth, height } = rightDims;
|
|
178
|
-
if (inRange(clientX, x, x + rightWidth) &&
|
|
179
|
-
inRange(clientY, y + 16 /* leaving a bit of space for the top stip here */, y + height)) {
|
|
180
|
-
const posInRightDims = clientX - x;
|
|
181
|
-
const posInUnitSpace = clippedSpaceToUnitSpace(posInRightDims);
|
|
182
|
-
return [posInUnitSpace, FrameStampPositionType.free];
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return [-1, FrameStampPositionType.hidden];
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
export default FrameStampPositionProvider;
|
package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { createStudioSheetItemKey } from '@tomorrowevening/theatre-shared/utils/ids';
|
|
2
|
-
import React, { useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { graphEditorColors } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/GraphEditor/GraphEditor';
|
|
4
|
-
import KeyframeEditor from './KeyframeEditor/KeyframeEditor';
|
|
5
|
-
import { getPropConfigByPath, isPropConfigComposite, valueInProp, } from '@tomorrowevening/theatre-shared/propTypes/utils';
|
|
6
|
-
import { useVal } from '@tomorrowevening/theatre-react';
|
|
7
|
-
const BasicKeyframedTrack = React.memo(({ layoutP, trackData, sheetObject, trackId, color, pathToProp }) => {
|
|
8
|
-
const propConfig = getPropConfigByPath(useVal(sheetObject.template.configPointer), pathToProp);
|
|
9
|
-
if (isPropConfigComposite(propConfig)) {
|
|
10
|
-
console.error(`Composite prop types cannot be keyframed`);
|
|
11
|
-
return React.createElement(React.Fragment, null);
|
|
12
|
-
}
|
|
13
|
-
const [areExtremumsLocked, setAreExtremumsLocked] = useState(false);
|
|
14
|
-
const lockExtremums = useMemo(() => {
|
|
15
|
-
const locks = new Set();
|
|
16
|
-
return function lockExtremums() {
|
|
17
|
-
const shouldLock = locks.size === 0;
|
|
18
|
-
locks.add(unlock);
|
|
19
|
-
if (shouldLock)
|
|
20
|
-
setAreExtremumsLocked(true);
|
|
21
|
-
function unlock() {
|
|
22
|
-
const wasLocked = locks.size > 0;
|
|
23
|
-
locks.delete(unlock);
|
|
24
|
-
if (wasLocked && locks.size === 0)
|
|
25
|
-
setAreExtremumsLocked(false);
|
|
26
|
-
}
|
|
27
|
-
return unlock;
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
const extremumSpace = useMemo(() => {
|
|
31
|
-
const extremums = propConfig.type === 'number'
|
|
32
|
-
? calculateScalarExtremums(trackData.keyframes, propConfig)
|
|
33
|
-
: calculateNonScalarExtremums(trackData.keyframes);
|
|
34
|
-
const fromValueSpace = (val) => (val - extremums[0]) / (extremums[1] - extremums[0]);
|
|
35
|
-
const toValueSpace = (ex) => extremums[0] + deltaToValueSpace(ex);
|
|
36
|
-
const deltaToValueSpace = (ex) => ex * (extremums[1] - extremums[0]);
|
|
37
|
-
return {
|
|
38
|
-
fromValueSpace,
|
|
39
|
-
toValueSpace,
|
|
40
|
-
deltaToValueSpace,
|
|
41
|
-
lock: lockExtremums,
|
|
42
|
-
};
|
|
43
|
-
}, [trackData.keyframes]);
|
|
44
|
-
const cachedExtremumSpace = useRef(undefined);
|
|
45
|
-
if (!areExtremumsLocked) {
|
|
46
|
-
cachedExtremumSpace.current = extremumSpace;
|
|
47
|
-
}
|
|
48
|
-
const keyframeEditors = trackData.keyframes.map((kf, index) => (React.createElement(KeyframeEditor, { pathToProp: pathToProp, propConfig: propConfig, itemKey: createStudioSheetItemKey.forTrackKeyframe(sheetObject, trackId, kf.id), keyframe: kf, index: index, trackData: trackData, layoutP: layoutP, sheetObject: sheetObject, trackId: trackId, isScalar: propConfig.type === 'number', key: kf.id, extremumSpace: cachedExtremumSpace.current, color: color })));
|
|
49
|
-
return (React.createElement("g", { style: {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
'--main-color': graphEditorColors[color].iconColor,
|
|
52
|
-
} }, keyframeEditors));
|
|
53
|
-
});
|
|
54
|
-
export default BasicKeyframedTrack;
|
|
55
|
-
function calculateScalarExtremums(keyframes, propConfig) {
|
|
56
|
-
let min = Infinity, max = -Infinity;
|
|
57
|
-
function check(n) {
|
|
58
|
-
min = Math.min(n, min);
|
|
59
|
-
max = Math.max(n, max);
|
|
60
|
-
}
|
|
61
|
-
keyframes.forEach((cur, i) => {
|
|
62
|
-
const curVal = valueInProp(cur.value, propConfig);
|
|
63
|
-
check(curVal);
|
|
64
|
-
if (!cur.connectedRight)
|
|
65
|
-
return;
|
|
66
|
-
const next = keyframes[i + 1];
|
|
67
|
-
if (!next)
|
|
68
|
-
return;
|
|
69
|
-
const diff = (typeof next.value === 'number' ? next.value : 1) - curVal;
|
|
70
|
-
check(curVal + cur.handles[3] * diff);
|
|
71
|
-
check(curVal + next.handles[1] * diff);
|
|
72
|
-
});
|
|
73
|
-
return [min, max];
|
|
74
|
-
}
|
|
75
|
-
function calculateNonScalarExtremums(keyframes) {
|
|
76
|
-
let min = 0, max = 1;
|
|
77
|
-
function check(n) {
|
|
78
|
-
min = Math.min(n, min);
|
|
79
|
-
max = Math.max(n, max);
|
|
80
|
-
}
|
|
81
|
-
keyframes.forEach((cur, i) => {
|
|
82
|
-
if (!cur.connectedRight)
|
|
83
|
-
return;
|
|
84
|
-
const next = keyframes[i + 1];
|
|
85
|
-
if (!next)
|
|
86
|
-
return;
|
|
87
|
-
check(cur.handles[3]);
|
|
88
|
-
check(next.handles[1]);
|
|
89
|
-
});
|
|
90
|
-
return [min, max];
|
|
91
|
-
}
|
package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/Curve.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { valueInProp } from '@tomorrowevening/theatre-shared/propTypes/utils';
|
|
2
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
3
|
-
import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
|
|
4
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
const SVGPath = styled.path `
|
|
8
|
-
stroke-width: 2;
|
|
9
|
-
stroke: var(--main-color);
|
|
10
|
-
fill: none;
|
|
11
|
-
vector-effect: non-scaling-stroke;
|
|
12
|
-
`;
|
|
13
|
-
// for keyframe.type === 'hold'
|
|
14
|
-
const pathForHoldType = `M 0 0 L 1 0 L 1 1`;
|
|
15
|
-
const Curve = (props) => {
|
|
16
|
-
const { index, trackData } = props;
|
|
17
|
-
const cur = trackData.keyframes[index];
|
|
18
|
-
const next = trackData.keyframes[index + 1];
|
|
19
|
-
const connectorLengthInUnitSpace = next.position - cur.position;
|
|
20
|
-
const [nodeRef, node] = useRefAndState(null);
|
|
21
|
-
const [contextMenu] = useConnectorContextMenu(node, props);
|
|
22
|
-
const curValue = props.isScalar
|
|
23
|
-
? valueInProp(cur.value, props.propConfig)
|
|
24
|
-
: 0;
|
|
25
|
-
const nextValue = props.isScalar
|
|
26
|
-
? valueInProp(next.value, props.propConfig)
|
|
27
|
-
: 1;
|
|
28
|
-
const leftYInExtremumSpace = props.extremumSpace.fromValueSpace(curValue);
|
|
29
|
-
const rightYInExtremumSpace = props.extremumSpace.fromValueSpace(nextValue);
|
|
30
|
-
const heightInExtremumSpace = rightYInExtremumSpace - leftYInExtremumSpace;
|
|
31
|
-
const transform = transformBox(cur.position, leftYInExtremumSpace, connectorLengthInUnitSpace, heightInExtremumSpace);
|
|
32
|
-
const x1 = cur.handles[2];
|
|
33
|
-
const y1 = cur.handles[3];
|
|
34
|
-
const x2 = next.handles[0];
|
|
35
|
-
const y2 = next.handles[1];
|
|
36
|
-
const pathD = `M 0 0 C ${x1} ${y1} ${x2} ${y2} 1 1`;
|
|
37
|
-
return (React.createElement(React.Fragment, null,
|
|
38
|
-
React.createElement(SVGPath, { ref: nodeRef, d: !cur.type || cur.type === 'bezier' ? pathD : pathForHoldType, style: {
|
|
39
|
-
transform,
|
|
40
|
-
} }),
|
|
41
|
-
contextMenu));
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Assuming a box such that: `{x: 0, y: 0, width: 1px, height: 1px}`
|
|
45
|
-
* and given the desired coordinates of:
|
|
46
|
-
* `{x: xInUnitSpace, y: yInExtremumSpace, width: widthInUnitSpace, height: heightInExtremumSpace}`,
|
|
47
|
-
* `transformBox()` returns a CSS transform that transforms the box into its right dimensions
|
|
48
|
-
* in the GraphEditor space.
|
|
49
|
-
*/
|
|
50
|
-
export function transformBox(xInUnitSpace, yInExtremumSpace, widthInUnitSpace, heightInExtremumSpace) {
|
|
51
|
-
const translateX = `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${xInUnitSpace}px)`;
|
|
52
|
-
const translateY = `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${yInExtremumSpace}) * 1px)`;
|
|
53
|
-
if (widthInUnitSpace === 0) {
|
|
54
|
-
widthInUnitSpace = 0.0001;
|
|
55
|
-
}
|
|
56
|
-
const scaleX = `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${widthInUnitSpace})`;
|
|
57
|
-
if (heightInExtremumSpace === 0) {
|
|
58
|
-
heightInExtremumSpace = 0.001;
|
|
59
|
-
}
|
|
60
|
-
const scaleY = `calc(var(--graphEditorVerticalSpace) * ${heightInExtremumSpace * -1})`;
|
|
61
|
-
return `translate(${translateX}, ${translateY}) scale(${scaleX}, ${scaleY})`;
|
|
62
|
-
}
|
|
63
|
-
export default Curve;
|
|
64
|
-
function useConnectorContextMenu(node, props) {
|
|
65
|
-
const { index, trackData } = props;
|
|
66
|
-
const cur = trackData.keyframes[index];
|
|
67
|
-
const next = trackData.keyframes[index + 1];
|
|
68
|
-
return useContextMenu(node, {
|
|
69
|
-
menuItems: () => {
|
|
70
|
-
return [
|
|
71
|
-
{
|
|
72
|
-
label: 'Delete',
|
|
73
|
-
callback: () => {
|
|
74
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
75
|
-
const { deleteKeyframes } = stateEditors.coreByProject.historic.sheetsById.sequence;
|
|
76
|
-
deleteKeyframes({
|
|
77
|
-
...props.sheetObject.address,
|
|
78
|
-
trackId: props.trackId,
|
|
79
|
-
keyframeIds: [cur.id, next.id],
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
2
|
-
import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
|
|
3
|
-
import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
|
|
4
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
5
|
-
import { val } from '@tomorrowevening/theatre-dataverse';
|
|
6
|
-
import { clamp } from 'lodash-es';
|
|
7
|
-
import React, { useMemo, useRef } from 'react';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
|
-
import { transformBox } from './Curve';
|
|
10
|
-
import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
|
|
11
|
-
export const dotSize = 6;
|
|
12
|
-
const Circle = styled.circle `
|
|
13
|
-
stroke-width: 1px;
|
|
14
|
-
vector-effect: non-scaling-stroke;
|
|
15
|
-
fill: var(--main-color);
|
|
16
|
-
r: 2px;
|
|
17
|
-
pointer-events: none;
|
|
18
|
-
`;
|
|
19
|
-
const HitZone = styled.circle `
|
|
20
|
-
stroke-width: 6px;
|
|
21
|
-
vector-effect: non-scaling-stroke;
|
|
22
|
-
r: 6px;
|
|
23
|
-
fill: transparent;
|
|
24
|
-
cursor: move;
|
|
25
|
-
${pointerEventsAutoInNormalMode};
|
|
26
|
-
&:hover {
|
|
27
|
-
}
|
|
28
|
-
&:hover + ${Circle} {
|
|
29
|
-
r: 6px;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
const Line = styled.path `
|
|
33
|
-
stroke-width: 1;
|
|
34
|
-
stroke: var(--main-color);
|
|
35
|
-
/* stroke: gray; */
|
|
36
|
-
fill: none;
|
|
37
|
-
vector-effect: non-scaling-stroke;
|
|
38
|
-
`;
|
|
39
|
-
const CurveHandle = (props) => {
|
|
40
|
-
const [ref, node] = useRefAndState(null);
|
|
41
|
-
const { index, trackData } = props;
|
|
42
|
-
const cur = trackData.keyframes[index];
|
|
43
|
-
const next = trackData.keyframes[index + 1];
|
|
44
|
-
const [contextMenu] = useOurContextMenu(node, props);
|
|
45
|
-
useOurDrags(node, props);
|
|
46
|
-
const posInDiffSpace = props.which === 'left' ? cur.handles[2] : next.handles[0];
|
|
47
|
-
const posInUnitSpace = cur.position + (next.position - cur.position) * posInDiffSpace;
|
|
48
|
-
const valInDiffSpace = props.which === 'left' ? cur.handles[3] : next.handles[1];
|
|
49
|
-
const curValue = props.isScalar ? cur.value : 0;
|
|
50
|
-
const nextValue = props.isScalar ? next.value : 1;
|
|
51
|
-
const value = curValue + (nextValue - curValue) * valInDiffSpace;
|
|
52
|
-
const valInExtremumSpace = props.extremumSpace.fromValueSpace(value);
|
|
53
|
-
const heightInExtremumSpace = valInExtremumSpace -
|
|
54
|
-
props.extremumSpace.fromValueSpace(props.which === 'left' ? curValue : nextValue);
|
|
55
|
-
const lineTransform = transformBox(props.which === 'left' ? cur.position : next.position, props.extremumSpace.fromValueSpace(props.which === 'left' ? curValue : nextValue), posInUnitSpace - (props.which === 'left' ? cur.position : next.position), heightInExtremumSpace);
|
|
56
|
-
return (React.createElement("g", null,
|
|
57
|
-
React.createElement(HitZone, { ref: ref, style: {
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
cx: `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${posInUnitSpace} * 1px)`,
|
|
60
|
-
cy: `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${valInExtremumSpace}) * 1px)`,
|
|
61
|
-
} }),
|
|
62
|
-
React.createElement(Circle, { style: {
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
cx: `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${posInUnitSpace} * 1px)`,
|
|
65
|
-
cy: `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${valInExtremumSpace}) * 1px)`,
|
|
66
|
-
} }),
|
|
67
|
-
React.createElement(Line, { d: "M 0 0 L 1 1", style: {
|
|
68
|
-
transform: lineTransform,
|
|
69
|
-
} }),
|
|
70
|
-
contextMenu));
|
|
71
|
-
};
|
|
72
|
-
export default CurveHandle;
|
|
73
|
-
function useOurDrags(node, props) {
|
|
74
|
-
const propsRef = useRef(props);
|
|
75
|
-
propsRef.current = props;
|
|
76
|
-
const handlers = useMemo(() => {
|
|
77
|
-
return {
|
|
78
|
-
debugName: 'CurveHandler/useOurDrags',
|
|
79
|
-
lockCSSCursorTo: 'move',
|
|
80
|
-
onDragStart() {
|
|
81
|
-
let tempTransaction;
|
|
82
|
-
const propsAtStartOfDrag = propsRef.current;
|
|
83
|
-
const scaledToUnitSpace = val(propsAtStartOfDrag.layoutP.scaledSpace.toUnitSpace);
|
|
84
|
-
const verticalToExtremumSpace = val(propsAtStartOfDrag.layoutP.graphEditorVerticalSpace.toExtremumSpace);
|
|
85
|
-
const unlockExtremums = propsAtStartOfDrag.extremumSpace.lock();
|
|
86
|
-
return {
|
|
87
|
-
onDrag(dxInScaledSpace, dy) {
|
|
88
|
-
if (tempTransaction) {
|
|
89
|
-
tempTransaction.discard();
|
|
90
|
-
tempTransaction = undefined;
|
|
91
|
-
}
|
|
92
|
-
const { index, trackData } = propsAtStartOfDrag;
|
|
93
|
-
const cur = trackData.keyframes[index];
|
|
94
|
-
const next = trackData.keyframes[index + 1];
|
|
95
|
-
const dPosInUnitSpace = scaledToUnitSpace(dxInScaledSpace);
|
|
96
|
-
let dPosInKeyframeDiffSpace = dPosInUnitSpace / (next.position - cur.position);
|
|
97
|
-
const dyInVerticalSpace = -dy;
|
|
98
|
-
const dYInExtremumSpace = verticalToExtremumSpace(dyInVerticalSpace);
|
|
99
|
-
const dYInValueSpace = propsAtStartOfDrag.extremumSpace.deltaToValueSpace(dYInExtremumSpace);
|
|
100
|
-
const curValue = props.isScalar ? cur.value : 0;
|
|
101
|
-
const nextValue = props.isScalar ? next.value : 1;
|
|
102
|
-
const dyInKeyframeDiffSpace = dYInValueSpace / (nextValue - curValue);
|
|
103
|
-
if (propsAtStartOfDrag.which === 'left') {
|
|
104
|
-
const handleX = clamp(cur.handles[2] + dPosInKeyframeDiffSpace, 0, 1);
|
|
105
|
-
const handleY = cur.handles[3] + dyInKeyframeDiffSpace;
|
|
106
|
-
tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
|
|
107
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
|
|
108
|
-
...propsAtStartOfDrag.sheetObject.address,
|
|
109
|
-
snappingFunction: val(propsAtStartOfDrag.layoutP.sheet).getSequence().closestGridPosition,
|
|
110
|
-
trackId: propsAtStartOfDrag.trackId,
|
|
111
|
-
keyframes: [
|
|
112
|
-
{
|
|
113
|
-
...cur,
|
|
114
|
-
handles: [
|
|
115
|
-
cur.handles[0],
|
|
116
|
-
cur.handles[1],
|
|
117
|
-
handleX,
|
|
118
|
-
handleY,
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
const handleX = clamp(next.handles[0] + dPosInKeyframeDiffSpace, 0, 1);
|
|
127
|
-
const handleY = next.handles[1] + dyInKeyframeDiffSpace;
|
|
128
|
-
tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
|
|
129
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
|
|
130
|
-
...propsAtStartOfDrag.sheetObject.address,
|
|
131
|
-
trackId: propsAtStartOfDrag.trackId,
|
|
132
|
-
snappingFunction: val(propsAtStartOfDrag.layoutP.sheet).getSequence().closestGridPosition,
|
|
133
|
-
keyframes: [
|
|
134
|
-
{
|
|
135
|
-
...next,
|
|
136
|
-
handles: [
|
|
137
|
-
handleX,
|
|
138
|
-
handleY,
|
|
139
|
-
next.handles[2],
|
|
140
|
-
next.handles[3],
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
onDragEnd(dragHappened) {
|
|
149
|
-
unlockExtremums();
|
|
150
|
-
if (dragHappened) {
|
|
151
|
-
if (tempTransaction) {
|
|
152
|
-
tempTransaction.commit();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
if (tempTransaction) {
|
|
157
|
-
tempTransaction.discard();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}, []);
|
|
165
|
-
useDrag(node, handlers);
|
|
166
|
-
}
|
|
167
|
-
function useOurContextMenu(node, props) {
|
|
168
|
-
return useContextMenu(node, {
|
|
169
|
-
menuItems: () => {
|
|
170
|
-
return [
|
|
171
|
-
{
|
|
172
|
-
label: 'Delete',
|
|
173
|
-
callback: () => {
|
|
174
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
175
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes({
|
|
176
|
-
...props.sheetObject.address,
|
|
177
|
-
keyframeIds: [props.keyframe.id],
|
|
178
|
-
trackId: props.trackId,
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
];
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
}
|