@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,136 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
|
|
3
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
4
|
-
import clamp from 'lodash-es/clamp';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
|
-
import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
|
|
7
|
-
import { useFreezableMemo } from './useFreezableMemo';
|
|
8
|
-
import { COLOR_BASE } from './colors';
|
|
9
|
-
// Defines the dimensions of the SVG viewbox space
|
|
10
|
-
const VIEWBOX_PADDING = 0.12;
|
|
11
|
-
const VIEWBOX_SIZE = 1 + VIEWBOX_PADDING * 2;
|
|
12
|
-
const PATTERN_DOT_SIZE = 0.01;
|
|
13
|
-
const PATTERN_DOT_COUNT = 8;
|
|
14
|
-
const PATTERN_GRID_SIZE = (1 - PATTERN_DOT_SIZE) / (PATTERN_DOT_COUNT - 1);
|
|
15
|
-
// The curve supports a gradient but currently is solid cyan
|
|
16
|
-
const CURVE_START_OVERSHOOT_COLOR = '#3EAAA4';
|
|
17
|
-
const CURVE_START_COLOR = '#3EAAA4';
|
|
18
|
-
const CURVE_MID_START_COLOR = '#3EAAA4';
|
|
19
|
-
const CURVE_MID_COLOR = '#3EAAA4';
|
|
20
|
-
const CURVE_MID_END_COLOR = '#3EAAA4';
|
|
21
|
-
const CURVE_END_COLOR = '#3EAAA4';
|
|
22
|
-
const CURVE_END_OVERSHOOT_COLOR = '#3EAAA4';
|
|
23
|
-
const CONTROL_COLOR = '#B3B3B3';
|
|
24
|
-
const HANDLE_COLOR = '#3eaaa4';
|
|
25
|
-
const HANDLE_HOVER_COLOR = '#67dfd8';
|
|
26
|
-
const BACKGROUND_CURVE_COLORS = [
|
|
27
|
-
'goldenrod',
|
|
28
|
-
'cornflowerblue',
|
|
29
|
-
'dodgerblue',
|
|
30
|
-
'lawngreen',
|
|
31
|
-
];
|
|
32
|
-
const Circle = styled.circle `
|
|
33
|
-
stroke-width: 0.1px;
|
|
34
|
-
vector-effect: non-scaling-stroke;
|
|
35
|
-
r: 0.04px;
|
|
36
|
-
pointer-events: none;
|
|
37
|
-
transition: r 0.15s;
|
|
38
|
-
fill: ${HANDLE_COLOR};
|
|
39
|
-
`;
|
|
40
|
-
const HitZone = styled.circle `
|
|
41
|
-
stroke-width: 0.1px;
|
|
42
|
-
vector-effect: non-scaling-stroke;
|
|
43
|
-
r: 0.09px;
|
|
44
|
-
cursor: move;
|
|
45
|
-
${pointerEventsAutoInNormalMode};
|
|
46
|
-
&:hover {
|
|
47
|
-
opacity: 0.4;
|
|
48
|
-
}
|
|
49
|
-
&:hover + ${Circle} {
|
|
50
|
-
fill: ${HANDLE_HOVER_COLOR};
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
const CurveSegmentEditor = (props) => {
|
|
54
|
-
const { curveConnection: { left, right }, backgroundConnections, } = props;
|
|
55
|
-
// Calculations towards keeping the handles in the viewbox. The extremum space
|
|
56
|
-
// of this editor vertically scales to keep the handles in the viewbox of the
|
|
57
|
-
// SVG. This produces a nice "stretching space" effect while you are dragging
|
|
58
|
-
// the handles.
|
|
59
|
-
// Demo: https://user-images.githubusercontent.com/11082236/164542544-f1f66de2-f62e-44dd-b4cb-05b5f6e73a52.mp4
|
|
60
|
-
const minY = Math.min(0, 1 - right.handles[1], 1 - left.handles[3]);
|
|
61
|
-
const maxY = Math.max(1, 1 - right.handles[1], 1 - left.handles[3]);
|
|
62
|
-
const h = Math.max(1, maxY - minY);
|
|
63
|
-
const toExtremumSpace = (y) => (y - minY) / h;
|
|
64
|
-
const [refSVG, nodeSVG] = useRefAndState(null);
|
|
65
|
-
const viewboxToElWidthRatio = VIEWBOX_SIZE / (nodeSVG?.clientWidth || 1);
|
|
66
|
-
const viewboxToElHeightRatio = VIEWBOX_SIZE / (nodeSVG?.clientHeight || 1);
|
|
67
|
-
const [refLeft, nodeLeft] = useRefAndState(null);
|
|
68
|
-
useKeyframeDrag(nodeSVG, nodeLeft, props, (dx, dy) => {
|
|
69
|
-
// TODO - document this
|
|
70
|
-
const handleX = clamp(left.handles[2] + dx * viewboxToElWidthRatio, 0, 1);
|
|
71
|
-
const handleY = left.handles[3] - dy * viewboxToElHeightRatio;
|
|
72
|
-
return [handleX, handleY, right.handles[0], right.handles[1]];
|
|
73
|
-
});
|
|
74
|
-
const [refRight, nodeRight] = useRefAndState(null);
|
|
75
|
-
useKeyframeDrag(nodeSVG, nodeRight, props, (dx, dy) => {
|
|
76
|
-
// TODO - document this
|
|
77
|
-
const handleX = clamp(right.handles[0] + dx * viewboxToElWidthRatio, 0, 1);
|
|
78
|
-
const handleY = right.handles[1] - dy * viewboxToElHeightRatio;
|
|
79
|
-
return [left.handles[2], left.handles[3], handleX, handleY];
|
|
80
|
-
});
|
|
81
|
-
const curvePathDAttrValue = (connection) => `M0 ${toExtremumSpace(1)} C${connection.left.handles[2]} ${toExtremumSpace(1 - connection.left.handles[3])} ${connection.right.handles[0]} ${toExtremumSpace(1 - connection.right.handles[1])} 1 ${toExtremumSpace(0)}`;
|
|
82
|
-
const holdPointsAttrValue = `0,100 100,100 100,0`;
|
|
83
|
-
return (React.createElement("svg", { height: "100%", width: "100%", ref: refSVG, viewBox: `${-VIEWBOX_PADDING} ${-VIEWBOX_PADDING} ${VIEWBOX_SIZE} ${VIEWBOX_SIZE}`, xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "none", fill: "none" },
|
|
84
|
-
React.createElement("linearGradient", { id: "myGradient", gradientTransform: "rotate(90)" },
|
|
85
|
-
React.createElement("stop", { offset: toExtremumSpace(-1), stopColor: CURVE_END_OVERSHOOT_COLOR }),
|
|
86
|
-
React.createElement("stop", { offset: toExtremumSpace(0), stopColor: CURVE_END_COLOR }),
|
|
87
|
-
React.createElement("stop", { offset: toExtremumSpace(0.3), stopColor: CURVE_MID_END_COLOR }),
|
|
88
|
-
React.createElement("stop", { offset: toExtremumSpace(0.5), stopColor: CURVE_MID_COLOR }),
|
|
89
|
-
React.createElement("stop", { offset: toExtremumSpace(0.7), stopColor: CURVE_MID_START_COLOR }),
|
|
90
|
-
React.createElement("stop", { offset: toExtremumSpace(1), stopColor: CURVE_START_COLOR }),
|
|
91
|
-
React.createElement("stop", { offset: toExtremumSpace(2), stopColor: CURVE_START_OVERSHOOT_COLOR })),
|
|
92
|
-
React.createElement("pattern", { id: "dot-background-pattern-1", width: PATTERN_GRID_SIZE, height: PATTERN_GRID_SIZE / h, y: -minY / h },
|
|
93
|
-
React.createElement("rect", { width: PATTERN_DOT_SIZE, height: PATTERN_DOT_SIZE, fill: CONTROL_COLOR, opacity: 0.3 })),
|
|
94
|
-
React.createElement("rect", { x: 0, y: 0, width: "1", height: 1, fill: "url(#dot-background-pattern-1)" }),
|
|
95
|
-
React.createElement("pattern", { id: "dot-background-pattern-2", width: PATTERN_GRID_SIZE, height: PATTERN_GRID_SIZE },
|
|
96
|
-
React.createElement("rect", { width: PATTERN_DOT_SIZE, height: PATTERN_DOT_SIZE, fill: CONTROL_COLOR })),
|
|
97
|
-
React.createElement("rect", { x: 0, y: toExtremumSpace(0), width: "1", height: toExtremumSpace(1) - toExtremumSpace(0), fill: "url(#dot-background-pattern-2)" }),
|
|
98
|
-
!left.type || left.type === 'bezier' ? (React.createElement(React.Fragment, null,
|
|
99
|
-
React.createElement("line", { x1: 0, y1: toExtremumSpace(1), x2: left.handles[2], y2: toExtremumSpace(1 - left.handles[3]), stroke: CONTROL_COLOR, strokeWidth: "0.01" }),
|
|
100
|
-
React.createElement("line", { x1: 1, y1: toExtremumSpace(0), x2: right.handles[0], y2: toExtremumSpace(1 - right.handles[1]), stroke: CONTROL_COLOR, strokeWidth: "0.01" }),
|
|
101
|
-
React.createElement("path", { d: curvePathDAttrValue(props.curveConnection), stroke: "none", fill: "url('#myGradient')", opacity: "0.1" }),
|
|
102
|
-
backgroundConnections.map((connection, i) => (React.createElement("path", { key: connection.objectKey + '/' + connection.left.id, d: curvePathDAttrValue(connection), stroke: BACKGROUND_CURVE_COLORS[i % BACKGROUND_CURVE_COLORS.length], opacity: 0.6, strokeWidth: "0.01" }))),
|
|
103
|
-
React.createElement("path", { d: curvePathDAttrValue(props.curveConnection), stroke: "url('#myGradient')", strokeWidth: "0.02" }),
|
|
104
|
-
React.createElement("circle", { cx: 0, cy: toExtremumSpace(1), r: "0.025", stroke: CURVE_START_COLOR, strokeWidth: "0.02", fill: COLOR_BASE }),
|
|
105
|
-
React.createElement("circle", { cx: 1, cy: toExtremumSpace(0), r: "0.025", stroke: CURVE_END_COLOR, strokeWidth: "0.02", fill: COLOR_BASE }),
|
|
106
|
-
React.createElement(HitZone, { ref: refLeft, cx: left.handles[2], cy: toExtremumSpace(1 - left.handles[3]), fill: CURVE_START_COLOR, opacity: 0.2 }),
|
|
107
|
-
React.createElement(Circle, { cx: left.handles[2], cy: toExtremumSpace(1 - left.handles[3]) }),
|
|
108
|
-
React.createElement(HitZone, { ref: refRight, cx: right.handles[0], cy: toExtremumSpace(1 - right.handles[1]), fill: CURVE_END_COLOR, opacity: 0.2 }),
|
|
109
|
-
React.createElement(Circle, { cx: right.handles[0], cy: toExtremumSpace(1 - right.handles[1]) }))) : (React.createElement(React.Fragment, null,
|
|
110
|
-
React.createElement("line", { x1: 0, y1: toExtremumSpace(1), x2: 1, y2: toExtremumSpace(1), stroke: CONTROL_COLOR, strokeWidth: "0.01" }),
|
|
111
|
-
React.createElement("line", { x1: 1, y1: toExtremumSpace(1), x2: 1, y2: 0, stroke: CONTROL_COLOR, strokeWidth: "0.01" }),
|
|
112
|
-
React.createElement("circle", { cx: 0, cy: 1, r: "0.025", stroke: CURVE_END_COLOR, strokeWidth: "0.02", fill: COLOR_BASE }),
|
|
113
|
-
React.createElement("circle", { cx: 1, cy: 0, r: "0.025", stroke: CURVE_END_COLOR, strokeWidth: "0.02", fill: COLOR_BASE })))));
|
|
114
|
-
};
|
|
115
|
-
export default CurveSegmentEditor;
|
|
116
|
-
function useKeyframeDrag(svgNode, node, props, setHandles) {
|
|
117
|
-
const handlers = useFreezableMemo((setFrozen) => ({
|
|
118
|
-
debugName: 'CurveSegmentEditor/useKeyframeDrag',
|
|
119
|
-
lockCSSCursorTo: 'move',
|
|
120
|
-
onDragStart() {
|
|
121
|
-
setFrozen(true);
|
|
122
|
-
return {
|
|
123
|
-
onDrag(dx, dy) {
|
|
124
|
-
if (!svgNode)
|
|
125
|
-
return;
|
|
126
|
-
props.onCurveChange(setHandles(dx, dy));
|
|
127
|
-
},
|
|
128
|
-
onDragEnd(dragHappened) {
|
|
129
|
-
setFrozen(false);
|
|
130
|
-
props.onCancelCurveChange();
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
},
|
|
134
|
-
}), [svgNode, props.onCurveChange, props.onCancelCurveChange]);
|
|
135
|
-
useDrag(node, handlers);
|
|
136
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import useTooltip from '@tomorrowevening/theatre-studio/uiComponents/Popover/useTooltip';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { handlesFromCssCubicBezierArgs } from './shared';
|
|
5
|
-
import SVGCurveSegment from './SVGCurveSegment';
|
|
6
|
-
import { mergeRefs } from 'react-merge-refs';
|
|
7
|
-
import { COLOR_BASE } from './colors';
|
|
8
|
-
import BasicPopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicPopover';
|
|
9
|
-
const Wrapper = styled.div `
|
|
10
|
-
position: relative;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
aspect-ratio: 1;
|
|
16
|
-
|
|
17
|
-
transition: background-color 0.15s;
|
|
18
|
-
background-color: ${COLOR_BASE};
|
|
19
|
-
border-radius: 2px;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
outline: none;
|
|
22
|
-
|
|
23
|
-
${({ isSelected }) => isSelected &&
|
|
24
|
-
css `
|
|
25
|
-
background-color: #383d42;
|
|
26
|
-
`}
|
|
27
|
-
|
|
28
|
-
&:hover {
|
|
29
|
-
background-color: #31353a;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&:focus {
|
|
33
|
-
background-color: #383d42;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
const EasingTooltip = styled(BasicPopover) `
|
|
37
|
-
padding: 0.5em;
|
|
38
|
-
color: white;
|
|
39
|
-
max-width: 240px;
|
|
40
|
-
pointer-events: none !important;
|
|
41
|
-
--popover-bg: black;
|
|
42
|
-
--popover-outer-stroke: transparent;
|
|
43
|
-
--popover-inner-stroke: transparent;
|
|
44
|
-
box-shadow: none;
|
|
45
|
-
`;
|
|
46
|
-
const EasingOption = React.forwardRef((props, ref) => {
|
|
47
|
-
const [tooltip, tooltipHostRef] = useTooltip({ enabled: true, verticalPlacement: props.tooltipPlacement, verticalGap: 0 }, () => (React.createElement(EasingTooltip, { showPopoverEdgeTriangle: false }, props.easing.label)));
|
|
48
|
-
return (React.createElement(Wrapper, { ref: mergeRefs([tooltipHostRef, ref]), ...props },
|
|
49
|
-
tooltip,
|
|
50
|
-
React.createElement(SVGCurveSegment, { easing: handlesFromCssCubicBezierArgs(props.easing.value), isSelected: props.isSelected })));
|
|
51
|
-
});
|
|
52
|
-
export default EasingOption;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const VIEWBOX_PADDING = 0.75;
|
|
3
|
-
const SVG_CIRCLE_RADIUS = 0.1;
|
|
4
|
-
const VIEWBOX_SIZE = 1 + VIEWBOX_PADDING * 2;
|
|
5
|
-
const SELECTED_CURVE_COLOR = '#F5F5F5';
|
|
6
|
-
const CURVE_COLOR = '#888888';
|
|
7
|
-
const CONTROL_COLOR = '#4f4f4f';
|
|
8
|
-
const CONTROL_HITZONE_COLOR = 'rgba(255, 255, 255, 0.1)';
|
|
9
|
-
// SVG's y coordinates go from top to bottom, e.g. 1 is vertically lower than 0,
|
|
10
|
-
// but easing points go from bottom to top.
|
|
11
|
-
const toVerticalSVGSpace = (y) => 1 - y;
|
|
12
|
-
const SVGCurveSegment = (props) => {
|
|
13
|
-
const { easing, isSelected } = props;
|
|
14
|
-
const curveColor = isSelected ? SELECTED_CURVE_COLOR : CURVE_COLOR;
|
|
15
|
-
// With a padding of 0, this results in a "unit viewbox" i.e. `0 0 1 1`.
|
|
16
|
-
// With padding e.g. VIEWBOX_PADDING=0.1, this results in a viewbox of `-0.1 -0,1 1.2 1.2`,
|
|
17
|
-
// i.e. a viewbox with a top left coordinate of -0.1,-0.1 and a width and height of 1.2,
|
|
18
|
-
// resulting in bottom right coordinate of 1.1,1.1
|
|
19
|
-
const SVG_VIEWBOX_ATTR = `${-VIEWBOX_PADDING} ${-VIEWBOX_PADDING} ${VIEWBOX_SIZE} ${VIEWBOX_SIZE}`;
|
|
20
|
-
// Bezier SVG
|
|
21
|
-
if (easing) {
|
|
22
|
-
const leftControlPoint = [easing[0], toVerticalSVGSpace(easing[1])];
|
|
23
|
-
const rightControlPoint = [easing[2], toVerticalSVGSpace(easing[3])];
|
|
24
|
-
return (React.createElement("svg", { height: "100%", width: "100%", viewBox: SVG_VIEWBOX_ATTR, fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
25
|
-
React.createElement("line", { x1: "0", y1: "1", x2: leftControlPoint[0], y2: leftControlPoint[1], stroke: CONTROL_COLOR, strokeWidth: "0.1" }),
|
|
26
|
-
React.createElement("line", { x1: "1", y1: "0", x2: rightControlPoint[0], y2: rightControlPoint[1], stroke: CONTROL_COLOR, strokeWidth: "0.1" }),
|
|
27
|
-
React.createElement("circle", { cx: leftControlPoint[0], cy: leftControlPoint[1], r: 0.1, fill: CONTROL_HITZONE_COLOR }),
|
|
28
|
-
React.createElement("circle", { cx: rightControlPoint[0], cy: rightControlPoint[1], r: 0.1, fill: CONTROL_HITZONE_COLOR }),
|
|
29
|
-
React.createElement("circle", { cx: leftControlPoint[0], cy: leftControlPoint[1], r: SVG_CIRCLE_RADIUS, fill: CONTROL_COLOR }),
|
|
30
|
-
React.createElement("circle", { cx: rightControlPoint[0], cy: rightControlPoint[1], r: SVG_CIRCLE_RADIUS, fill: CONTROL_COLOR }),
|
|
31
|
-
React.createElement("path", { d: `M0 1 C${leftControlPoint[0]} ${leftControlPoint[1]} ${rightControlPoint[0]}
|
|
32
|
-
${rightControlPoint[1]} 1 0`, stroke: curveColor, strokeWidth: "0.08" }),
|
|
33
|
-
React.createElement("circle", { cx: 0, cy: 1, r: SVG_CIRCLE_RADIUS, fill: curveColor }),
|
|
34
|
-
React.createElement("circle", { cx: 1, cy: 0, r: SVG_CIRCLE_RADIUS, fill: curveColor })));
|
|
35
|
-
}
|
|
36
|
-
// "Hold" SVG
|
|
37
|
-
return (React.createElement("svg", { height: "100%", width: "100%", viewBox: SVG_VIEWBOX_ATTR, fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
38
|
-
React.createElement("line", { x1: "0", y1: "1", x2: 1, y2: 1, stroke: curveColor, strokeWidth: "0.08" }),
|
|
39
|
-
React.createElement("line", { x1: "1", y1: "0", x2: 1, y2: 1, stroke: curveColor, strokeWidth: "0.08" }),
|
|
40
|
-
React.createElement("circle", { cx: 0, cy: 1, r: SVG_CIRCLE_RADIUS, fill: curveColor }),
|
|
41
|
-
React.createElement("circle", { cx: 1, cy: 0, r: SVG_CIRCLE_RADIUS, fill: curveColor })));
|
|
42
|
-
};
|
|
43
|
-
export default SVGCurveSegment;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const CSS_BEZIER_ARGS_DECIMAL_POINTS = 3; // Doesn't have to be 3, but it matches our preset data
|
|
2
|
-
/** Returns e.g. `"0, 0, 1, 1"`. See {@link CSSCubicBezierArgsString} docs for more context. */
|
|
3
|
-
export function cssCubicBezierArgsFromHandles(points) {
|
|
4
|
-
return points.map((p) => p.toFixed(CSS_BEZIER_ARGS_DECIMAL_POINTS)).join(', ');
|
|
5
|
-
}
|
|
6
|
-
const MAX_REASONABLE_BEZIER_STRING = 128;
|
|
7
|
-
export function handlesFromCssCubicBezierArgs(str) {
|
|
8
|
-
if (!str || str?.length > MAX_REASONABLE_BEZIER_STRING)
|
|
9
|
-
return null;
|
|
10
|
-
const args = str.split(',');
|
|
11
|
-
if (args.length !== 4)
|
|
12
|
-
return null;
|
|
13
|
-
const nums = args.map((arg) => {
|
|
14
|
-
return Number(arg.trim());
|
|
15
|
-
});
|
|
16
|
-
if (!nums.every((v) => isFinite(v)))
|
|
17
|
-
return null;
|
|
18
|
-
if (nums[0] < 0 || nums[0] > 1 || nums[2] < 0 || nums[2] > 1)
|
|
19
|
-
return null;
|
|
20
|
-
return nums;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* A collection of cubic-bezier approximations of common easing functions
|
|
24
|
-
* - ref: https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function
|
|
25
|
-
* - ref: [GitHub issue 28 comment "michaeltheory's suggested default easing presets"](https://github.com/theatre-js/theatre/issues/28#issuecomment-938752916)
|
|
26
|
-
**/
|
|
27
|
-
export const EASING_PRESETS = [
|
|
28
|
-
{ label: 'Quad Out', value: '0.250, 0.460, 0.450, 0.940' },
|
|
29
|
-
{ label: 'Quad In Out', value: '0.455, 0.030, 0.515, 0.955' },
|
|
30
|
-
{ label: 'Quad In', value: '0.550, 0.085, 0.680, 0.530' },
|
|
31
|
-
{ label: 'Cubic Out', value: '0.215, 0.610, 0.355, 1.000' },
|
|
32
|
-
{ label: 'Cubic In Out', value: '0.645, 0.045, 0.355, 1.000' },
|
|
33
|
-
{ label: 'Cubic In', value: '0.550, 0.055, 0.675, 0.190' },
|
|
34
|
-
{ label: 'Quart Out', value: '0.165, 0.840, 0.440, 1.000' },
|
|
35
|
-
{ label: 'Quart In Out', value: '0.770, 0.000, 0.175, 1.000' },
|
|
36
|
-
{ label: 'Quart In', value: '0.895, 0.030, 0.685, 0.220' },
|
|
37
|
-
{ label: 'Quint Out', value: '0.230, 1.000, 0.320, 1.000' },
|
|
38
|
-
{ label: 'Quint In Out', value: '0.860, 0.000, 0.070, 1.000' },
|
|
39
|
-
{ label: 'Quint In', value: '0.755, 0.050, 0.855, 0.060' },
|
|
40
|
-
{ label: 'Sine Out', value: '0.390, 0.575, 0.565, 1.000' },
|
|
41
|
-
{ label: 'Sine In Out', value: '0.445, 0.050, 0.550, 0.950' },
|
|
42
|
-
{ label: 'Sine In', value: '0.470, 0.000, 0.745, 0.715' },
|
|
43
|
-
{ label: 'Expo Out', value: '0.190, 1.000, 0.220, 1.000' },
|
|
44
|
-
{ label: 'Expo In Out', value: '1.000, 0.000, 0.000, 1.000' },
|
|
45
|
-
{ label: 'Expo In', value: '0.780, 0.000, 0.810, 0.00' },
|
|
46
|
-
{ label: 'Circ Out', value: '0.075, 0.820, 0.165, 1.000' },
|
|
47
|
-
{ label: 'Circ In Out', value: '0.785, 0.135, 0.150, 0.860' },
|
|
48
|
-
{ label: 'Circ In', value: '0.600, 0.040, 0.980, 0.335' },
|
|
49
|
-
{ label: 'Back Out', value: '0.175, 0.885, 0.320, 1.275' },
|
|
50
|
-
{ label: 'Back In Out', value: '0.680, -0.550, 0.265, 1.550' },
|
|
51
|
-
{ label: 'Back In', value: '0.600, -0.280, 0.735, 0.045' },
|
|
52
|
-
{ label: 'linear', value: '0.5, 0.5, 0.5, 0.5' },
|
|
53
|
-
{ label: 'In Out', value: '0.42,0,0.58,1' },
|
|
54
|
-
{ label: 'Hold', value: '0, 0, Infinity, Infinity' },
|
|
55
|
-
/* These easings are not being included initially in order to
|
|
56
|
-
simplify the choices */
|
|
57
|
-
// {label: 'Back In Out', value: '0.680, -0.550, 0.265, 1.550'},
|
|
58
|
-
// {label: 'Back In', value: '0.600, -0.280, 0.735, 0.045'},
|
|
59
|
-
// {label: 'Back Out', value: '0.175, 0.885, 0.320, 1.275'},
|
|
60
|
-
// {label: 'Circ In Out', value: '0.785, 0.135, 0.150, 0.860'},
|
|
61
|
-
// {label: 'Circ In', value: '0.600, 0.040, 0.980, 0.335'},
|
|
62
|
-
// {label: 'Circ Out', value: '0.075, 0.820, 0.165, 1'},
|
|
63
|
-
// {label: 'Quad In Out', value: '0.455, 0.030, 0.515, 0.955'},
|
|
64
|
-
// {label: 'Quad In', value: '0.550, 0.085, 0.680, 0.530'},
|
|
65
|
-
// {label: 'Quad Out', value: '0.250, 0.460, 0.450, 0.940'},
|
|
66
|
-
// {label: 'Ease Out In', value: '.42, 0, .58, 1'},
|
|
67
|
-
];
|
|
68
|
-
/**
|
|
69
|
-
* Compares two easings and returns true iff they are similar up to a threshold
|
|
70
|
-
*
|
|
71
|
-
* @param easing1 - first easing to compare
|
|
72
|
-
* @param easing2 - second easing to compare
|
|
73
|
-
* @param options - optionally pass an object with a threshold that determines how similar the easings should be
|
|
74
|
-
* @returns boolean if the easings are similar
|
|
75
|
-
*/
|
|
76
|
-
export function areEasingsSimilar(easing1, easing2, options = { threshold: 0.02 }) {
|
|
77
|
-
if (!easing1 || !easing2)
|
|
78
|
-
return false;
|
|
79
|
-
let totalDiff = 0;
|
|
80
|
-
for (let i = 0; i < 4; i++) {
|
|
81
|
-
totalDiff += Math.abs(easing1[i] - easing2[i]);
|
|
82
|
-
}
|
|
83
|
-
return totalDiff < options.threshold;
|
|
84
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useMemo, useRef, useState } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* The same as useMemo except that it can be frozen so that
|
|
4
|
-
* the memoized function is not recomputed even if the dependencies
|
|
5
|
-
* change. It can also be unfrozen.
|
|
6
|
-
*
|
|
7
|
-
* An unfrozen useFreezableMemo is the same as useMemo.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export function useFreezableMemo(fn, deps) {
|
|
11
|
-
const [isFrozen, setFreeze] = useState(false);
|
|
12
|
-
const freezableDeps = useRef(deps);
|
|
13
|
-
if (!isFrozen)
|
|
14
|
-
freezableDeps.current = deps;
|
|
15
|
-
return useMemo(() => fn(setFreeze), freezableDeps.current);
|
|
16
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { mod } from './CurveEditorPopover';
|
|
3
|
-
export var Outcome;
|
|
4
|
-
(function (Outcome) {
|
|
5
|
-
Outcome[Outcome["Handled"] = 1] = "Handled";
|
|
6
|
-
Outcome[Outcome["Passthrough"] = 0] = "Passthrough";
|
|
7
|
-
})(Outcome || (Outcome = {}));
|
|
8
|
-
export function useUIOptionGrid(options) {
|
|
9
|
-
// Helper functions for moving the highlight in the grid of presets
|
|
10
|
-
const [selectionIndex, setSelectionIndex] = useState(null);
|
|
11
|
-
const moveCursorVertical = (vdir) => {
|
|
12
|
-
if (selectionIndex === null) {
|
|
13
|
-
if (options.items.length > 0) {
|
|
14
|
-
// start at the top first one
|
|
15
|
-
setSelectionIndex(0);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// no items
|
|
19
|
-
}
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const nextSelectionIndex = selectionIndex + vdir * options.uiColumns;
|
|
23
|
-
const exitsTop = nextSelectionIndex < 0;
|
|
24
|
-
const exitsBottom = nextSelectionIndex > options.items.length - 1;
|
|
25
|
-
if (exitsTop || exitsBottom) {
|
|
26
|
-
// up and out
|
|
27
|
-
if (options.canVerticleExit) {
|
|
28
|
-
if (options.canVerticleExit(exitsTop ? 'top' : 'bottom')) {
|
|
29
|
-
// exited and handled
|
|
30
|
-
setSelectionIndex(null);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// block the cursor from leaving (don't do anything)
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
// we know this highlight is in bounds now
|
|
38
|
-
setSelectionIndex(nextSelectionIndex);
|
|
39
|
-
};
|
|
40
|
-
const moveCursorHorizontal = (hdir) => {
|
|
41
|
-
if (selectionIndex === null)
|
|
42
|
-
setSelectionIndex(mod(hdir, options.items.length));
|
|
43
|
-
else if (selectionIndex + hdir < 0) {
|
|
44
|
-
// Don't exit top on potentially a left arrow, bc that might feel like I should be able to exit right on right arrow.
|
|
45
|
-
// Also, maybe cursor selection management in inputs is *lame*.
|
|
46
|
-
setSelectionIndex(null);
|
|
47
|
-
}
|
|
48
|
-
else
|
|
49
|
-
setSelectionIndex(Math.min(selectionIndex + hdir, options.items.length - 1));
|
|
50
|
-
};
|
|
51
|
-
const onParentKeydown = (e) => {
|
|
52
|
-
if (e.key === 'ArrowRight')
|
|
53
|
-
moveCursorHorizontal(1);
|
|
54
|
-
else if (e.key === 'ArrowLeft')
|
|
55
|
-
moveCursorHorizontal(-1);
|
|
56
|
-
else if (e.key === 'ArrowUp')
|
|
57
|
-
moveCursorVertical(-1);
|
|
58
|
-
else if (e.key === 'ArrowDown')
|
|
59
|
-
moveCursorVertical(1);
|
|
60
|
-
else
|
|
61
|
-
return Outcome.Passthrough; // so sorry, plz make this not terrible
|
|
62
|
-
return Outcome.Handled;
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
focusFirstItem() {
|
|
66
|
-
setSelectionIndex(0);
|
|
67
|
-
},
|
|
68
|
-
onParentEltKeyDown: onParentKeydown,
|
|
69
|
-
gridItems: options.items.map((item, idx) => options.renderItem({
|
|
70
|
-
isSelected: idx === selectionIndex,
|
|
71
|
-
item,
|
|
72
|
-
select(e) {
|
|
73
|
-
setSelectionIndex(idx);
|
|
74
|
-
if (options.onSelectItem(item) === Outcome.Handled) {
|
|
75
|
-
e?.preventDefault();
|
|
76
|
-
e?.stopPropagation();
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
})),
|
|
80
|
-
currentSelection: options.items[selectionIndex ?? -1] ?? null,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { simplePropEditorByPropType } from '@tomorrowevening/theatre-studio/propEditors/simpleEditors/simplePropEditorByPropType';
|
|
4
|
-
import last from 'lodash-es/last';
|
|
5
|
-
import { useTempTransactionEditingTools } from './useTempTransactionEditingTools';
|
|
6
|
-
import { valueInProp } from '@tomorrowevening/theatre-shared/propTypes/utils';
|
|
7
|
-
const SingleKeyframePropEditorContainer = styled.div `
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: stretch;
|
|
10
|
-
min-width: 200px;
|
|
11
|
-
|
|
12
|
-
select {
|
|
13
|
-
min-width: 100px;
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
const SingleKeyframePropLabel = styled.div `
|
|
17
|
-
font-style: normal;
|
|
18
|
-
font-weight: 400;
|
|
19
|
-
font-size: 11px;
|
|
20
|
-
line-height: 13px;
|
|
21
|
-
letter-spacing: 0.01em;
|
|
22
|
-
padding: 6px 6px 6px 0;
|
|
23
|
-
|
|
24
|
-
width: 40%;
|
|
25
|
-
|
|
26
|
-
color: #919191;
|
|
27
|
-
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
`;
|
|
30
|
-
const INDENT_PX = 10;
|
|
31
|
-
/**
|
|
32
|
-
* Given a propConfig, this function gives the corresponding prop editor for
|
|
33
|
-
* use in the dope sheet inline prop editor on a keyframe.
|
|
34
|
-
* {@link DeterminePropEditorForDetail} does the same thing for the details panel. The main difference
|
|
35
|
-
* between this function and {@link DeterminePropEditorForDetail} is that this
|
|
36
|
-
* one shows prop editors *without* keyframe navigation controls (that look
|
|
37
|
-
* like `< ・ >`).
|
|
38
|
-
*
|
|
39
|
-
* @param p - propConfig object for any type of prop.
|
|
40
|
-
*/
|
|
41
|
-
export function DeterminePropEditorForKeyframeTree(p) {
|
|
42
|
-
if (p.type === 'sheetObject') {
|
|
43
|
-
return (React.createElement(React.Fragment, null,
|
|
44
|
-
React.createElement(SingleKeyframePropLabel, { style: { paddingLeft: `${p.indent * INDENT_PX}px` } }, p.sheetObject.address.objectKey),
|
|
45
|
-
p.children.map((c, i) => (React.createElement(DeterminePropEditorForKeyframeTree, { key: i, ...c, autoFocusInput: p.autoFocusInput && i === 0, indent: p.indent + 1 })))));
|
|
46
|
-
}
|
|
47
|
-
else if (p.type === 'propWithChildren') {
|
|
48
|
-
const label = p.propConfig.label ?? last(p.pathToProp);
|
|
49
|
-
return (React.createElement(React.Fragment, null,
|
|
50
|
-
React.createElement(SingleKeyframePropLabel, { style: { paddingLeft: `${p.indent * INDENT_PX}px` } }, label),
|
|
51
|
-
p.children.map((c, i) => (React.createElement(DeterminePropEditorForKeyframeTree, { key: i, ...c, autoFocusInput: p.autoFocusInput && i === 0, indent: p.indent + 1 })))));
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return (React.createElement(PrimitivePropEditor, { ...p, autoFocusInput: p.autoFocusInput, indent: p.indent }));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const SingleKeyframeSimplePropEditorContainer = styled.div `
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
width: 60%;
|
|
61
|
-
`;
|
|
62
|
-
function PrimitivePropEditor(p) {
|
|
63
|
-
const label = p.propConfig.label ?? last(p.pathToProp);
|
|
64
|
-
const editingTools = useEditingToolsForKeyframeEditorPopover(p);
|
|
65
|
-
if (p.propConfig.type === 'enum') {
|
|
66
|
-
// notice: enums are not implemented, yet.
|
|
67
|
-
return React.createElement(React.Fragment, null);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const PropEditor = simplePropEditorByPropType[p.propConfig.type];
|
|
71
|
-
return (React.createElement(SingleKeyframePropEditorContainer, null,
|
|
72
|
-
React.createElement(SingleKeyframePropLabel, null,
|
|
73
|
-
React.createElement("span", { style: { paddingLeft: `${p.indent * INDENT_PX}px` } }, label)),
|
|
74
|
-
React.createElement(SingleKeyframeSimplePropEditorContainer, null,
|
|
75
|
-
React.createElement(PropEditor, { editingTools: editingTools, propConfig: p.propConfig, value: valueInProp(p.keyframe.value, p.propConfig), autoFocus: p.autoFocusInput }))));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// These editing tools are distinct from the editing tools used in the
|
|
79
|
-
// prop editors in the details panel: These editing tools edit the value of a keyframe
|
|
80
|
-
// while the details editing tools edit the value of the sequence at the playhead
|
|
81
|
-
// (potentially creating a new keyframe).
|
|
82
|
-
function useEditingToolsForKeyframeEditorPopover(props) {
|
|
83
|
-
const obj = props.sheetObject;
|
|
84
|
-
return useTempTransactionEditingTools(({ stateEditors }, value) => {
|
|
85
|
-
const newKeyframe = { ...props.keyframe, value };
|
|
86
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
|
|
87
|
-
...obj.address,
|
|
88
|
-
trackId: props.trackId,
|
|
89
|
-
keyframes: [newKeyframe],
|
|
90
|
-
snappingFunction: obj.sheet.getSequence().closestGridPosition,
|
|
91
|
-
});
|
|
92
|
-
}, obj);
|
|
93
|
-
}
|