Skip to content

Support entering creation mode with a partial shape #1067

@subdavis

Description

@subdavis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions