Git Product home page Git Product logo

Comments (6)

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

If you just want to use the Control.Layers.Tree, start it with the option collapsed: false.
Something like L.control.layers.tree(baseTree, null, {collapsed: false}).addTo(map);

If you want to create your own Control, you have to extend the the options with the default value.

from leaflet.control.layers.tree.

mpbotti avatar mpbotti commented on September 4, 2024

Thanks for your answer Javier. Sadly, the code does not works as it supposed to do it. I've typed it as you say, but have had no effect at all. I've also modified the .js file a little bit adding "collapsed: false" to the options statement but none of this make any change... Thanks anyway!
Regards, M.

from leaflet.control.layers.tree.

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

I did in this fiddle, and it works (a copy of basic.html, just adding this option)
https://jsfiddle.net/fkd7ecc9/
Could you show us an example?

from leaflet.control.layers.tree.

mpbotti avatar mpbotti commented on September 4, 2024

Hi Javier! Thanks for your answer, and my apologies for my late on this one...
So, here is the thing:

Following your example, I've created a piece of my webpage in jsfiddle, using the leaflet libraries I'm trying to merge (lealfet, layers tree and sidebar v2, among others...). It was a nice exercise although a bit frustrating, specially when I realized jsfiddle didn't saved my work automatically and I losted four hours in a row coding! Part of the learning curve I guess... anyway I have to admit that jsfiddle is a nice piece of software!

Ok, so, once I had all working in jsfiddle I tried to made the same with my original code, and had found it wasnt working (layers tree appears inside sidebar pane but collapsed... no mater how many "collapsed: false" declarations I had included in my code!...). To make a long story short; after chopping out pieces of code I found that layers tree and David Chouse´s navbar (https://github.com/davidchouse/Leaflet.NavBar) used the same "options" variable declaration (I cant include NavBar in my example, cause I cant found a working library for jsfiddle, only github, sorry...).

So, the solution I've found was to rename one of the "options" declaration to "options2" (clever right ;)) and voila! Now I have an expanded layers tree inside sidebar. My next step is to turn off the surrounding box around layers tree, or at least make it invisible, but I cant found the correct CSS definition. I´ll see how I can accomplish this...

capture

Here is my jsfiddle example... https://jsfiddle.net/mbotti/z3f4x0w7/

Regards, M.

from leaflet.control.layers.tree.

jjimenezshaw avatar jjimenezshaw commented on September 4, 2024

Great that you get it.
Using the Chrome "Developer Tools" you get easily to this CSS definition (line 449 of css file):

.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
	border: 2px solid rgba(0,0,0,0.2);
	background-clip: padding-box;
	}

I understand that I can close the issue.

from leaflet.control.layers.tree.

mpbotti avatar mpbotti commented on September 4, 2024

Thanks again Javier for your kindly help! You can close this issue.
Regards, M.

from leaflet.control.layers.tree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.