freegroup / draw2d

Create Visio like drawings, diagrams or workflows with JavaScript and HTML5
https://freegroup.github.io/draw2d/#/examples
MIT License
738 stars 228 forks source link

Starting a line on mouse down. #158

Closed macmcclain closed 3 years ago

macmcclain commented 3 years ago

Do you already have an example of drawing a line on a canvas with mouse down? I began trying out a custom controller... but reviewing the samples that are available, I think that an edit policy or a canvas policy is in order. Just not sure.

Thank you for your help.

Examples:

  1. user picks the line element.

  2. user starts to draw a line.

  3. on complete I get a callback.

  4. user picks the polygon element

  5. user starts to draw a polygon.

  6. on complete I get a callback.

macmcclain commented 3 years ago

I was able to resolve this. There is a demo project at http://freegroup.github.io/draw2d_js.app.shape_designer/ that shows how to do this nicely.

Thanks for all the hard work on this project!