ask for feature: add option to RControl.RLayers to make it non-collapsable. or is it already possible?
Hello
First: thank you for this great library. Very useful...
I would like to have the RControl.RLayers control expanded all the time. is it already possible with the current code( or with css change)? If not does it make sense to make a modif to pass some option like 'collapsable: true/false'?
Then as I some time I struggle a lot to find how to do use some component(and then maybe I use it in not the best way), is it possible to contact you directly (without abusing of your time of course). Or is there some discussion group or equivalent somewhere?
Thanks
best regards
Gilles ([email protected])
You can submit a PR, but otherwise you can simply pass an empty element for the collapse button and then manually click it once at initialization:
const ref = React.useRef<RControl.RLayers>(null);
React.useEffect(() => {
if (ref.current) ref.current.clickCollapse();
}, [ref.current]);
return <RControl.RLayers ref={ref} element={<span />} />;
Hello
Thanks, it is working. The only drawback I see is that it trigger a re-render of the map. And so I have a refresh related question: I see two rendering of the RMAP component, usingminimum RMAP structure: single layer <ROSM> inside it or even RMAP with no children.
( I am trying to figure out what trigger a map re-render (i.e. is it normal or is my code broken), like adding features inside a RLayerVector... )
Can you post your code?
Hello
I have another question on the layer control component: if it contains just one layer, by default the layer is selected and visible, perfect, But what if I want to hide this layer? Deselecting it is not possible, do you have some code that can do this when the used click on the layer checkbox?
In my case I have 2 Rcontrol.Rlayer in my app: one for base maps + one for imagery layer(s) on top of the base map. I may have just one imagery layer, and I need in any case to have a show/hide capability on the imagery layer(s). ( I also thought of adding a 'empty' layer in the control, which would probably solve my problem)
Thanks for any info.
You can set visible={false} on the layer