0.0.8 • Published 5 years ago
leaflet-center-cross v0.0.8
Leaflet.CenterCross
Leaflet.CenterCross, a plugin that adds cross image on center to Leaflet powered maps.
Original program is developed by Geospatial Information Authority of Japan.
https://github.com/gsi-cyberjapan/gsimaps
Structure and build scripts are based Leaflet.draw.
https://github.com/Leaflet/Leaflet.draw
How to use
include javascript.
<script src="https://unpkg.com/leaflet-center-cross@0.0.8/dist/leaflet.CenterCross.js"></script>
add follow code:
var control = L.control.centerCross();
map.addControl(control);
Control.centerCross
CenterCross control provides toggle switch of center cross.
var control = L.control.centerCross({show: true, position: "topright"});
map.addControl(control);
Creation
Factory | Description |
---|---|
L.control.centerCross(<Control.CenterCross options> options?) | Create a center cross control. |
Options
Option | Type | Default | Description |
---|---|---|---|
position | String | 'topleft | See [Control Positions](http://leafletjs.com/reference.html#control-positions) |
toggleText | String | 'C' | control's text |
toggleTitle | String | 'Toggle Center Cross' | control's title, show on mouse over in control like tooltip |
show | Boolean | false | If true, show center cross when addControl |
centerCross
Used to put center cross object in center of the map.
var centerCross = L.centerCross();
map.addLayer(centerCross);
Creation
Factory | Description |
---|---|
L.centerCross(<[CenterCross options](#centercross_options)> options?) | Creates a center cross object. |
Options
Option | Type | Default | Description |
---|---|---|---|
visible | Boolean | true | If true, adds center cross to the map. |
Methods
Method | Returns | Description |
---|---|---|
addTo(<[Map ](http://leafletjs.com/reference.html#map-class)> map) | this | Adds center cross to the map. |
getVisible() | Boolean | Reterns true if center cross shows in the map. |
setVisible(< Boolean > on) | this | Updates visible status |