Implemented "Delete Selection" on Connectors' context menu
This commit is contained in:
parent
d46e0bfd2f
commit
30c6b44cad
1 changed files with 19 additions and 11 deletions
|
@ -69,17 +69,21 @@ const Connector: React.FC<IProps> = (props) => {
|
||||||
items: () => {
|
items: () => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Delete',
|
label: props.selection ? 'Delete Selection' : 'Delete both Keyframes',
|
||||||
callback: () => {
|
callback: () => {
|
||||||
getStudio()!.transaction(({stateEditors}) => {
|
if (props.selection) {
|
||||||
stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes(
|
props.selection.delete()
|
||||||
{
|
} else {
|
||||||
...props.leaf.sheetObject.address,
|
getStudio()!.transaction(({stateEditors}) => {
|
||||||
keyframeIds: [cur.id, next.id],
|
stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes(
|
||||||
trackId: props.leaf.trackId,
|
{
|
||||||
},
|
...props.leaf.sheetObject.address,
|
||||||
)
|
keyframeIds: [cur.id, next.id],
|
||||||
})
|
trackId: props.leaf.trackId,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -94,14 +98,18 @@ const Connector: React.FC<IProps> = (props) => {
|
||||||
ref={nodeRef}
|
ref={nodeRef}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
if (event.button !== 0) return
|
if (event.button !== 0) return
|
||||||
|
|
||||||
|
// @todo Put this in the context menu
|
||||||
|
|
||||||
const orig = JSON.stringify([
|
const orig = JSON.stringify([
|
||||||
cur.handles[2],
|
cur.handles[2],
|
||||||
cur.handles[3],
|
cur.handles[3],
|
||||||
next.handles[0],
|
next.handles[0],
|
||||||
next.handles[1],
|
next.handles[1],
|
||||||
])
|
])
|
||||||
const modifiedS = window.prompt('As cubic-bezier()', orig)
|
const modifiedS = orig // window.prompt('As cubic-bezier()', orig)
|
||||||
if (modifiedS && modifiedS !== orig) {
|
if (modifiedS && modifiedS !== orig) {
|
||||||
|
return
|
||||||
const modified = JSON.parse(modifiedS)
|
const modified = JSON.parse(modifiedS)
|
||||||
getStudio()!.transaction(({stateEditors}) => {
|
getStudio()!.transaction(({stateEditors}) => {
|
||||||
const {replaceKeyframes} =
|
const {replaceKeyframes} =
|
||||||
|
|
Loading…
Reference in a new issue