daybrush / scena

🎬 Scena is a component that represents the timeline of Scene.js. You can control time, properties, and items.
https://daybrush.com/scena
MIT License
855 stars 74 forks source link

How to add onSelect event listener? #12

Open StringKe opened 3 years ago

StringKe commented 3 years ago

Thank you for providing great open source components. I encountered some errors while trying to customize some functions. Can you tell me how to solve the errors?

https://github.com/daybrush/scena/blob/master/packages/react-editor/src/Editor/Editor.tsx#L274

Editor will pass selectedTargets to moveable property target in MoveableManager,I tried to add an event, but the Selecto component generates an error.

onScroll={({ direction }) => {
  infiniteViewer.current?.scrollBy(
    direction[0] * 10,
    direction[1] * 10
  );
}}
onSelect={(e) => {
  this.setState({
    selectedTargets: e.selected,
  });
}}

image

StringKe commented 3 years ago

@daybrush Can you check this error? Thank you

StringKe commented 3 years ago

https://github.com/daybrush/dragscroll/blob/master/src/DragScroll.ts#L53

If add selectedTargets to targets in moveable, startRect in DragScroll is always empty.