Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Remove InfoControl
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Oct 20, 2016
1 parent c50551e commit 15b900d
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 273 deletions.
35 changes: 1 addition & 34 deletions API.md
Expand Up @@ -11,7 +11,7 @@ interactivity.
| ---- | ---- | ---- |
| element (_required_) | string | Must be the id of an element, or a DOM element reference. |
| id _or_ url _or_ tilejson | __string__ if _id_ or _url_ __object__ if _tilejson_ | url can be <ul><li>A map `id` string `examples.map-foo`</li><li>A comma separated list of map `id` strings `examples.map-foo,examples.map-bar` [example](https://www.mapbox.com/mapbox.js/example/v1.0.0/compositing/)</li><li>A URL to TileJSON, like `{{site.tileApi}}/v3/mapbox.dark.json`</li><li>A [TileJSON](https://www.mapbox.com/developers/tilejson/) object, from your own Javascript code</li></ul> |
| options | object | If provided, it is the same options as provided to L.Map with the following additions: <ul><li>`tileLayer` L.TileLayer options. Options passed to a `L.mapbox.tileLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.tileLayer`.</li><li>`featureLayer` `L.mapbox.featureLayer` options. Options passed to a `L.mapbox.featureLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.featureLayer`.</li><li>`gridLayer` `L.mapbox.gridLayer`. Options passed to a `L.mapbox.gridLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.gridLayer`.</li><li>`legendControl` `L.mapbox.legendControl` options. Options passed to a `L.mapbox.legendControl` based on the TileJSON. Set to `false` to disable the `L.mapbox.legendControl`.</li><li>`shareControl`: Options passed to a `L.mapbox.shareControl`. Set to `true` to enable the `L.mapbox.shareControl`.</li><li>`infoControl`: Options passed to a `L.mapbox.infoControl`. Set to `true` to enable the `L.mapbox.infoControl`.</li><li>`accessToken`: Mapbox API access token. Overrides `L.mapbox.accessToken` for this map.</li><li>`attributionControl`: value can be `{compact: true}` to force a compact attribution icon that shows the full attribution on click, or `{compact: false}` to force the full attribution control. The default is a responsive attribution that collapses when the map is less than 640 pixels wide.</li> |
| options | object | If provided, it is the same options as provided to L.Map with the following additions: <ul><li>`tileLayer` L.TileLayer options. Options passed to a `L.mapbox.tileLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.tileLayer`.</li><li>`featureLayer` `L.mapbox.featureLayer` options. Options passed to a `L.mapbox.featureLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.featureLayer`.</li><li>`gridLayer` `L.mapbox.gridLayer`. Options passed to a `L.mapbox.gridLayer` based on the TileJSON. Set to `false` to disable the `L.mapbox.gridLayer`.</li><li>`legendControl` `L.mapbox.legendControl` options. Options passed to a `L.mapbox.legendControl` based on the TileJSON. Set to `false` to disable the `L.mapbox.legendControl`.</li><li>`shareControl`: Options passed to a `L.mapbox.shareControl`. Set to `true` to enable the `L.mapbox.shareControl`.</li><li>`accessToken`: Mapbox API access token. Overrides `L.mapbox.accessToken` for this map.</li><li>`attributionControl`: value can be `{compact: true}` to force a compact attribution icon that shows the full attribution on click, or `{compact: false}` to force the full attribution control. The default is a responsive attribution that collapses when the map is less than 640 pixels wide.</li> |

_Example_:

Expand Down Expand Up @@ -391,39 +391,6 @@ _Returns_: the geocoder object. The return value of this function is not useful

# Controls

## L.mapbox.infoControl(options)

<span class='leaflet icon'>_Extends_: `L.Control`</span>

A map control that shows a toggleable info container. If set, attribution is auto-detected from active layers and added to the info container.

| Options | Value | Description |
| ---- | ---- | ---- |
| options _optional_ | object | An options object. Beyond the default options for map controls, this object has a one additional parameter: <ul><li>`sanitizer`: A function that accepts a string, and returns a sanitized result for HTML display. The default will remove dangerous script content, and is recommended.</li></ul> |

_Example_:

var map = L.mapbox.map('map').setView([38, -77], 5);
map.addControl(L.mapbox.infoControl().addInfo('foo'));

_Returns_: a `L.mapbox.infoControl` object.

_Class_: `L.mapbox.InfoControl`

### infoControl.addInfo(info)
Adds an info string to infoControl.

| Options | Value | Description |
| ---- | ---- | ---- |
| info _required_ | string | A string which may contain HTML. It will be sanitized by the infoControl's sanitizer option. |

### infoControl.removeInfo(info)
Removes an info string from infoControl.

| Options | Value | Description |
| ---- | ---- | ---- |
| info _required_ | string | Info to remove. |

## L.mapbox.legendControl(options)

<span class='leaflet icon'>_Extends_: L.Control</span>
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
## v3.0.0

* Upgrades Leaflet dependency to v1.0.1
* Removes the deprecated `InfoControl` class.

## v2.4.0

Expand Down
115 changes: 0 additions & 115 deletions src/info_control.js

This file was deleted.

16 changes: 0 additions & 16 deletions src/map.js
Expand Up @@ -4,7 +4,6 @@ var tileLayer = require('./tile_layer').tileLayer,
featureLayer = require('./feature_layer').featureLayer,
gridLayer = require('./grid_layer').gridLayer,
gridControl = require('./grid_control').gridControl,
infoControl = require('./info_control').infoControl,
shareControl = require('./share_control').shareControl,
legendControl = require('./legend_control').legendControl,
mapboxLogoControl = require('./mapbox_logo').mapboxLogoControl,
Expand All @@ -25,7 +24,6 @@ var LMap = L.Map.extend({
gridLayer: {},
legendControl: {},
gridControl: {},
infoControl: false,
shareControl: false,
sanitizer: require('sanitize-caja')
},
Expand Down Expand Up @@ -82,11 +80,6 @@ var LMap = L.Map.extend({
this.addControl(this.gridControl);
}

if (this.options.infoControl) {
this.infoControl = infoControl(this.options.infoControl);
this.addControl(this.infoControl);
}

if (this.options.legendControl) {
this.legendControl = legendControl(this.options.legendControl);
this.addControl(this.legendControl);
Expand Down Expand Up @@ -142,11 +135,6 @@ var LMap = L.Map.extend({
this._updateLayer(this.gridLayer);
}

if (this.infoControl && json.attribution) {
this.infoControl.addInfo(this.options.sanitizer(json.attribution));
this._updateMapFeedbackLink();
}

if (this.legendControl && json.legend) {
this.legendControl.addLegend(json.legend);
}
Expand Down Expand Up @@ -209,10 +197,6 @@ var LMap = L.Map.extend({
_updateLayer: function(layer) {
if (!layer.options) return;

if (this.infoControl && this._loaded) {
this.infoControl.addInfo(layer.options.infoControl);
}

if (this.attributionControl && this._loaded && layer.getAttribution) {
this.attributionControl.addAttribution(layer.getAttribution());
}
Expand Down
3 changes: 0 additions & 3 deletions src/mapbox.js
Expand Up @@ -6,7 +6,6 @@ var geocoderControl = require('./geocoder_control'),
legendControl = require('./legend_control'),
shareControl = require('./share_control'),
tileLayer = require('./tile_layer'),
infoControl = require('./info_control'),
map = require('./map'),
gridLayer = require('./grid_layer'),
styleLayer = require('./style_layer');
Expand All @@ -20,8 +19,6 @@ L.mapbox = module.exports = {
TileLayer: tileLayer.TileLayer,
styleLayer: styleLayer.styleLayer,
StyleLayer: styleLayer.StyleLayer,
infoControl: infoControl.infoControl,
InfoControl: infoControl.InfoControl,
shareControl: shareControl.shareControl,
ShareControl: shareControl.ShareControl,
legendControl: legendControl.legendControl,
Expand Down
7 changes: 1 addition & 6 deletions test/manual/share_control.html
Expand Up @@ -12,12 +12,7 @@
<div id='map'>
</div>
<script>
var map = L.mapbox.map('map', 'tristen.map-ixqro653', {
infoControl: {
position: 'bottomright',
editLink: true
}
})
var map = L.mapbox.map('map', 'tristen.map-ixqro653')
.addControl(L.mapbox.shareControl());
</script>
</body>
Expand Down
4 changes: 0 additions & 4 deletions test/manual/theme.html
Expand Up @@ -37,10 +37,6 @@
.addControl(L.mapbox.shareControl())
.setView([37.9, -77], 5);

var info = L.mapbox.infoControl({
position: 'bottomleft'
}).addInfo('foo').addTo(mapdark);

var feature = {
type: 'Feature',
geometry: {
Expand Down
94 changes: 0 additions & 94 deletions test/spec/info_control.js

This file was deleted.

1 change: 0 additions & 1 deletion test/spec/map.js
Expand Up @@ -335,7 +335,6 @@ describe('L.mapbox.map', function() {

it('attributionControl enabled', function(done) {
var map = L.mapbox.map(element, 'mapbox.map-0l53fhk2', {
infoControl: false,
attributionControl: true
});

Expand Down

0 comments on commit 15b900d

Please sign in to comment.