I want to trigger events when the currentStyleInfo style layers settings change. I have attempted to do so using the reactiveUtils, but the changes are not being detected. How can I achieve this? Is it possible? This is in an angular application and I would rather apply the change and detect it through a trigger from the layer than firing something that doesn't include the layer as part of the detection process.
reactiveUtils.watch(
() =>
mapView.map.layers.map((layer) =>
(layer as NavigationLayer)?.currentStyleInfo?.style.layers.map(
(layer: any) => {
console.log('layer = ', `${layer.id} ${layer.layout.visibility}`);
return `${layer.id} ${layer.layout.visibility}`;
}
)
),
(newValue, oldValue) => {
console.table('oldValue', oldValue.toArray());
console.table('newValue', newValue.toArray());
}
);
I know I can get it to work for the regular layer level 'visible' which is great. Just seems for things within currentStyleInfo the changes do not propagate as watchable
reactiveUtils.watch(
() => mapView.map.layers.map((layer) => layer.visible),
(newValue, oldValue) => {
console.table(oldValue.toArray());
console.table(newValue.toArray());
}
);
Thank you all ahead of time.