mobile-sdk
mobile-sdk copied to clipboard
Support object selected state for vector tiles
Add API to control state of selected elements in vector layers. SDK tracks object ID-s which are selected or not, and renders them accordingly. Methods like addSelectedObject() removeSelectedObject(), getSelectedObjects().
CartoCSS style decoder should enable to set different style for selected elements with special term ::active
(similar to ::hover)
#35 covers main use case here: enables to add new object for clicked location. Query and display as "selected" of objects by ID (from a list or search result for example) or by given coordinate is not yet possible there.
Should discuss it together with rest of CartoCSS extensions
Another use case for this would be in editable layer - click on a point (or another object), highlight it, then can add also context-sensitive button(s) next to the object like in ID OSM editor, or in corner of map view: delete, copy, edit details/attributes. For lines/polygons also individual vertex could be selected, so this way vertexes can be deleted.
A small sample how this use case can be achieved with existing extensions:
#layer {
line-width: 2;
}
#layer::active {
line-width: 4;
line-opacity: ([osm_id] = [nuti::selected_id] ? 0.5 : 0);
}