This commit is contained in:
Aria Minaei 2021-09-17 17:23:56 +02:00
parent 4eaba1e8d5
commit af336a0a82
4 changed files with 11 additions and 6 deletions

View file

@ -181,6 +181,7 @@ function useDragKeyframe(node: HTMLDivElement | null, props: IProps) {
pathToProp: leaf.pathToProp, pathToProp: leaf.pathToProp,
trackId: leaf.trackId, trackId: leaf.trackId,
keyframeId: props.keyframe.id, keyframeId: props.keyframe.id,
domNode: node!,
positionAtStartOfDrag: positionAtStartOfDrag:
props.trackData.keyframes[props.index].position, props.trackData.keyframes[props.index].position,
}) })

View file

@ -164,6 +164,7 @@ function useDragKeyframe(
pathToProp: leaf.pathToProp, pathToProp: leaf.pathToProp,
trackId: leaf.trackId, trackId: leaf.trackId,
keyframeId: props.keyframe.id, keyframeId: props.keyframe.id,
domNode: node!,
positionAtStartOfDrag: positionAtStartOfDrag:
props.trackData.keyframes[props.index].position, props.trackData.keyframes[props.index].position,
}) })

View file

@ -212,10 +212,12 @@ namespace utils {
tempTransaction = undefined tempTransaction = undefined
} }
const snapTarget = event.composedPath().find( const snapTarget = event
.composedPath()
.find(
(el): el is Element => (el): el is Element =>
el instanceof Element && el instanceof Element &&
// el !== node && el !== origin.domNode &&
el.hasAttribute('data-pos'), el.hasAttribute('data-pos'),
) )

View file

@ -56,6 +56,7 @@ export type DopeSheetSelection = {
trackId: string trackId: string
keyframeId: string keyframeId: string
positionAtStartOfDrag: number positionAtStartOfDrag: number
domNode: Element
}, },
): Parameters<typeof useDrag>[1] ): Parameters<typeof useDrag>[1]
delete(): void delete(): void