node-red-contrib-web-worldmap 5.6.2 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/README.md +5 -0
- package/node_modules/@turf/bezier-spline/package.json +4 -5
- package/node_modules/@turf/helpers/package.json +2 -3
- package/node_modules/@turf/invariant/package.json +3 -4
- package/node_modules/body-parser/HISTORY.md +6 -0
- package/node_modules/body-parser/lib/types/json.js +1 -5
- package/node_modules/body-parser/lib/types/urlencoded.js +5 -6
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/hasown/CHANGELOG.md +11 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +1 -0
- package/node_modules/hasown/package.json +14 -14
- package/node_modules/side-channel-list/CHANGELOG.md +25 -4
- package/node_modules/side-channel-list/index.js +1 -3
- package/node_modules/side-channel-list/package.json +8 -8
- package/node_modules/side-channel-list/test/index.js +50 -0
- package/package.json +2 -2
- package/worldmap/css/worldmap.css +4 -0
- package/worldmap/index.html +2 -5
- package/worldmap/worldmap.js +323 -56
- package/worldmap.js +9 -7
- package/node_modules/hasown/.eslintrc +0 -5
- package/worldmap/leaflet/Leaflet.Dialog.css +0 -106
- package/worldmap/leaflet/Leaflet.Dialog.js +0 -372
package/worldmap.js
CHANGED
|
@@ -129,7 +129,7 @@ module.exports = function(RED) {
|
|
|
129
129
|
if (node.name) { c.toptitle = node.name; }
|
|
130
130
|
//console.log("INIT",c)
|
|
131
131
|
client.write(JSON.stringify({command:c}));
|
|
132
|
-
for (var p=0; p < pmtiles.length; p++) {
|
|
132
|
+
for (var p=0; p < (pmtiles||[]).length; p++) {
|
|
133
133
|
fs.symlink(RED.settings.userDir+'/'+pmtiles[p], __dirname+'/worldmap/'+pmtiles[p], 'file', (err) => {
|
|
134
134
|
if (err && err.code !== "EEXIST") { console.log(err); }
|
|
135
135
|
})
|
|
@@ -197,11 +197,13 @@ module.exports = function(RED) {
|
|
|
197
197
|
allPoints[msg.payload.name] = RED.util.cloneMessage(msg.payload);
|
|
198
198
|
var t = node.maxage || 3600;
|
|
199
199
|
if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
|
|
200
|
-
|
|
200
|
+
(function(name) {
|
|
201
|
+
allPoints[name].tout = setTimeout(function() { delete allPoints[name]; }, t * 1000);
|
|
202
|
+
})(msg.payload.name);
|
|
201
203
|
}
|
|
202
204
|
if (msg.payload?.command?.map?.delete) {
|
|
203
205
|
var ddd = msg.payload.command.map.delete;
|
|
204
|
-
if (!Array.isArray(ddd)) { ddd = [
|
|
206
|
+
if (!Array.isArray(ddd)) { ddd = [ddd]; }
|
|
205
207
|
for (let a=0; a < ddd.length; a++) {
|
|
206
208
|
for (let p in allPoints) {
|
|
207
209
|
if (allPoints.hasOwnProperty(p)) {
|
|
@@ -384,7 +386,7 @@ module.exports = function(RED) {
|
|
|
384
386
|
}
|
|
385
387
|
}
|
|
386
388
|
clients = {};
|
|
387
|
-
sockets[
|
|
389
|
+
sockets[node.path].removeListener('connection', callback);
|
|
388
390
|
node.status({});
|
|
389
391
|
});
|
|
390
392
|
sockets[this.path].on('connection', callback);
|
|
@@ -398,7 +400,7 @@ module.exports = function(RED) {
|
|
|
398
400
|
this.pointsarray = {};
|
|
399
401
|
this.layer = n.layer || "combined"; // separate, single
|
|
400
402
|
this.smooth = n.smooth || false;
|
|
401
|
-
|
|
403
|
+
const node = this;
|
|
402
404
|
var bezierSpline = require("@turf/bezier-spline").default;
|
|
403
405
|
|
|
404
406
|
var doTrack = function(msg) {
|
|
@@ -409,7 +411,7 @@ module.exports = function(RED) {
|
|
|
409
411
|
if (msg.payload.name.substr(-1) === '_') {
|
|
410
412
|
var a = node.pointsarray[msg.payload.name.substr(0,msg.payload.name.length-1)].pop();
|
|
411
413
|
node.pointsarray[msg.payload.name.substr(0,msg.payload.name.length-1)] = [ a ];
|
|
412
|
-
node.send(newmsg);
|
|
414
|
+
// node.send(newmsg);
|
|
413
415
|
}
|
|
414
416
|
else {
|
|
415
417
|
delete node.pointsarray[msg.payload.name];
|
|
@@ -488,7 +490,7 @@ module.exports = function(RED) {
|
|
|
488
490
|
}
|
|
489
491
|
if (msg.payload?.command?.map?.delete) {
|
|
490
492
|
var ddd = msg.payload.command.map.delete;
|
|
491
|
-
if (!Array.isArray(ddd)) { ddd = [
|
|
493
|
+
if (!Array.isArray(ddd)) { ddd = [ddd]; }
|
|
492
494
|
for (let a=0; a < ddd.length; a++) {
|
|
493
495
|
for (let p in node.pointsarray) {
|
|
494
496
|
if (node.pointsarray.hasOwnProperty(p)) {
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
.leaflet-control-dialog {
|
|
2
|
-
position: absolute;
|
|
3
|
-
background-color: #fff;
|
|
4
|
-
padding: 0px;
|
|
5
|
-
text-align: left;
|
|
6
|
-
border-radius: 4px;
|
|
7
|
-
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.leaflet-control-dialog .leaflet-control-dialog-inner {
|
|
11
|
-
position: relative;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
float: left;
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
padding: 20px 0px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.leaflet-control-dialog
|
|
20
|
-
.leaflet-control-dialog-inner
|
|
21
|
-
.leaflet-control-dialog-grabber {
|
|
22
|
-
position: absolute;
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
width: 20px;
|
|
25
|
-
height: 20px;
|
|
26
|
-
top: 0px;
|
|
27
|
-
left: 0px;
|
|
28
|
-
padding: 3px;
|
|
29
|
-
font-size: 15px;
|
|
30
|
-
line-height: 15px;
|
|
31
|
-
color: #ccc;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.leaflet-control-dialog
|
|
35
|
-
.leaflet-control-dialog-inner
|
|
36
|
-
.leaflet-control-dialog-grabber:hover {
|
|
37
|
-
cursor: grab;
|
|
38
|
-
cursor: -webkit-grab;
|
|
39
|
-
cursor: -moz-grab;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.leaflet-control-dialog
|
|
43
|
-
.leaflet-control-dialog-inner
|
|
44
|
-
.leaflet-control-dialog-close {
|
|
45
|
-
position: absolute;
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
width: 20px;
|
|
48
|
-
height: 20px;
|
|
49
|
-
top: 0px;
|
|
50
|
-
right: 0px;
|
|
51
|
-
padding: 2px;
|
|
52
|
-
font-size: 16px;
|
|
53
|
-
line-height: 16px;
|
|
54
|
-
color: #666;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.leaflet-control-dialog
|
|
58
|
-
.leaflet-control-dialog-inner
|
|
59
|
-
.leaflet-control-dialog-close:hover {
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.leaflet-control-dialog
|
|
64
|
-
.leaflet-control-dialog-inner
|
|
65
|
-
.leaflet-control-dialog-contents {
|
|
66
|
-
position: relative;
|
|
67
|
-
float: left;
|
|
68
|
-
width: 100%;
|
|
69
|
-
height: 100%;
|
|
70
|
-
margin: 0px;
|
|
71
|
-
padding: 0 20px;
|
|
72
|
-
min-height: 50px;
|
|
73
|
-
overflow: auto;
|
|
74
|
-
box-sizing: border-box;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.leaflet-control-dialog
|
|
78
|
-
.leaflet-control-dialog-inner
|
|
79
|
-
.leaflet-control-dialog-resizer {
|
|
80
|
-
position: absolute;
|
|
81
|
-
box-sizing: border-box;
|
|
82
|
-
width: 20px;
|
|
83
|
-
height: 20px;
|
|
84
|
-
bottom: 0px;
|
|
85
|
-
right: 0px;
|
|
86
|
-
padding: 2px;
|
|
87
|
-
font-size: 16px;
|
|
88
|
-
line-height: 16px;
|
|
89
|
-
color: #ccc;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.leaflet-control-dialog
|
|
93
|
-
.leaflet-control-dialog-inner
|
|
94
|
-
.leaflet-control-dialog-resizer:hover {
|
|
95
|
-
cursor: grab;
|
|
96
|
-
cursor: -webkit-grab;
|
|
97
|
-
cursor: -moz-grab;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.fa-rotate-45 {
|
|
101
|
-
-webkit-transform: rotate(45deg);
|
|
102
|
-
-moz-transform: rotate(45deg);
|
|
103
|
-
-ms-transform: rotate(45deg);
|
|
104
|
-
-o-transform: rotate(45deg);
|
|
105
|
-
transform: rotate(45deg);
|
|
106
|
-
}
|
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
L.Control.Dialog = L.Control.extend({
|
|
2
|
-
options: {
|
|
3
|
-
size: [ 300, 300 ],
|
|
4
|
-
minSize: [ 100, 100 ],
|
|
5
|
-
maxSize: [ 350, 350 ],
|
|
6
|
-
anchor: [ 250, 250 ],
|
|
7
|
-
position: "topleft",
|
|
8
|
-
initOpen: true
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
initialize: function(options) {
|
|
12
|
-
this.options = JSON.parse(JSON.stringify(this.options));
|
|
13
|
-
L.setOptions(this, options);
|
|
14
|
-
|
|
15
|
-
this._attributions = {};
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
onAdd: function(map) {
|
|
19
|
-
this._initLayout();
|
|
20
|
-
this._map = map;
|
|
21
|
-
|
|
22
|
-
this.update();
|
|
23
|
-
|
|
24
|
-
if (!this.options.initOpen) {
|
|
25
|
-
this.close();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return this._container;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
open: function() {
|
|
32
|
-
if (!this._map) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this._container.style.visibility = "";
|
|
36
|
-
|
|
37
|
-
this._map.fire("dialog:opened", this);
|
|
38
|
-
|
|
39
|
-
return this;
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
close: function() {
|
|
43
|
-
this._container.style.visibility = "hidden";
|
|
44
|
-
|
|
45
|
-
this._map.fire("dialog:closed", this);
|
|
46
|
-
return this;
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
destroy: function() {
|
|
50
|
-
if (!this._map) {
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
this._map.fire("dialog:destroyed", this);
|
|
55
|
-
this.remove();
|
|
56
|
-
|
|
57
|
-
if (this.onRemove) {
|
|
58
|
-
this.onRemove(this._map);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return this;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
setLocation: function(location) {
|
|
65
|
-
location = location || [ 250, 250 ];
|
|
66
|
-
|
|
67
|
-
this.options.anchor[0] = 0;
|
|
68
|
-
this.options.anchor[1] = 0;
|
|
69
|
-
this._oldMousePos.x = 0;
|
|
70
|
-
this._oldMousePos.y = 0;
|
|
71
|
-
|
|
72
|
-
this._move(location[1], location[0]);
|
|
73
|
-
|
|
74
|
-
return this;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
setSize: function(size) {
|
|
78
|
-
size = size || [ 300, 300 ];
|
|
79
|
-
|
|
80
|
-
this.options.size[0] = 0;
|
|
81
|
-
this.options.size[1] = 0;
|
|
82
|
-
this._oldMousePos.x = 0;
|
|
83
|
-
this._oldMousePos.y = 0;
|
|
84
|
-
|
|
85
|
-
this._resize(size[0], size[1]);
|
|
86
|
-
|
|
87
|
-
return this;
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
lock: function() {
|
|
91
|
-
this._resizerNode.style.visibility = "hidden";
|
|
92
|
-
this._grabberNode.style.visibility = "hidden";
|
|
93
|
-
this._closeNode.style.visibility = "hidden";
|
|
94
|
-
|
|
95
|
-
this._map.fire("dialog:locked", this);
|
|
96
|
-
return this;
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
unlock: function() {
|
|
100
|
-
this._resizerNode.style.visibility = "";
|
|
101
|
-
this._grabberNode.style.visibility = "";
|
|
102
|
-
this._closeNode.style.visibility = "";
|
|
103
|
-
|
|
104
|
-
this._map.fire("dialog:unlocked", this);
|
|
105
|
-
return this;
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
freeze: function() {
|
|
109
|
-
this._resizerNode.style.visibility = "hidden";
|
|
110
|
-
this._grabberNode.style.visibility = "hidden";
|
|
111
|
-
|
|
112
|
-
this._map.fire("dialog:frozen", this);
|
|
113
|
-
return this;
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
unfreeze: function() {
|
|
117
|
-
this._resizerNode.style.visibility = "";
|
|
118
|
-
this._grabberNode.style.visibility = "";
|
|
119
|
-
|
|
120
|
-
this._map.fire("dialog:unfrozen", this);
|
|
121
|
-
return this;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
hideClose: function() {
|
|
125
|
-
this._closeNode.style.visibility = "hidden";
|
|
126
|
-
|
|
127
|
-
this._map.fire("dialog:closehidden", this);
|
|
128
|
-
return this;
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
showClose: function() {
|
|
132
|
-
this._closeNode.style.visibility = "";
|
|
133
|
-
|
|
134
|
-
this._map.fire("dialog:closeshown", this);
|
|
135
|
-
return this;
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
hideResize: function() {
|
|
139
|
-
this._resizerNode.style.visibility = "hidden";
|
|
140
|
-
|
|
141
|
-
this._map.fire("dialog:resizehidden", this);
|
|
142
|
-
return this;
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
showResize: function() {
|
|
146
|
-
this._resizerNode.style.visibility = "";
|
|
147
|
-
|
|
148
|
-
this._map.fire("dialog:resizeshown", this);
|
|
149
|
-
return this;
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
setContent: function(content) {
|
|
153
|
-
this._content = content;
|
|
154
|
-
this.update();
|
|
155
|
-
return this;
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
getContent: function() {
|
|
159
|
-
return this._content;
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
getElement: function() {
|
|
163
|
-
return this._container;
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
update: function() {
|
|
167
|
-
if (!this._map) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
this._container.style.visibility = "hidden";
|
|
172
|
-
|
|
173
|
-
this._updateContent();
|
|
174
|
-
this._updateLayout();
|
|
175
|
-
|
|
176
|
-
this._container.style.visibility = "";
|
|
177
|
-
this._map.fire("dialog:updated", this);
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
_initLayout: function() {
|
|
181
|
-
var className = "leaflet-control-dialog",
|
|
182
|
-
container = (this._container = L.DomUtil.create("div", className));
|
|
183
|
-
|
|
184
|
-
container.style.width = this.options.size[0] + "px";
|
|
185
|
-
container.style.height = this.options.size[1] + "px";
|
|
186
|
-
|
|
187
|
-
container.style.top = this.options.anchor[0] + "px";
|
|
188
|
-
container.style.left = this.options.anchor[1] + "px";
|
|
189
|
-
|
|
190
|
-
var stop = L.DomEvent.stopPropagation;
|
|
191
|
-
L.DomEvent.on(container, "click", stop)
|
|
192
|
-
.on(container, "mousedown", stop)
|
|
193
|
-
.on(container, "touchstart", stop)
|
|
194
|
-
.on(container, "dblclick", stop)
|
|
195
|
-
.on(container, "mousewheel", stop)
|
|
196
|
-
.on(container, "contextmenu", stop)
|
|
197
|
-
.on(container, "MozMousePixelScroll", stop);
|
|
198
|
-
|
|
199
|
-
var innerContainer = (this._innerContainer = L.DomUtil.create(
|
|
200
|
-
"div",
|
|
201
|
-
className + "-inner"
|
|
202
|
-
));
|
|
203
|
-
|
|
204
|
-
var grabberNode = (this._grabberNode = L.DomUtil.create(
|
|
205
|
-
"div",
|
|
206
|
-
className + "-grabber"
|
|
207
|
-
));
|
|
208
|
-
var grabberIcon = L.DomUtil.create("i", "fa fa-arrows");
|
|
209
|
-
grabberNode.appendChild(grabberIcon);
|
|
210
|
-
|
|
211
|
-
L.DomEvent.on(grabberNode, "mousedown", this._handleMoveStart, this);
|
|
212
|
-
|
|
213
|
-
var closeNode = (this._closeNode = L.DomUtil.create(
|
|
214
|
-
"div",
|
|
215
|
-
className + "-close"
|
|
216
|
-
));
|
|
217
|
-
var closeIcon = L.DomUtil.create("i", "fa fa-times");
|
|
218
|
-
closeNode.appendChild(closeIcon);
|
|
219
|
-
L.DomEvent.on(closeNode, "click", this._handleClose, this);
|
|
220
|
-
|
|
221
|
-
var resizerNode = (this._resizerNode = L.DomUtil.create(
|
|
222
|
-
"div",
|
|
223
|
-
className + "-resizer"
|
|
224
|
-
));
|
|
225
|
-
var resizeIcon = L.DomUtil.create("i", "fa fa-arrows-h fa-rotate-45");
|
|
226
|
-
resizerNode.appendChild(resizeIcon);
|
|
227
|
-
|
|
228
|
-
L.DomEvent.on(resizerNode, "mousedown", this._handleResizeStart, this);
|
|
229
|
-
|
|
230
|
-
var contentNode = (this._contentNode = L.DomUtil.create(
|
|
231
|
-
"div",
|
|
232
|
-
className + "-contents"
|
|
233
|
-
));
|
|
234
|
-
|
|
235
|
-
container.appendChild(innerContainer);
|
|
236
|
-
|
|
237
|
-
innerContainer.appendChild(contentNode);
|
|
238
|
-
innerContainer.appendChild(grabberNode);
|
|
239
|
-
innerContainer.appendChild(closeNode);
|
|
240
|
-
innerContainer.appendChild(resizerNode);
|
|
241
|
-
|
|
242
|
-
this._oldMousePos = { x: 0, y: 0 };
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
_handleClose: function() {
|
|
246
|
-
this.close();
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
_handleResizeStart: function(e) {
|
|
250
|
-
this._oldMousePos.x = e.clientX;
|
|
251
|
-
this._oldMousePos.y = e.clientY;
|
|
252
|
-
|
|
253
|
-
L.DomEvent.on(this._map, "mousemove", this._handleMouseMove, this);
|
|
254
|
-
L.DomEvent.on(this._map, "mouseup", this._handleMouseUp, this);
|
|
255
|
-
|
|
256
|
-
this._map.fire("dialog:resizestart", this);
|
|
257
|
-
this._resizing = true;
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
_handleMoveStart: function(e) {
|
|
261
|
-
this._oldMousePos.x = e.clientX;
|
|
262
|
-
this._oldMousePos.y = e.clientY;
|
|
263
|
-
|
|
264
|
-
L.DomEvent.on(this._map, "mousemove", this._handleMouseMove, this);
|
|
265
|
-
L.DomEvent.on(this._map, "mouseup", this._handleMouseUp, this);
|
|
266
|
-
|
|
267
|
-
this._map.fire("dialog:movestart", this);
|
|
268
|
-
this._moving = true;
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
_handleMouseMove: function(e) {
|
|
272
|
-
var diffX = e.originalEvent.clientX - this._oldMousePos.x,
|
|
273
|
-
diffY = e.originalEvent.clientY - this._oldMousePos.y;
|
|
274
|
-
|
|
275
|
-
// this helps prevent accidental highlighting on drag:
|
|
276
|
-
if (e.originalEvent.stopPropagation) {
|
|
277
|
-
e.originalEvent.stopPropagation();
|
|
278
|
-
}
|
|
279
|
-
if (e.originalEvent.preventDefault) {
|
|
280
|
-
e.originalEvent.preventDefault();
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (this._resizing) {
|
|
284
|
-
this._resize(diffX, diffY);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (this._moving) {
|
|
288
|
-
this._move(diffX, diffY);
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
|
|
292
|
-
_handleMouseUp: function() {
|
|
293
|
-
L.DomEvent.off(this._map, "mousemove", this._handleMouseMove, this);
|
|
294
|
-
L.DomEvent.off(this._map, "mouseup", this._handleMouseUp, this);
|
|
295
|
-
|
|
296
|
-
if (this._resizing) {
|
|
297
|
-
this._resizing = false;
|
|
298
|
-
this._map.fire("dialog:resizeend", this);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (this._moving) {
|
|
302
|
-
this._moving = false;
|
|
303
|
-
this._map.fire("dialog:moveend", this);
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
_move: function(diffX, diffY) {
|
|
308
|
-
var newY = this.options.anchor[0] + diffY;
|
|
309
|
-
var newX = this.options.anchor[1] + diffX;
|
|
310
|
-
|
|
311
|
-
this.options.anchor[0] = newY;
|
|
312
|
-
this.options.anchor[1] = newX;
|
|
313
|
-
|
|
314
|
-
this._container.style.top = this.options.anchor[0] + "px";
|
|
315
|
-
this._container.style.left = this.options.anchor[1] + "px";
|
|
316
|
-
|
|
317
|
-
this._map.fire("dialog:moving", this);
|
|
318
|
-
|
|
319
|
-
this._oldMousePos.y += diffY;
|
|
320
|
-
this._oldMousePos.x += diffX;
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
_resize: function(diffX, diffY) {
|
|
324
|
-
var newX = this.options.size[0] + diffX;
|
|
325
|
-
var newY = this.options.size[1] + diffY;
|
|
326
|
-
|
|
327
|
-
if (newX <= this.options.maxSize[0] && newX >= this.options.minSize[0]) {
|
|
328
|
-
this.options.size[0] = newX;
|
|
329
|
-
this._container.style.width = this.options.size[0] + "px";
|
|
330
|
-
this._oldMousePos.x += diffX;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (newY <= this.options.maxSize[1] && newY >= this.options.minSize[1]) {
|
|
334
|
-
this.options.size[1] = newY;
|
|
335
|
-
this._container.style.height = this.options.size[1] + "px";
|
|
336
|
-
this._oldMousePos.y += diffY;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
this._map.fire("dialog:resizing", this);
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
_updateContent: function() {
|
|
343
|
-
if (!this._content) {
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
var node = this._contentNode;
|
|
348
|
-
var content =
|
|
349
|
-
typeof this._content === "function" ? this._content(this) : this._content;
|
|
350
|
-
|
|
351
|
-
if (typeof content === "string") {
|
|
352
|
-
node.innerHTML = content;
|
|
353
|
-
} else {
|
|
354
|
-
while (node.hasChildNodes()) {
|
|
355
|
-
node.removeChild(node.firstChild);
|
|
356
|
-
}
|
|
357
|
-
node.appendChild(content);
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
_updateLayout: function() {
|
|
362
|
-
this._container.style.width = this.options.size[0] + "px";
|
|
363
|
-
this._container.style.height = this.options.size[1] + "px";
|
|
364
|
-
|
|
365
|
-
this._container.style.top = this.options.anchor[0] + "px";
|
|
366
|
-
this._container.style.left = this.options.anchor[1] + "px";
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
L.control.dialog = function(options) {
|
|
371
|
-
return new L.Control.Dialog(options);
|
|
372
|
-
};
|