Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support entering creation mode with a partial shape #1067

Open
subdavis opened this issue Sep 3, 2020 · 1 comment
Open

Support entering creation mode with a partial shape #1067

subdavis opened this issue Sep 3, 2020 · 1 comment

Comments

@subdavis
Copy link

subdavis commented Sep 3, 2020

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.

if (m_this.currentAnnotation) {
switch (m_this.currentAnnotation.state()) {
case geo_annotation.state.create:
m_this.removeAnnotation(m_this.currentAnnotation);
break;
case geo_annotation.state.edit:
m_this.currentAnnotation.state(geo_annotation.state.done);
m_this.modified();
m_this.draw();
break;

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

@manthey
Copy link
Contributor

manthey commented Sep 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants