hackerwins / codepair-old

Real-time markdown editor for interviews, meetings and more...
https://codepair.yorkie.dev
Apache License 2.0
90 stars 29 forks source link

Usage of presence canvas for drawing shapes #220

Closed hunkim98 closed 1 year ago

hunkim98 commented 1 year ago

What this PR does / why we need it?

I have changed how users draw shapes by using presence canvas(=upper canvas)

If a user starts drawing a shape, instead of updating the shape to the document directly, I have made the shape be updated to user's presence instead. The shapes drawn in the user's presence is drawn on the upper canvas.

As soon as the user finishes drawing(mouse up or mouse out), the shape in the presence is transmitted to the document directly. To lessen the burden of the document storing unnecessarily many points, I have called compressPoints at that moment, thus reducing the amount of data stored in the document.

Any background context you want to provide?

The usage of presence canvas for drawing on canvas is also used in Toonie. The implementation of the drawing methods is quite similar to toonie

What are the relevant tickets?

Fixes #

Checklist

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

hackerwins commented 1 year ago

Continue at #222.