antfu / drauu

Headless SVG-based drawboard in browser.
https://drauu.netlify.app/
MIT License
1.2k stars 64 forks source link

[Feature] Listen canRedo / canUndo with Vue #20

Closed ycs77 closed 2 years ago

ycs77 commented 2 years ago

I want listen canUndo / canRedo status in vue, but the _undoStack is not reactive in drauu.

This is simple:

Playground: https://stackblitz.com/edit/vitejs-vite-fqw3a1?file=src%2FApp.vue

I think has two solutions:

  1. change internal variable _undoStack to reactive
  2. export an event API for listen to mouse draw end, and for me to update the canUndo / canRedo status

Or if you have any other best solution?

Can you add this feature?

ycs77 commented 2 years ago

@antfu

antfu commented 2 years ago

https://github.com/slidevjs/slidev/blob/4eb284cded5af5d24580f265341c3e551463bc8c/packages/client/logic/drawings.ts#L82-L83