please, click on diamond to enable sequenced
This commit is contained in:
parent
8d7a3007e2
commit
938568037a
3 changed files with 65 additions and 45 deletions
|
@ -46,11 +46,15 @@ const FilledIcon = styled.div`
|
|||
border: 1px solid grey;
|
||||
`
|
||||
|
||||
const DefaultOrStaticValueIndicator: React.FC<{hasStaticOverride: boolean}> = (
|
||||
props,
|
||||
) => {
|
||||
const DefaultOrStaticValueIndicator: React.FC<{
|
||||
hasStaticOverride: boolean
|
||||
callbackPlease: () => void
|
||||
}> = (props) => {
|
||||
const whoopsy = (lol: any) => {
|
||||
props.callbackPlease()
|
||||
}
|
||||
return (
|
||||
<Container hasStaticOverride={props.hasStaticOverride}>
|
||||
<Container hasStaticOverride={props.hasStaticOverride} onClick={whoopsy}>
|
||||
{props.hasStaticOverride ? (
|
||||
<FilledIcon title="The default value is overridden" />
|
||||
) : (
|
||||
|
|
|
@ -65,7 +65,12 @@ export function useEditingToolsForCompoundProp<T extends SerializablePrimitive>(
|
|||
beingScrubbed: false,
|
||||
contextMenuItems: [],
|
||||
controlIndicators: (
|
||||
<DefaultOrStaticValueIndicator hasStaticOverride={false} />
|
||||
<DefaultOrStaticValueIndicator
|
||||
hasStaticOverride={false}
|
||||
callbackPlease={() => {
|
||||
console.log('nothing to do')
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -171,18 +176,9 @@ export function useEditingToolsForCompoundProp<T extends SerializablePrimitive>(
|
|||
})
|
||||
}
|
||||
|
||||
if (
|
||||
!hasOneOrMoreSequencedTracks ||
|
||||
(hasOneOrMoreSequencedTracks && hasStatics)
|
||||
) {
|
||||
contextMenuItems.push({
|
||||
label: 'Sequence all',
|
||||
callback: () => {
|
||||
const makeThisPropSequencedPlease = () => {
|
||||
getStudio()!.transaction(({stateEditors}) => {
|
||||
for (const {path, conf} of iteratePropType(
|
||||
propConfig,
|
||||
pathToProp,
|
||||
)) {
|
||||
for (const {path, conf} of iteratePropType(propConfig, pathToProp)) {
|
||||
if (isPropConfigComposite(conf)) continue
|
||||
const propAddress = {...obj.address, pathToProp: path}
|
||||
|
||||
|
@ -192,7 +188,14 @@ export function useEditingToolsForCompoundProp<T extends SerializablePrimitive>(
|
|||
)
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
if (
|
||||
!hasOneOrMoreSequencedTracks ||
|
||||
(hasOneOrMoreSequencedTracks && hasStatics)
|
||||
) {
|
||||
contextMenuItems.push({
|
||||
label: 'Sequence all',
|
||||
callback: makeThisPropSequencedPlease,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -224,7 +227,10 @@ export function useEditingToolsForCompoundProp<T extends SerializablePrimitive>(
|
|||
...common,
|
||||
type: 'AllStatic',
|
||||
controlIndicators: (
|
||||
<DefaultOrStaticValueIndicator hasStaticOverride={hasStatics} />
|
||||
<DefaultOrStaticValueIndicator
|
||||
hasStaticOverride={hasStatics}
|
||||
callbackPlease={makeThisPropSequencedPlease}
|
||||
/>
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,10 +155,7 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
|
||||
const isSequenced = typeof possibleSequenceTrackId === 'string'
|
||||
|
||||
if (isSequenced) {
|
||||
contextMenuItems.push({
|
||||
label: 'Make static',
|
||||
callback: () => {
|
||||
const makeThisPropStaticPlease = () => {
|
||||
getStudio()!.transaction(({stateEditors}) => {
|
||||
const propAddress = {...obj.address, pathToProp}
|
||||
stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsStatic(
|
||||
|
@ -168,7 +165,12 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
},
|
||||
)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
if (isSequenced) {
|
||||
contextMenuItems.push({
|
||||
label: 'Make static',
|
||||
callback: makeThisPropStaticPlease,
|
||||
})
|
||||
|
||||
const sequenceTrackId = possibleSequenceTrackId as SequenceTrackId
|
||||
|
@ -287,11 +289,8 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
})
|
||||
}
|
||||
|
||||
if (isSequencable) {
|
||||
contextMenuItems.push({
|
||||
label: 'Sequence',
|
||||
callback: () => {
|
||||
getStudio()!.transaction(({stateEditors}) => {
|
||||
const makeThisPropSequencedPlease = () => {
|
||||
getStudio()!.transaction(({stateEditors, set}) => {
|
||||
const propAddress = {...obj.address, pathToProp}
|
||||
|
||||
stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced(
|
||||
|
@ -299,7 +298,12 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
propConfig,
|
||||
)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
if (isSequencable) {
|
||||
contextMenuItems.push({
|
||||
label: 'Sequence',
|
||||
callback: makeThisPropSequencedPlease,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -309,7 +313,10 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
type: 'Static',
|
||||
shade: common.beingScrubbed ? 'Static_BeingScrubbed' : 'Static',
|
||||
controlIndicators: (
|
||||
<DefaultOrStaticValueIndicator hasStaticOverride={true} />
|
||||
<DefaultOrStaticValueIndicator
|
||||
hasStaticOverride={true}
|
||||
callbackPlease={makeThisPropSequencedPlease}
|
||||
/>
|
||||
),
|
||||
}
|
||||
return ret
|
||||
|
@ -320,7 +327,10 @@ function createPrism<T extends SerializablePrimitive>(
|
|||
type: 'Default',
|
||||
shade: 'Default',
|
||||
controlIndicators: (
|
||||
<DefaultOrStaticValueIndicator hasStaticOverride={false} />
|
||||
<DefaultOrStaticValueIndicator
|
||||
hasStaticOverride={false}
|
||||
callbackPlease={makeThisPropSequencedPlease}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue