aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md22
1 files changed, 11 insertions, 11 deletions
diff --git a/README.md b/README.md
index 67456b6..493a140 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ See the included example for usage.
Create a L.Indoor, then add the data to it.
-```javascript
+`
// where data is a GeoJSON feature collection
var indoorLayer = new L.Indoor(data);
@@ -39,7 +39,7 @@ var levelControl = new L.Control.Level({
levelControl.addEventListener("levelchange", indoorLayer.setLevel, indoorLayer);
levelControl.addTo(map);
-```
+`
### Usage Instructions
@@ -47,7 +47,7 @@ The data should be a GeoJSON feature collection (or an array of GeoJSON
features). With the standard configuration, each feature must have a property
attribute "level", which can be a integer, string or array of either (or both).
-```javascript
+`
{
type: "FeatureCollection",
features: [
@@ -76,7 +76,7 @@ attribute "level", which can be a integer, string or array of either (or both).
If the data is not in this format, you can pass in a replacement getLevel
function, that will be used to get the level for each Feature.
-```javascript
+`
var indoorLayer = new L.Indoor(data, {
getLevel: function(feature) {
return feature.properties.otherLevel;
@@ -85,25 +85,25 @@ var indoorLayer = new L.Indoor(data, {
markerForFeature
});
-```
+`
L.Control.Level is the user interface component that allows for the easy
switching of levels. It takes in some levels (which you can get from the indoor
layer by using getLevels()), and displays a list.
-```javascript
+`
var levelControl = new L.Control.Level({
level: "0",
levels: indoorLayer.getLevels()
});
-```
+`
When using the L.Control.Indoor, if the levels are not integers, by default,
the levels will be converted to integers for the ordering in the control. If
the levels given to the control are not integers, then the parseLevel option
can be used to replace the default function that uses parseInt(level, 10).
-```javascript
+`
var levelControl = new L.Control.Level({
level: "1A",
levels: indoorLayer.getLevels()
@@ -117,16 +117,16 @@ var levelControl = new L.Control.Level({
return levels[level];
}
});
-```
+`
You can then bind the "levelchange" event, to change the level displayed by the
layer. Note that the levels that the control has must match that used by the
layer, if the levels in the control have been set via getLevels), this should
be the case.
-```javascript
+`
levelControl.addEventListener("levelchange", indoorLayer.setLevel, indoorLayer);
-```
+`
## Events