Implemented "Delete Selection" on Connectors' context menu

This commit is contained in:
Aria Minaei 2021-08-09 11:44:47 +02:00
parent d46e0bfd2f
commit 30c6b44cad

View file

@ -69,8 +69,11 @@ const Connector: React.FC<IProps> = (props) => {
items: () => {
return [
{
label: 'Delete',
label: props.selection ? 'Delete Selection' : 'Delete both Keyframes',
callback: () => {
if (props.selection) {
props.selection.delete()
} else {
getStudio()!.transaction(({stateEditors}) => {
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}
onClick={(event) => {
if (event.button !== 0) return
// @todo Put this in the context menu
const orig = JSON.stringify([
cur.handles[2],
cur.handles[3],
next.handles[0],
next.handles[1],
])
const modifiedS = window.prompt('As cubic-bezier()', orig)
const modifiedS = orig // window.prompt('As cubic-bezier()', orig)
if (modifiedS && modifiedS !== orig) {
return
const modified = JSON.parse(modifiedS)
getStudio()!.transaction(({stateEditors}) => {
const {replaceKeyframes} =