Skip to content

Commit f2300a2

Browse files
committed
💡 題名ラベルオプション追加
- 💡 UI修正 - 💡 各ファイル修正 - 📝 README 修正 - 📝 package.json 更新
1 parent 73f45e6 commit f2300a2

12 files changed

+51
-17
lines changed

README.md

+20-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ collapsed: false or true
3636
//The position of the control (one of the map corners).
3737
position: 'topleft' or 'topright' or 'bottomleft' or 'bottomright'
3838

39-
//Optional label to present before the controls (e.g. "Layers Opacity")
39+
//Label display of title (e.g. "Layers Opacity")
4040
label: string or null
4141

4242
```
@@ -153,7 +153,10 @@ L.control.layers(
153153

154154
//OpacityControl
155155
L.control.opacity(
156-
Map_AddLayer
156+
Map_AddLayer,
157+
{
158+
label: "Layers Opacity"
159+
}
157160
).addTo(map);
158161

159162
```
@@ -246,7 +249,10 @@ L.control.layers(
246249

247250
//OpacityControl
248251
L.control.opacity(
249-
Map_AddLayer
252+
Map_AddLayer,
253+
{
254+
label: "Layers Opacity"
255+
}
250256
).addTo(map);
251257

252258
```
@@ -306,6 +312,9 @@ collapsed: false or true
306312
//コントロールの配置設定。(デフォルト:右上配置)
307313
position: 'topleft' or 'topright' or 'bottomleft' or 'bottomright'
308314

315+
//タイトルのラベル表示(例:Layers Opacity)
316+
label: string or null
317+
309318
```
310319

311320
<br>
@@ -420,7 +429,10 @@ L.control.layers(
420429

421430
//OpacityControl
422431
L.control.opacity(
423-
Map_AddLayer
432+
Map_AddLayer,
433+
{
434+
label: "Layers Opacity"
435+
}
424436
).addTo(map);
425437

426438
```
@@ -513,7 +525,10 @@ L.control.layers(
513525

514526
//OpacityControl
515527
L.control.opacity(
516-
Map_AddLayer
528+
Map_AddLayer,
529+
{
530+
label: "Layers Opacity"
531+
}
517532
).addTo(map);
518533

519534
```

dist/L.Control.Opacity.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/L.Control.Opacity.js

100644100755
+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/script.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ var Map_AddLayer = {
4747

4848
//LayerControl
4949
L.control.layers(
50-
Map_BaseLayer,
51-
Map_AddLayer,
50+
Map_BaseLayer,
51+
Map_AddLayer,
5252
{
5353
collapsed: false
5454
}
5555
).addTo(map);
5656

5757
//OpacityControl
5858
L.control.opacity(
59-
Map_AddLayer
59+
Map_AddLayer,
60+
{
61+
label: "Layers Opacity"
62+
}
6063
).addTo(map);

docs/plugin/Leaflet.Control.Opacity/dist/L.Control.Opacity.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/plugin/Leaflet.Control.Opacity/dist/L.Control.Opacity.js

100644100755
+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/plugin/Leaflet.Control.Opacity/src/L.Control.Opacity.css

+5
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ input[type="range"]::-ms-thumb {
2929
border-radius: 12px;
3030
border: 0;
3131
background-image: linear-gradient(to bottom, #1253A4 0, #1253A4 100%);
32+
}
33+
34+
/* 題名レイアウト */
35+
.leaflet-control-layers-label {
36+
margin: 0px 0px 8px 1px
3237
}

docs/plugin/Leaflet.Control.Opacity/src/L.Control.Opacity.js

100644100755
+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
L.Control.Opacity = L.Control.extend({
22
options: {
33
collapsed: false,
4-
position: 'topright'
4+
position: 'topright',
5+
label: null
56
},
67
initialize: function (overlays, options) {
78
L.Util.setOptions(this, options);
@@ -41,6 +42,11 @@ L.Control.Opacity = L.Control.extend({
4142
container.setAttribute('aria-haspopup', true);
4243
L.DomEvent.disableClickPropagation(container);
4344
L.DomEvent.disableScrollPropagation(container);
45+
if(this.options.label){
46+
var labelP = L.DomUtil.create('p', className + "-label");
47+
labelP.innerHTML = this.options.label;
48+
container.appendChild(labelP);
49+
}
4450
var form = this._form = L.DomUtil.create('form', className + '-list');
4551
if (collapsed) {
4652
this._map.on('click', this.collapse, this);

img/img_01.gif

652 KB
Loading

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leaflet.control.opacity",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Leaflet.Control.Opacity is a Leaflet plugin that makes multiple tile layers transparent. (Leaflet v1.x.x)",
55
"main": "dist/L.Control.Opacity.js",
66
"repository": {

src/L.Control.Opacity.css

+5
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ input[type="range"]::-ms-thumb {
2929
border-radius: 12px;
3030
border: 0;
3131
background-image: linear-gradient(to bottom, #1253A4 0, #1253A4 100%);
32+
}
33+
34+
/* 題名レイアウト */
35+
.leaflet-control-layers-label {
36+
margin: 0px 0px 8px 1px
3237
}

src/L.Control.Opacity.js

100644100755
+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ L.Control.Opacity = L.Control.extend({
4343
L.DomEvent.disableClickPropagation(container);
4444
L.DomEvent.disableScrollPropagation(container);
4545
if(this.options.label){
46-
var labelSpan = L.DomUtil.create('span', className + "-label");
47-
labelSpan.innerHTML = this.options.label;
48-
container.appendChild(labelSpan);
46+
var labelP = L.DomUtil.create('p', className + "-label");
47+
labelP.innerHTML = this.options.label;
48+
container.appendChild(labelP);
4949
}
5050
var form = this._form = L.DomUtil.create('form', className + '-list');
5151
if (collapsed) {

0 commit comments

Comments
 (0)