dilidili / react-drawing-board

demo
https://react-drawing-board-demo.dilidili.now.sh
MIT License
68 stars 21 forks source link

Notify when zoom changes, Feature Request #5

Closed vjkrishna21 closed 3 years ago

vjkrishna21 commented 3 years ago

Hey,

I am trying to build a shared drawing board. Currently, I am facing an issue with shared zoom because no event is fired when zoom is changed. Is it possible to trigger an event when zoom is changed?

Thank you!

dilidili commented 3 years ago

@vjkrishna21 i could provide controlled viewMatrix related props. It contains translate and scale actions, is it enough?

vjkrishna21 commented 3 years ago

Actually, when I get the zoom change event, it is broadcasted to other participants viewing the drawing board. Whatever value that you'll be providing, will be fed to the component again to change the zoom.

Example:

If you return the zoom% when the zoom changes, it will be broadcasted to other users. So, the component should accept a prop for zoom%.

dilidili commented 3 years ago

Actually, when I get the zoom change event, it is broadcasted to other participants viewing the drawing board. Whatever value that you'll be providing, will be fed to the component again to change the zoom.

Example:

If you return the zoom% when the zoom changes, it will be broadcasted to other users. So, the component should accept a prop for zoom%.

OK, got it. I'll add it soon later.

dilidili commented 3 years ago

@vjkrishna21 I've expose viewMatrix and onViewMatrixChange props, you can use them to control the perspective on version 0.3.4.