# Leaflet.MiniMap
Leaflet.MiniMap is a simple minimap control that you can drop into your leaflet map, and it will create a small map in the corner which shows the same as the main map with a set zoom offset. (By default it is `-5`.)
[![npm version](https://badge.fury.io/js/leaflet-minimap.svg)](https://www.npmjs.com/package/leaflet-minimap)
[![Bower version](https://badge.fury.io/bo/leaflet-minimap.svg)](https://github.com/Norkart/Leaflet-MiniMap)
[![js-happiness-style](https://img.shields.io/badge/code%20style-happiness-brightgreen.svg?style=flat-square)](https://github.com/JedWatson/happiness)
[![Build Status](https://travis-ci.org/Norkart/Leaflet-MiniMap.svg)](https://travis-ci.org/Norkart/Leaflet-MiniMap)
[![CDNJS](https://img.shields.io/cdnjs/v/leaflet-minimap.svg)](https://cdnjs.com/libraries/leaflet-minimap)
## Using the MiniMap control
The control can be inserted in two lines: First you have to construct a layer for it to use, and then you create and attach the minimap control. Don't reuse the layer you added to the main map, strange behaviour will ensue! Alternatively, you can pass in a LayerGroup with multiple layers (for example with overlays or suitably themed markers). Marker layers can't be reused either. (See issue #52 for a discussion of synchronising marker layers.)
From the [example](http://norkart.github.com/Leaflet-MiniMap/example.html):
```js
var osm2 = new L.TileLayer(osmUrl, {minZoom: 0, maxZoom: 13, attribution: osmAttrib});
var miniMap = new L.Control.MiniMap(osm2).addTo(map);
```
As the minimap control inherits from leaflet's control, positioning is handled automatically by leaflet. However, you can still style the minimap and set its size by modifying the css file.
**Note:** Leaflet version 0.7.7 or higher is required, but the plugin has been
tested and verified to work fine with Leaflet 1.0.0-beta2.
### Example usage in CommonJS compatible environments (Node/Browserify)
```js
var MiniMap = require('leaflet-minimap');
new MiniMap(layer, options).addTo(map);
```
If you prefer ES6 style (for example with babel):
```js
import MiniMap from 'leaflet-minimap';
new MiniMap(layer, options).addTo(map);
```
### Example usage in AMD compatible environments (RequireJS)
```js
require(['leaflet-minimap'], function(MiniMap) {
new Minimap(layer, options).addTo(map);
});
```
## Available Methods
`changeLayer`: Swaps out the minimap layer for the one provided. See the _layerchange_ example for hints on good uses.
## Available Options
The mini map uses options which can be set in the same way as other leaflet options, and these are the available options:
`position`: The standard Leaflet.Control position parameter, used like all the other controls. Defaults to 'bottomright'.
`width`: The width of the minimap in pixels. Defaults to 150.
`height`: The height of the minimap in pixels. Defaults to 150.
`collapsedWidth`: The width of the toggle marker and the minimap when collapsed, in pixels. Defaults to 19.
`collapsedHeight`: The height of the toggle marker and the minimap when collapsed, in pixels. Defaults to 19.
`zoomLevelOffset`: The offset applied to the zoom in the minimap compared to the zoom of the main map. Can be positive or negative, defaults to -5.
`zoomLevelFixed`: Overrides the offset to apply a fixed zoom level to the minimap regardless of the main map zoom. Set it to any valid zoom level, if unset `zoomLevelOffset` is used instead.
`centerFixed`: Applies a fixed position to the minimap regardless of the main map's view / position. Prevents panning the minimap, but does allow zooming (both in the minimap and the main map). If the minimap is zoomed, it will always zoom around the `centerFixed` point. You can pass in a LatLng-equivalent object. Defaults to false.
`zoomAnimation`: Sets whether the minimap should have an animated zoom. (Will cause it to lag a bit after the movement of the main map.) Defaults to false.
`toggleDisplay`: Sets whether the minimap should have a button to minimise it. Defaults to false.
`autoToggleDisplay`: Sets whether the minimap should hide automatically if the parent map bounds does not fit within the minimap bounds. Especially useful when 'zoomLevelFixed' is set.
`minimized`: Sets whether the minimap should start in a minimized position.
`aimingRectOptions`: Sets the style of the aiming rectangle by passing in a [Path.Options object](http://leafletjs.com/reference.html#path-options). (Clickable will always be overridden and set to false.)
`shadowRectOptions`: Sets the style of the aiming shadow rectangle by passing in a [Path.Options object](http://leafletjs.com/reference.html#path-options). (Clickable will always be overridden and set to false.)
`strings`: Overrides the default strings allowing for translation. See below for available strings and `example/example_i18n.html` for an example.
`mapOptions`: Sets Leaflet options for the MiniMap map. It does not override the MiniMap default map options but extends them.
### Available Strings
`hideText`: The text to be displayed as Tooltip when hovering over the toggle button on the MiniMap and it is visible. Defaults to 'Hide MiniMap'
`showText`: The text to be displayed as Tooltip when hovering over the toggle button on the MiniMap and it is hidden. Defaults to 'Show MiniMap'
### Available Events
The MiniMap fires `minimize`, `restore` events and `toggle` for both.
## Building minified versions
First, install node.js on your system. Then run `npm install` to get the dependencies, and `npm build` to build
the minified js and css. Use `npm test` to lint the code so you can check that it follows our
coding standard. (Any pull requests will be checked this way by the build server.)
## Loading minified version through node modules
Node modules does not link css to minified version directly.
Add`require('../../node_modules/leaflet-minimap/dist/Control.MiniMap.min.css');` to the code.
没有合适的资源?快使用搜索试试~ 我知道了~
leaflet_all_maps.rar
共2000个文件
png:2979个
js:77个
less:63个
需积分: 10 2 下载量 16 浏览量
2020-01-10
14:59:13
上传
评论
收藏 30.99MB RAR 举报
温馨提示
leaflet对百度、高德、天地图、google等地图封装 包含 点 线 面 轨迹 右键菜单等功能 通过右上角按钮,切换不同地图显示效果
资源推荐
资源详情
资源评论
收起资源包目录
leaflet_all_maps.rar (2000个子文件)
032aabd85b43a058cfc7025dd4fa9dd325ea97 187B
03d68022bc4dfabb2b3a3303fc26412276f5f2 25KB
05498349f7bfec0ef12dd6e88d2a9b2f0d70f0 162B
05daaab8c1b7c990ffe5d036ce4fc8bdce8ef6 283B
05dbf457000d122a3b8afcc3847e44cffea421 141B
0654a1b73c02eadba57dd8b50e7d814dd040cf 2KB
06a241289afd5b2ed67a8536a64d9e0cd281e4 215B
07d62fef35035ecbcd3763389080a74b55c629 2KB
081657e3cca248308c5e8aa8a4654703a76c43 1KB
082241c1c886c1ce21e3512b6f5af30c8e7bad 5KB
082346ebfbd4231263f0eb9d445974675097db 2KB
085ac14b178ae20832b1cc734f2410541c555a 913B
08e57b537d03cefedf7980f8735251ec3f1229 1KB
09c316d4b000644533a3b15ff84a3e2c94befc 1KB
0bf3e74b03b2639036a378137a941b157afe28 36KB
0c333dca9652ac4cba004d609e5af4eee168c1 1KB
0d1037fe8111a94f7dcd30606369ba23ef871a 2KB
0d71b7ad1143065e06e4c6323c81da70a88946 260B
0ec1c68f4eeeb04a01ef62c463a356829402c4 23KB
0edf24677ded147df13b26f91baa2b0fa70513 1KB
1035a05b2c8745d674973ca5455699b577ce13 1KB
10422fa1a3d233a15bca956fc8b674e7681cab 573B
1113f958a39c62b2f8ae771ea546eb85c85d67 3KB
119018947f0235b110fffbeb8879380c181dc5 214B
11c29fe8d7b8ad426e84f11b6b1124ab96f420 160B
11f4250f70d5632a47428f140ba010deeb2c79 1KB
1332dd53cab4b918129680900758159763eeec 185B
13fc609ab6f21774de0cb7e01360095584f65b 24KB
14101cfcf14f3d0be26f431dce51c3d432cabb 142B
145b9c0a36f5e3e540b8948ff6954848453ebc 109B
15050eb481dfa3cedd2ecd6c0fd398a4b5352b 489B
15b6495fa458ad39d51cb4b913430016f48d33 4KB
1676241d077d2bcf1cd0f8991bc9c0eb3ac4fe 170B
170061f1b38b7e6732cfe0fa206dc90d2b52b3 224B
17e9088089b940cf3a408a211006ce11560a36 2KB
185753fdcd86931b4ea66523e38bcf48966169 897B
1a459783b11afde335471982501d8bdac47968 2KB
1ad2fb7471dd29ae781f1aefdfb8bb5e4a7d6c 135B
1b7da16a84820d6e2d0be3a36695a3f92535cb 280B
1b9fe9ddbfcd43f71a5dd832b737b977242e33 119B
1c0c0c3a628773b7253b70d1ff79cd8a7773a1 159B
1c3ca3d19a10d812f300763d19548d1a7f423d 784B
1c616a9bbc2afca8d5f822997b1f5d2287c16a 1KB
1c9f4c687d7d3ef8fc1877e7ea2fb957eed198 176B
1cc18391f30b9bdde09f05df6dd36eeede8370 34KB
1e41fbc11f86ade501d09a9354f7884c34f404 13KB
1e53e57bfbf9e5cce48472af4f079c58dd1a6f 2KB
1f05ab054412684539a94423c097d6cdadd8ba 136B
1f1d5c52b004a921dfd31ffd01f0e9893c2bd1 183B
1f32b3b1722e80a2e3f98d82c11ca914e28d9a 894B
203b985cb04a09a402059d131b27287257e461 712B
20494c4573f300cd9f604e6a5b726705ce86cb 947B
207d5d12d33b2f8b96c7ac8e9388e801aa0aed 476B
208e5190f44c464739b4e2a4699baa3918017a 189B
216acd167327c03d7e3a7748e4763b35c0e6ba 12KB
22dc070afda35840d51eb6193ba0f04d9ac607 10KB
23b5ecc357c2662a7298434a80cb72899be403 34KB
23c357f2b003cfbade044e1e2dafb35e31080f 79KB
23e8c84f146e13f09387c9720a57fc42903bb1 178B
23ff96a15ebfcadccbed86c599f16890e96d11 1KB
24628f1093477358021ffe4458b3b77061a611 524B
249a651ff9f4ea9d0221e293a2ee08c61dbbba 193B
25e3c5427057fb9d2a10510653e688caad24fc 281B
260d2226f9c52b2da62b3e61c41259abed837b 161B
2626b1bca5d6ce55b18ce3ae343c279de1be08 4KB
26facc9fb4bc8183dc5ebe7de08639cb343c60 4KB
2727cac3c0f52b7370e851a1e2f3092ad76d1a 20KB
27e210b2f4541034bbae050088fe7459e61d21 7KB
28143c07290134f5176bfa4b8a3cce46a986cf 64KB
28ce70d289401c2b5345d4a77587f0ea80291c 31KB
2997619fb4e13604ad439c26bd1a5f650fedfc 1KB
29fc3081592403d48590b3a238940ee45dfcde 58B
2a2e44f553e07308bf207da7940b71dde76e69 36KB
2a88028b173f0e75613e86acae54b7cfe03576 8KB
2ab562b01df8a1a8dfd674f27b959d8a049486 1KB
2b9cdc7b54737eb9a474773595f58b0e6732d3 219B
2d6bde51631d663c5e677031039575658bbca0 120B
2e37d7498c6ef710b4b03d7f183ebeca936bcf 189B
2f9c7e14d39a1a7051ad9674e464533588c613 290B
3005a7ad9371f68b406cf30026581994cc03fb 1KB
315e572f83385f10407cae46253526e0bb3dd7 370B
3162cf42637a49e63a50fa75c9d859a652ac06 2KB
33cb3e199f21ac194212e10ebb1e12feb0682b 486B
351a8f161b80c135b6d66326384a5151302a8f 188B
358cb66cea923c4eec5ba223c32db953d4a9f5 396B
35c8a2583a8926e1c5df15aa285e7ea7978aa8 2KB
362adc084b26956d5ecb0524a6bb6b2bb8c88b 98B
3804c46fa5da0f051eddbe2c3d20902ee73536 247B
3891c0168b220c892482c403e91ff3d5d1a42c 19KB
39898f2bf0954773d63717dadc6554970e003b 1006B
3a0763cdda62831b42a138c9bff65a409f960f 2KB
3a4953fff68df523aa7656497ee339d6026d64 20KB
3a5caebf755e59bad664b88e23017667ad16fd 214B
3ac5fea583701b4e65052ca0b0199eeb71b460 2KB
3ca9554dd7937035c4245edbe6093952223afb 6KB
3cbb4d1eff8b1ad6ff03d139c36d820ea5d7fb 202KB
3d2a59a8c970f668917a0cf25a87940967f644 128B
3e9b9d2d4b168b896b06c7719dab45c902c977 2KB
3f3c89bdeaeff7063f56cb662862663c9fece0 72B
3f5ab46285a95e7b3abc4b069df04d6515cc71 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
core512
- 粉丝: 481
- 资源: 78
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功