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

Custom mode documentation excludes key information regarding 'active' and 'inactive' states of drawn features #1305

Open
dh-jburke opened this issue Oct 22, 2024 · 1 comment

Comments

@dh-jburke
Copy link

I've just lot quite a bit of time for something that could be better explained within the Custom Mode documentation.

I've created a custom mode for drawing nodes and lines, and I wanted the "active" styling that is used in the pre-determined modes to be usable as well.

The documentation mentions that using this.select will control which features are selected, which does work internally, but does not control the 'active' state on the drawn features. I had to dig through the un-minified MapDraw file to discover that the 'active' state is actually to be controlled manually within the toDisplayFeatures, like so:

DrawLineMode.toDisplayFeatures = function(state, geojson, display) {
    geojson.properties.active = !!this.isSelected(geojson.properties.id) + '';
    display(geojson);
};

It's a simple bit of code obviously, however the documentation could do with a note that the active property in the drawn GeoJSON is to be manually controlled within the custom mode, and isn't actually related to the selected states.

@Quietly-20201113
Copy link

How can I use js externally to set a point in a line to an active state?

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

3 participants
@Quietly-20201113 @dh-jburke and others