{"_id":"leaflet-iconlayers","_rev":"7-bdfac3e4bba12930ad3144778836c8f7","name":"leaflet-iconlayers","time":{"modified":"2022-06-19T11:13:28.020Z","created":"2015-06-16T09:27:17.881Z","0.1.0":"2015-06-16T09:27:17.881Z","0.1.1":"2015-06-16T10:38:18.070Z","0.1.2":"2015-09-21T12:33:38.302Z","0.2.0":"2015-11-09T07:07:23.439Z"},"maintainers":[{"name":"zverev","email":"alexander.zverev@gmail.com"}],"dist-tags":{"latest":"0.2.0"},"description":"Leaflet control that displays base layers as small icons.","readme":"# Leaflet-IconLayers\r\n\r\n![](demo.gif)\r\n\r\nLeaflet base layers switching control with icons ([example](https://scanex.github.com/Leaflet-IconLayers/examples))\r\n\r\n*Requires Leaflet 0.7.3 or newer; IE9+*\r\n\r\nExtends `L.Control`.\r\n\r\n## Using Control\r\n\r\nCopy files from `src` dir and include them to your project.\r\n\r\nBasic usage:\r\n\r\n```javascript\r\nL.control.iconLayers(layers).addTo(map);\r\n```\r\n\r\nIn order to interact with layers Leaflet-IconLayers uses an array of layer objects, that have following fields:\r\n- `icon` - icon url (typically 80x80)\r\n- `title` - a short string that is displayed at the bottom of each icon\r\n- `layer` - any Leaflet `ILayer`\r\n\r\nYou can pass this array to construtor or use `setLayers` method.\r\n\r\nThe second constructor argument may be `options` hash. It is also ok if it is the only one.\r\n\r\n## Options\r\n\r\n- `maxLayersInRow` - the number of layers, that a row can contain\r\n- `manageLayers` - by default control manages map layers. Pass `false` if you want to manage layers manually.\r\n\r\nplus `L.Control` options (`position`)\r\n\r\n## Methods\r\n\r\n- `setLayers(<Array> layers)` - replace layers array with a new one\r\n- `setActiveLayer(<ILayer> layer)` - set active layer\r\n- `collapse()` - hide secondary layers\r\n- `expand()` - show hidden layers\r\n\r\n## Events\r\n\r\n- `activelayerchange` - fires when user changes active layer (clicks one of layer icons). The changed layer is passed in `layer` key of an event object (see an example).\r\n\r\n## Detailed example\r\n```javascript\r\nvar iconLayersControl = new L.Control.IconLayers(\r\n    [\r\n        {\r\n            title: 'Map', // use any string\r\n            layer: mapLayer, // any ILayer\r\n            icon: 'img/mapIcon.png' // 80x80 icon\r\n        },\r\n        {\r\n            title: 'Satellite',\r\n            layer: satLayer,\r\n            icon: 'img/mapIcon.png'\r\n        }\r\n    ], {\r\n        position: 'bottomleft',\r\n        maxLayersInRow: 5\r\n    }\r\n);\r\n\r\n// new L.Control.IconLayers(layers)\r\n// new L.Control.IconLayers(options)\r\n// are also ok\r\n\r\niconLayersControl.addTo(map);\r\n\r\n// we can modify layers list\r\niconLayersControl.setLayers(layers);\r\n\r\niconLayersControl.on('activelayerchange', function(e) {\r\n    console.log('layer switched', e.layer);\r\n});\r\n```","versions":{"0.1.1":{"name":"leaflet-iconlayers","version":"0.1.1","description":"Leaflet control that displays base layers as small icons.","main":"src/iconLayers.js","directories":{"example":"examples"},"repository":{"type":"git","url":"https://github.com/ScanEx/Leaflet-IconLayers.git"},"keywords":["leaflet"],"author":{"name":"Alexander Zverev","email":"alexander.zverev@gmail.com","url":"https://github.com/zverev"},"license":"MIT","bugs":{"url":"https://github.com/ScanEx/Leaflet-IconLayers/issues"},"homepage":"https://github.com/ScanEx/Leaflet-IconLayers","dependencies":{"leaflet":"^0.7.3"},"gitHead":"1f663f1e61e784cb50796efdb844392072aeea1c","_id":"leaflet-iconlayers@0.1.1","scripts":{},"_shasum":"9f4b4697f76aea64ca991d8db8e015018decf461","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.1","_npmUser":{"name":"zverev","email":"alexander.zverev@gmail.com"},"maintainers":[{"name":"zverev","email":"alexander.zverev@gmail.com"}],"dist":{"shasum":"9f4b4697f76aea64ca991d8db8e015018decf461","tarball":"https://registry.npmjs.org/leaflet-iconlayers/-/leaflet-iconlayers-0.1.1.tgz","integrity":"sha512-tXY7MU+Nzj5SytSId0fCsB5xWF4FkSO4LAzvgZN0SpFFvuhollL+0V+5DUWrVxCk9jARHzNkykYm3gIHCGhx4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2sv0/gkJ8oB1QisB3+5N/01/tehDsTJCy0k0voUDYowIgBeU83VaiHYgBtxz7UA5v9fqoewgjWdjUAyF8Cc0aTnM="}]}},"0.1.2":{"name":"leaflet-iconlayers","version":"0.1.2","description":"Leaflet control that displays base layers as small icons.","main":"src/iconLayers.js","directories":{"example":"examples"},"repository":{"type":"git","url":"https://github.com/ScanEx/Leaflet-IconLayers.git"},"keywords":["leaflet"],"author":{"name":"Alexander Zverev","email":"alexander.zverev@gmail.com","url":"https://github.com/zverev"},"license":"MIT","bugs":{"url":"https://github.com/ScanEx/Leaflet-IconLayers/issues"},"homepage":"https://github.com/ScanEx/Leaflet-IconLayers","dependencies":{"leaflet":"^0.7.3"},"devDependencies":{"gulp":"^3.9.0","gulp-eslint":"^1.0.0"},"gitHead":"b2cab55b1225d515e747cee32b2cd17501e806ba","_id":"leaflet-iconlayers@0.1.2","scripts":{},"_shasum":"b594fcc3b66b365b979e1df006c246f86026a171","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.1","_npmUser":{"name":"zverev","email":"alexander.zverev@gmail.com"},"maintainers":[{"name":"zverev","email":"alexander.zverev@gmail.com"}],"dist":{"shasum":"b594fcc3b66b365b979e1df006c246f86026a171","tarball":"https://registry.npmjs.org/leaflet-iconlayers/-/leaflet-iconlayers-0.1.2.tgz","integrity":"sha512-4cRyEAiOssSsx7uDUmMjJ841t9V27S/MMkSr6XzSW6fF3Cjh9QaKyxqMr7GLxNCyekGYa2Jy6ClAI7Ydx7QHrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfLDqjd1buB/2b4XbEZ/HGb9e2ZrWnfeXwhQyhoDCvIAIhAI9R8ap6bPW/FfyCzwUdCw7XnkDSl+5A4mX5ZT36gJfu"}]}},"0.2.0":{"name":"leaflet-iconlayers","version":"0.2.0","description":"Leaflet control that displays base layers as small icons.","main":"dist/iconLayers.js","style":"dist/iconLayers.css","directories":{"example":"examples"},"scripts":{"examples":"browserify -v examples/browserify.js > examples/browserify_bundle.js","prepublish":"gulp && npm run examples"},"repository":{"type":"git","url":"git+https://github.com/ScanEx/Leaflet-IconLayers.git"},"keywords":["leaflet"],"author":{"name":"Alexander Zverev","email":"alexander.zverev@gmail.com","url":"https://github.com/zverev"},"license":"MIT","bugs":{"url":"https://github.com/ScanEx/Leaflet-IconLayers/issues"},"homepage":"https://github.com/ScanEx/Leaflet-IconLayers","dependencies":{"leaflet":"^0.7.3"},"devDependencies":{"browserify":"^12.0.1","gulp":"^3.9.0","gulp-eslint":"^1.0.0"},"gitHead":"03653b0cd6fd3c9be8954ebc5cae7067d61ec697","_id":"leaflet-iconlayers@0.2.0","_shasum":"6689377ece3ad4dbaea7458a167ae6cdc44d5eed","_from":".","_npmVersion":"3.3.8","_nodeVersion":"4.1.2","_npmUser":{"name":"zverev","email":"alexander.zverev@gmail.com"},"dist":{"shasum":"6689377ece3ad4dbaea7458a167ae6cdc44d5eed","tarball":"https://registry.npmjs.org/leaflet-iconlayers/-/leaflet-iconlayers-0.2.0.tgz","integrity":"sha512-iSa5v+Lrovt2wLY3wQnzudatb+l7SEMUOvrmDrky2TkhUjJscrJKj8doP16xG94E2rHQaQmqxUWKGv6JNUfIOQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC/+4maxSlmu1z3QeaCpI1hV33KTM2Yeoh5t98InqWJIAiAKjyh2P7E+p4bPoZG9ieKN1Jvh2S4o/DyZSjLtQAsAeA=="}]},"maintainers":[{"name":"zverev","email":"alexander.zverev@gmail.com"}]}},"homepage":"https://github.com/ScanEx/Leaflet-IconLayers","keywords":["leaflet"],"repository":{"type":"git","url":"git+https://github.com/ScanEx/Leaflet-IconLayers.git"},"author":{"name":"Alexander Zverev","email":"alexander.zverev@gmail.com","url":"https://github.com/zverev"},"bugs":{"url":"https://github.com/ScanEx/Leaflet-IconLayers/issues"},"license":"MIT","readmeFilename":"README.md"}