You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
GL-Native's separation of Style/Render-Style classes requires that the feature state APIs sync changes to the state across threads on platforms that implement async rendering. The port will be more complicated than the SourceCache based implementation in gl-js.
Native SDKs will need to expose feature state APIs on top of the core implementation, and support the feature-state expressions.
Native SDKs will need to expose feature state APIs on top of the core implementation, and support the feature-state expressions.
For the iOS/macOS API, ideally the getter and setter would be added to MGLVectorTileSource, MGLShapeSource, and MGLComputedShapeSource. That would reduce the number of parameters needed for the setter.
Can the setter accept an MGLFeature returned from a feature querying method? Those features currently lack context such as the containing style layer or source layer: #7162. The GL JS implementation also accepts a “feature identifier” object containing a source, sourceLayer, and id, which would imply a method like -[MGLVectorTileSource setState:forFeatureWithIdentifier:sourceLayerIdentifier:].
The setter can accept a whole dictionary as state, which is quite unlike most state properties in Cocoa libraries that are typed as enumerations. The closest Cocoa analogy to the concept of “feature state” that I can think of would be the context parameter of -[NSExpression expressionValueWithObject:context:], which is associated with the variable syntax in NSExpression format strings. However, we’ve already repurposed that variable syntax for expression variables and for certain special expressions like $featureIdentifier.
@1ec5 I opened #11846 previously to add more context to features returned from the querying methods. If that context can be added to MGLFeature in some way, then that can be the input for the setState: method.
Any progress or planning/estimate for this feature? I hope this can be ported to iOS / Android as it is a really nice way to style selection states on top of external data.
Hi, another seven months passed, would you be able to give us some insight into your roadmap for this, please? This feature would make things so much easier on mobile!
Public API for Android implementation of MapboxMap#setFeatureState:
/** * Update the state map of a feature within a style source. * * Update entries in the state map of a given feature within a style source. Only entries listed in the * \p state map will be updated. An entry in the feature state map that is not listed in \p state will * retain its previous value. * * Note that updates to feature state are asynchronous, so changes made by this method migth not be * immediately visible using getStateFeature(). * * @param sourceId Style source identifier. * @param sourceLayerId Style source layer identifier (for multi-layer sources such as vector sources). * @param featureId Identifier of the feature whose state should be updated. * @param state Map of entries to update with their respective new values.*/funsetFeatureState(
sourceId:String,
sourceLayerId:String?,
featureId:String,
state:Value
)
on iOS it's availlable as mapView.__map.setFeatureState(..)
Activity
1ec5 commentedon Jul 18, 2018
For the iOS/macOS API, ideally the getter and setter would be added to MGLVectorTileSource, MGLShapeSource, and MGLComputedShapeSource. That would reduce the number of parameters needed for the setter.
Can the setter accept an MGLFeature returned from a feature querying method? Those features currently lack context such as the containing style layer or source layer: #7162. The GL JS implementation also accepts a “feature identifier” object containing a
source,sourceLayer, andid, which would imply a method like-[MGLVectorTileSource setState:forFeatureWithIdentifier:sourceLayerIdentifier:].The setter can accept a whole dictionary as state, which is quite unlike most
stateproperties in Cocoa libraries that are typed as enumerations. The closest Cocoa analogy to the concept of “feature state” that I can think of would be thecontextparameter of-[NSExpression expressionValueWithObject:context:], which is associated with the variable syntax in NSExpression format strings. However, we’ve already repurposed that variable syntax for expression variables and for certain special expressions like$featureIdentifier./cc @fabian-guerra
asheemmamoowala commentedon Jul 18, 2018
@1ec5 I opened #11846 previously to add more context to features returned from the querying methods. If that context can be added to
MGLFeaturein some way, then that can be the input for thesetState:method.guyinn commentedon Aug 2, 2018
@jfirebaugh any eta on this?
cammanderson commentedon Sep 26, 2018
Looking forward to this one as well!
john-x-u commentedon Mar 4, 2019
Hey Mapbox folks – Is there an updated ETA on this?
tmpsantos commentedon Mar 26, 2019
Hi @JohnnyUX, we are working on reducing the gap between GL Native and GL JS (https://github.com/mapbox/mapbox-gl-native/blob/master/platform/node/test/ignores.json) but this is not the highest priority ATM because normally the use case has to do with hover a cursor over the feature which is not so common on mobile.
8 remaining items
jmalanen commentedon Sep 4, 2019
Adding a screenshot of feature state demo on mbgl-glfw app. The demo implements the same hover effect as this GL-JS example.
tobrun commentedon Sep 9, 2019
Assigning @tarigo for the android bindings
jmalanen commentedon Sep 18, 2019
The core part has now been merged (PR #15480).
mattijsf commentedon May 7, 2020
Any progress or planning/estimate for this feature? I hope this can be ported to iOS / Android as it is a really nice way to style selection states on top of external data.
LocusLabsGit commentedon Aug 17, 2020
It's been two years since this request was filed. Can we get an update?
sedot42 commentedon Mar 29, 2021
Hi, another seven months passed, would you be able to give us some insight into your roadmap for this, please? This feature would make things so much easier on mobile!
tobrun commentedon Mar 29, 2021
This feature is available on the v10.0.0 of the mobile SDKs:
Public API for Android implementation of
MapboxMap#setFeatureState:on iOS it's availlable as
mapView.__map.setFeatureState(..)