Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLeftLayers adds layers to the right pane #53

Open
sefo opened this issue Jul 6, 2023 · 1 comment
Open

setLeftLayers adds layers to the right pane #53

sefo opened this issue Jul 6, 2023 · 1 comment

Comments

@sefo
Copy link

sefo commented Jul 6, 2023

@gmaclennan

I've updated the lib so that getContainer is replaced by getPane (leaflet 1.9)

const sbs = L.control.sideBySide([], []).addTo(this.map);
const layer1 = L.geoJSON(MYGEOJSONOBJECT01, { style: { color: 'green', weight: 2, opacity: 1 } }).addTo(this.map);
const layer2 = L.geoJSON(MYGEOJSONOBJECT02, { style: { color: 'red', weight: 2, opacity: 1 } }).addTo(this.map);
sbs.setLeftLayers(layer1);
sbs.setRightLayers(layer2);

Both layers are on the right pane...

I've tried setting them up directly in the sideBySide() function for the same result.

EDIT: setxxxLayers individually work, but not both at the same time. So I either get left pane working with blank right pane or the other way around.

@sefo
Copy link
Author

sefo commented Jul 6, 2023

It's not documented anywhere but I had to create 2 panes on the map:

        this.map.createPane('left');
        this.map.createPane('right');

Then assign my geojson data to either one:

const layer = L.geoJSON(map, { style: { color, weight: 2, opacity: 1 }, pane: 'left' }).addTo(this.map);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant