mobile-sdk icon indicating copy to clipboard operation
mobile-sdk copied to clipboard

Support object selected state for vector tiles

Open jaakla opened this issue 7 years ago • 4 comments

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)

jaakla avatar Jul 22 '16 07:07 jaakla

#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.

jaakla avatar Sep 16 '16 09:09 jaakla

Should discuss it together with rest of CartoCSS extensions

mtehver avatar Oct 19 '16 08:10 mtehver

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.

jaakla avatar Dec 22 '16 08:12 jaakla

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);
}

mtehver avatar Dec 22 '16 09:12 mtehver