livienyin / lexvlex Goto Github PK
View Code? Open in Web Editor NEWNeighborhood comparison tool
Neighborhood comparison tool
These are questions @livienyin had about #3.
[4:40 PM] livien: are "L._______" leaflet functions?
[4:44 PM] livien: what's the difference between including "var" and not including "var" in "Fix variable definition error in style function"?
[5:02 PM] livien: For "function onEachFeature(feature, layer) {
layer.on('click', function(e) {
map.fitBounds(e.target.getBounds());
});
layer.bindPopup(popup(feature));
};" --> Where does the "e" come from and what type of an object is it?
L.map
makes a map object. The map has a series of options (which you see in the { }
here) and a series of methods you can run on it. L.geoJson
and L.tileLayer
are also Leaflet objects: you can read more about them in the API doc here.tractColor
in the style
function with var
, it means that tractColor
only has meaning inside of that function. Anything inside of the function knows what it is, but tractColor
has no meaning outside of that function. If we decided we needed to access that variable elsewhere in the code, we could leave off the var, making it a "global variable" that can be accessed anywhere.layer.on('click')
method is an event handler. It says, "When someone clicks on the map, do this function." The Leaflet map class can have quite a few events. The e
here represents the event itself -- in this case, click. The callback function that takes e
as a parameter is creating an event handler for the click -- it says when you click, fit the bounds of the map to whatever was clicked on. e.target.getBounds()
says take the click, find out what was clicked on (the target
), and get the bounds of that object. That bounding box is then passed as an argument to the map.fitBounds()
method, and the map zooms to that bounding box.[ ] Kill pan
[ ] Kill zoom
[ ] Darken on selected
[ ] Hover with title
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.