geojs icon indicating copy to clipboard operation
geojs copied to clipboard

Support entering creation mode with a partial shape

Open subdavis opened this issue 3 years ago • 1 comments

For example, instead of starting creation at the beginning, start with some number of points already placed.

annotationLayer.mode('line', { type: 'LineString', coordinates: [100, 100] })

This would put the annotation layer in creation mode with 1 point already dropped, ready to place the second.

I think this is generally applicable to line, rectangle, and polygon. It should probably throw and error if you try it with a point.

If a maintainer is willing to accept that or a similar API, I could attempt to implement. This would not be a breaking change.

The work around you be to switch to create mode, then immediately modify the currentAnnotation.

https://github.com/OpenGeoscience/geojs/blob/42d1d39adb0261b45e04f8a95af43d840efbfd60/src/annotationLayer.js#L543-L552

Looks like there are options to try before we make an official attempt.

subdavis avatar Sep 03 '20 17:09 subdavis

Currently, the second parameter is an annotation. If we accept an annotation on create, then we could start with that annotation but in create mode rather than edit mode.

If we accept geoJSON there, this would be functionally the same as adding annotations as geojson and using the last such annotation as part of the creation process.

manthey avatar Sep 03 '20 17:09 manthey