CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
186 stars 68 forks source link

Support object selected state for vector tiles #14

Open jaakla opened 8 years ago

jaakla commented 8 years ago

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 commented 8 years ago

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.

mtehver commented 8 years ago

Should discuss it together with rest of CartoCSS extensions

jaakla commented 7 years ago

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.

mtehver commented 7 years ago

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