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,8 +69,11 @@ const Connector: React.FC<IProps> = (props) => {
|
||||||
items: () => {
|
items: () => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: 'Delete',
|
label: props.selection ? 'Delete Selection' : 'Delete both Keyframes',
|
||||||
callback: () => {
|
callback: () => {
|
||||||
|
if (props.selection) {
|
||||||
|
props.selection.delete()
|
||||||
|
} else {
|
||||||
getStudio()!.transaction(({stateEditors}) => {
|
getStudio()!.transaction(({stateEditors}) => {
|
||||||
stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes(
|
stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes(
|
||||||
{
|
{
|
||||||
|
@ -80,6 +83,7 @@ const Connector: React.FC<IProps> = (props) => {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -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