leaflet-geoman icon indicating copy to clipboard operation
leaflet-geoman copied to clipboard

Feature: Draw rectangles at angle, determined by a line.

Open strfx opened this issue 2 years ago β€’ 3 comments
trafficstars

Hi there!

I think it would be great to have a feature that lets users draw rectangles at an angle, based on a previously drawn line. I hacked together a proof of concept to demonstrate the idea:

example-rotated-rectangle

You can play around with the example in this JSFiddle: https://jsfiddle.net/n9kz4atx/24/.

What do you think? I'd be excited to work on a PR if this is something you'd like to have in geoman.

Thanks for the great work!

strfx avatar Mar 01 '23 16:03 strfx

Nice idea, but I don't know if we should implement it in the core code. I will discuss it with @codeofsumit

Falke-Design avatar Mar 10 '23 18:03 Falke-Design

@strfx this look great. I talked with @Falke-Design and we would appreciate a pull request that implements this as follows:

  1. Add a global option adjustRectAngleWhileDraw - default is false
  2. If set to true, the behavior shown in the GIF should be the default when in Draw Mode for Rectangles.

codeofsumit avatar Jun 04 '23 16:06 codeofsumit

thanks for the feedback @codeofsumit and @Falke-Design - approach sounds sensible! Will follow up with a PR soon.

strfx avatar Jun 07 '23 14:06 strfx