Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use "check point" events? #18

Closed
iSunRise opened this issue May 20, 2020 · 3 comments
Closed

How to use "check point" events? #18

iSunRise opened this issue May 20, 2020 · 3 comments

Comments

@iSunRise
Copy link

Hello,

Thank you for amazing library.

I'm wondering, is there a way to add new history record only after specific event is dispatched?

For example, I'm dragging some element and update its position on each mouse move, however, I don't want all those position to appear in history. Instead I want to commit only after "drag end", so I have only final positions in history.

P.S. After typing this message, I reviewed the source code and found out that history records are created on "@Changed" event unless the updates are filtered.

Would you consider to extend the library?

Thanks

@polemius
Copy link
Member

@iSunRise

Hello 👋

I'm happy that you like this library.

If for example you will have the parameters in function createHistory to exclude some events, it can help you?

I'm dragging some element and update its position on each mouse move
Instead I want to commit only after "drag end", so I have only final positions in history.

What if you will store each mouse move position in localstate of component and only store final position when drag ends? It will be possible to implement?

@iSunRise
Copy link
Author

hi @polemius,

What if you will store each mouse move position in localstate of component and only store final position when drag ends? It will be possible to implement?

Yes, it is probably the easiest and performant solution, but it works only if other components don't have to be aware of my draggable component temporary position.

If for example you will have the parameters in function createHistory to exclude some events, it can help you?

I think that "filter events/exclude events" params would bring much more flexibility, however, I've made my own solution to handle my needs already.

Thank you for the quick response, the issue may be closed now.

@polemius
Copy link
Member

polemius commented May 21, 2020

Hello @iSunRise,

I see. Thank you for response. I've create separate issue for this #19 if you want fell free to open PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants