-1

In my web app, I'm currently allowing users to draw polygons on an apartment map (essentially outlining units). The map is uploaded by the user and drawn into the canvas. The user clicks to draw the shapes on the canvas, however, I need the ability to fill the shapes at a later time, so I redraw them with SVG. Essentially, I have a canvas overlaid with SVG images.

The functionality I need works fine, however, it feels gross. The coordinates are generated from the canvas, yet stored in the DB and redrawn as SVG. Is there a better way to do this? The whole setup feels dirty to me.

jbryant04
  • 49
  • 5

1 Answers1

0

You can draw the same shapes on canvas. Can keep the coordinates in db, also save the image uploaded by user, and later draw on canvas again. You can evan export base64 from canvas (shapes user have drawn along with image) and save in back end. I hope this helps.

Community
  • 1
  • 1
Artur Aleksanyan
  • 480
  • 5
  • 10