umap-project 2.4.0b2__py3-none-any.whl → 2.4.2__py3-none-any.whl
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.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/locale/el/LC_MESSAGES/django.po +145 -90
- umap/locale/en/LC_MESSAGES/django.po +3 -3
- umap/locale/eu/LC_MESSAGES/django.po +145 -89
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +87 -37
- umap/static/umap/base.css +20 -6
- umap/static/umap/content.css +2 -2
- umap/static/umap/css/dialog.css +1 -1
- umap/static/umap/css/importers.css +2 -0
- umap/static/umap/css/panel.css +2 -2
- umap/static/umap/css/tooltip.css +1 -1
- umap/static/umap/img/16-white.svg +1 -3
- umap/static/umap/img/source/16-white.svg +2 -4
- umap/static/umap/js/components/alerts/alert.css +1 -1
- umap/static/umap/js/components/alerts/alert.js +1 -1
- umap/static/umap/js/modules/autocomplete.js +4 -4
- umap/static/umap/js/modules/browser.js +11 -11
- umap/static/umap/js/modules/caption.js +5 -5
- umap/static/umap/js/modules/dompurify.js +2 -3
- umap/static/umap/js/modules/facets.js +16 -10
- umap/static/umap/js/modules/global.js +16 -16
- umap/static/umap/js/modules/help.js +2 -2
- umap/static/umap/js/modules/importer.js +6 -6
- umap/static/umap/js/modules/importers/geodatamine.js +4 -4
- umap/static/umap/js/modules/importers/overpass.js +2 -2
- umap/static/umap/js/modules/orderable.js +2 -2
- umap/static/umap/js/modules/request.js +1 -1
- umap/static/umap/js/modules/rules.js +13 -10
- umap/static/umap/js/modules/sync/engine.js +3 -3
- umap/static/umap/js/modules/sync/updaters.js +10 -11
- umap/static/umap/js/modules/sync/websocket.js +1 -1
- umap/static/umap/js/modules/ui/dialog.js +1 -1
- umap/static/umap/js/modules/ui/panel.js +1 -1
- umap/static/umap/js/modules/ui/tooltip.js +6 -6
- umap/static/umap/js/modules/urls.js +1 -2
- umap/static/umap/js/modules/utils.js +19 -19
- umap/static/umap/js/umap.controls.js +26 -28
- umap/static/umap/js/umap.core.js +19 -15
- umap/static/umap/js/umap.datalayer.permissions.js +15 -18
- umap/static/umap/js/umap.features.js +102 -120
- umap/static/umap/js/umap.forms.js +46 -74
- umap/static/umap/js/umap.icon.js +17 -22
- umap/static/umap/js/umap.js +126 -131
- umap/static/umap/js/umap.layer.js +159 -167
- umap/static/umap/js/umap.permissions.js +6 -9
- umap/static/umap/js/umap.popup.js +20 -20
- umap/static/umap/js/umap.share.js +9 -15
- umap/static/umap/js/umap.slideshow.js +12 -14
- umap/static/umap/js/umap.tableeditor.js +5 -5
- umap/static/umap/locale/am_ET.json +5 -2
- umap/static/umap/locale/ar.json +5 -2
- umap/static/umap/locale/ast.json +5 -2
- umap/static/umap/locale/bg.json +5 -2
- umap/static/umap/locale/br.json +5 -2
- umap/static/umap/locale/ca.json +5 -2
- umap/static/umap/locale/cs_CZ.json +5 -2
- umap/static/umap/locale/da.json +5 -2
- umap/static/umap/locale/de.json +5 -2
- umap/static/umap/locale/el.json +10 -7
- umap/static/umap/locale/en.js +2 -1
- umap/static/umap/locale/en.json +5 -2
- umap/static/umap/locale/en_US.json +5 -2
- umap/static/umap/locale/es.js +9 -8
- umap/static/umap/locale/es.json +12 -9
- umap/static/umap/locale/et.json +5 -2
- umap/static/umap/locale/fa_IR.json +5 -2
- umap/static/umap/locale/fi.json +5 -2
- umap/static/umap/locale/fr.js +2 -1
- umap/static/umap/locale/fr.json +5 -2
- umap/static/umap/locale/gl.json +5 -2
- umap/static/umap/locale/he.json +5 -2
- umap/static/umap/locale/hr.json +5 -2
- umap/static/umap/locale/hu.json +5 -2
- umap/static/umap/locale/id.json +5 -2
- umap/static/umap/locale/is.json +5 -2
- umap/static/umap/locale/it.json +5 -2
- umap/static/umap/locale/ja.json +5 -2
- umap/static/umap/locale/ko.json +5 -2
- umap/static/umap/locale/lt.json +5 -2
- umap/static/umap/locale/ms.json +5 -2
- umap/static/umap/locale/nl.json +5 -2
- umap/static/umap/locale/no.json +5 -2
- umap/static/umap/locale/pl.json +5 -2
- umap/static/umap/locale/pl_PL.json +5 -2
- umap/static/umap/locale/pt.js +61 -60
- umap/static/umap/locale/pt.json +64 -61
- umap/static/umap/locale/pt_BR.json +5 -2
- umap/static/umap/locale/pt_PT.json +5 -2
- umap/static/umap/locale/ro.json +5 -2
- umap/static/umap/locale/ru.json +5 -2
- umap/static/umap/locale/sk_SK.json +5 -2
- umap/static/umap/locale/sl.json +5 -2
- umap/static/umap/locale/sr.json +5 -2
- umap/static/umap/locale/sv.json +5 -2
- umap/static/umap/locale/th_TH.json +5 -2
- umap/static/umap/locale/tr.json +5 -2
- umap/static/umap/locale/uk_UA.json +5 -2
- umap/static/umap/locale/vi.json +5 -2
- umap/static/umap/locale/vi_VN.json +5 -2
- umap/static/umap/locale/zh.json +5 -2
- umap/static/umap/locale/zh_CN.json +5 -2
- umap/static/umap/locale/zh_TW.Big5.json +5 -2
- umap/static/umap/locale/zh_TW.json +5 -2
- umap/static/umap/map.css +22 -22
- umap/static/umap/unittests/utils.js +5 -5
- umap/static/umap/vars.css +12 -1
- umap/storage.py +1 -1
- umap/tests/integration/test_browser.py +76 -3
- umap/tests/integration/test_edit_polygon.py +11 -0
- umap/tests/integration/test_map.py +29 -0
- umap/tests/integration/test_map_preview.py +36 -2
- umap/tests/integration/test_view_marker.py +2 -2
- umap/tests/test_views.py +2 -2
- umap/views.py +3 -2
- {umap_project-2.4.0b2.dist-info → umap_project-2.4.2.dist-info}/METADATA +3 -3
- {umap_project-2.4.0b2.dist-info → umap_project-2.4.2.dist-info}/RECORD +120 -129
- {umap_project-2.4.0b2.dist-info → umap_project-2.4.2.dist-info}/WHEEL +1 -1
- umap/.DS_Store +0 -0
- umap/static/.DS_Store +0 -0
- umap/static/umap/.DS_Store +0 -0
- umap/static/umap/favicons/.DS_Store +0 -0
- umap/static/umap/fonts/.DS_Store +0 -0
- umap/static/umap/img/.DS_Store +0 -0
- umap/static/umap/img/source/.DS_Store +0 -0
- umap/tests/.DS_Store +0 -0
- umap/tests/integration/.DS_Store +0 -0
- {umap_project-2.4.0b2.dist-info → umap_project-2.4.2.dist-info}/entry_points.txt +0 -0
- {umap_project-2.4.0b2.dist-info → umap_project-2.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,7 +6,7 @@ U.FeatureMixin = {
|
|
|
6
6
|
subject: 'feature',
|
|
7
7
|
metadata: {
|
|
8
8
|
id: this.id,
|
|
9
|
-
layerId: this.datalayer?.
|
|
9
|
+
layerId: this.datalayer?.umap_id || null,
|
|
10
10
|
featureType: this.getClassName(),
|
|
11
11
|
},
|
|
12
12
|
}
|
|
@@ -15,7 +15,18 @@ U.FeatureMixin = {
|
|
|
15
15
|
onCommit: function () {
|
|
16
16
|
// When the layer is a remote layer, we don't want to sync the creation of the
|
|
17
17
|
// points via the websocket, as the other peers will get them themselves.
|
|
18
|
-
if (this.datalayer
|
|
18
|
+
if (this.datalayer?.isRemoteLayer()) return
|
|
19
|
+
|
|
20
|
+
// The "endEdit" event is triggered at the end of an edition,
|
|
21
|
+
// and will trigger the sync.
|
|
22
|
+
// In the case of a deletion (or a change of layer), we don't want this
|
|
23
|
+
// event triggered to cause a sync event, as it would reintroduce
|
|
24
|
+
// deleted features.
|
|
25
|
+
// The `._marked_for_deletion` private property is here to track this status.
|
|
26
|
+
if (this._marked_for_deletion === true) {
|
|
27
|
+
this._marked_for_deletion = false
|
|
28
|
+
return
|
|
29
|
+
}
|
|
19
30
|
this.sync.upsert(this.toGeoJSON())
|
|
20
31
|
},
|
|
21
32
|
|
|
@@ -23,13 +34,10 @@ U.FeatureMixin = {
|
|
|
23
34
|
return this.toGeoJSON().geometry
|
|
24
35
|
},
|
|
25
36
|
|
|
26
|
-
syncDelete: function () {
|
|
27
|
-
this.sync.delete()
|
|
28
|
-
},
|
|
29
|
-
|
|
30
37
|
initialize: function (map, latlng, options, id) {
|
|
31
38
|
this.map = map
|
|
32
39
|
this.sync = map.sync_engine.proxy(this)
|
|
40
|
+
this._marked_for_deletion = false
|
|
33
41
|
|
|
34
42
|
if (typeof options === 'undefined') {
|
|
35
43
|
options = {}
|
|
@@ -58,19 +66,16 @@ U.FeatureMixin = {
|
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
let isDirty = false
|
|
61
|
-
const self = this
|
|
62
69
|
try {
|
|
63
70
|
Object.defineProperty(this, 'isDirty', {
|
|
64
|
-
get:
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
set: function (status) {
|
|
71
|
+
get: () => isDirty,
|
|
72
|
+
set: (status) => {
|
|
68
73
|
if (!isDirty && status) {
|
|
69
|
-
|
|
74
|
+
this.fire('isdirty')
|
|
70
75
|
}
|
|
71
76
|
isDirty = status
|
|
72
|
-
if (
|
|
73
|
-
|
|
77
|
+
if (this.datalayer) {
|
|
78
|
+
this.datalayer.isDirty = status
|
|
74
79
|
}
|
|
75
80
|
},
|
|
76
81
|
})
|
|
@@ -82,10 +87,10 @@ U.FeatureMixin = {
|
|
|
82
87
|
this.parentClass.prototype.initialize.call(this, latlng, options)
|
|
83
88
|
},
|
|
84
89
|
|
|
85
|
-
preInit:
|
|
90
|
+
preInit: () => {},
|
|
86
91
|
|
|
87
92
|
isReadOnly: function () {
|
|
88
|
-
return this.datalayer
|
|
93
|
+
return this.datalayer?.isDataReadOnly()
|
|
89
94
|
},
|
|
90
95
|
|
|
91
96
|
getSlug: function () {
|
|
@@ -144,7 +149,11 @@ U.FeatureMixin = {
|
|
|
144
149
|
edit: function (e) {
|
|
145
150
|
if (!this.map.editEnabled || this.isReadOnly()) return
|
|
146
151
|
const container = L.DomUtil.create('div', 'umap-feature-container')
|
|
147
|
-
L.DomUtil.createTitle(
|
|
152
|
+
L.DomUtil.createTitle(
|
|
153
|
+
container,
|
|
154
|
+
L._('Feature properties'),
|
|
155
|
+
`icon-${this.getClassName()}`
|
|
156
|
+
)
|
|
148
157
|
|
|
149
158
|
let builder = new U.FormBuilder(
|
|
150
159
|
this,
|
|
@@ -224,19 +233,17 @@ U.FeatureMixin = {
|
|
|
224
233
|
popupFieldset.appendChild(builder.build())
|
|
225
234
|
},
|
|
226
235
|
|
|
227
|
-
getInteractionOptions:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
]
|
|
237
|
-
},
|
|
236
|
+
getInteractionOptions: () => [
|
|
237
|
+
'properties._umap_options.popupShape',
|
|
238
|
+
'properties._umap_options.popupTemplate',
|
|
239
|
+
'properties._umap_options.showLabel',
|
|
240
|
+
'properties._umap_options.labelDirection',
|
|
241
|
+
'properties._umap_options.labelInteractive',
|
|
242
|
+
'properties._umap_options.outlink',
|
|
243
|
+
'properties._umap_options.outlinkTarget',
|
|
244
|
+
],
|
|
238
245
|
|
|
239
|
-
endEdit:
|
|
246
|
+
endEdit: () => {},
|
|
240
247
|
|
|
241
248
|
getDisplayName: function (fallback) {
|
|
242
249
|
if (fallback === undefined) fallback = this.datalayer.options.name
|
|
@@ -272,14 +279,12 @@ U.FeatureMixin = {
|
|
|
272
279
|
}
|
|
273
280
|
return false
|
|
274
281
|
},
|
|
282
|
+
|
|
275
283
|
del: function (sync) {
|
|
276
284
|
this.isDirty = true
|
|
277
285
|
this.map.closePopup()
|
|
278
286
|
if (this.datalayer) {
|
|
279
|
-
this.datalayer.removeLayer(this)
|
|
280
|
-
this.disconnectFromDataLayer(this.datalayer)
|
|
281
|
-
|
|
282
|
-
if (sync !== false) this.syncDelete()
|
|
287
|
+
this.datalayer.removeLayer(this, sync)
|
|
283
288
|
}
|
|
284
289
|
},
|
|
285
290
|
|
|
@@ -294,7 +299,7 @@ U.FeatureMixin = {
|
|
|
294
299
|
}
|
|
295
300
|
},
|
|
296
301
|
|
|
297
|
-
cleanProperty:
|
|
302
|
+
cleanProperty: ([key, value]) => {
|
|
298
303
|
// dot in key will break the dot based property access
|
|
299
304
|
// while editing the feature
|
|
300
305
|
key = key.replace('.', '_')
|
|
@@ -322,7 +327,9 @@ U.FeatureMixin = {
|
|
|
322
327
|
this.datalayer.isDirty = true
|
|
323
328
|
this.datalayer.removeLayer(this)
|
|
324
329
|
}
|
|
330
|
+
|
|
325
331
|
datalayer.addLayer(this)
|
|
332
|
+
this.sync.upsert(this.toGeoJSON())
|
|
326
333
|
datalayer.isDirty = true
|
|
327
334
|
this._redraw()
|
|
328
335
|
},
|
|
@@ -407,7 +414,7 @@ U.FeatureMixin = {
|
|
|
407
414
|
},
|
|
408
415
|
|
|
409
416
|
_onClick: function (e) {
|
|
410
|
-
if (this.map.measureTools
|
|
417
|
+
if (this.map.measureTools?.enabled()) return
|
|
411
418
|
this._popupHandlersAdded = true // Prevent leaflet from managing event
|
|
412
419
|
if (!this.map.editEnabled) {
|
|
413
420
|
this.view(e)
|
|
@@ -430,13 +437,9 @@ U.FeatureMixin = {
|
|
|
430
437
|
L.DomEvent.stop(e)
|
|
431
438
|
},
|
|
432
439
|
|
|
433
|
-
getPopupToolbarAnchor:
|
|
434
|
-
return [0, 0]
|
|
435
|
-
},
|
|
440
|
+
getPopupToolbarAnchor: () => [0, 0],
|
|
436
441
|
|
|
437
|
-
getInplaceToolbarActions:
|
|
438
|
-
return [U.ToggleEditAction, U.DeleteFeatureAction]
|
|
439
|
-
},
|
|
442
|
+
getInplaceToolbarActions: (e) => [U.ToggleEditAction, U.DeleteFeatureAction],
|
|
440
443
|
|
|
441
444
|
_showContextMenu: function (e) {
|
|
442
445
|
L.DomEvent.stop(e)
|
|
@@ -459,7 +462,7 @@ U.FeatureMixin = {
|
|
|
459
462
|
if (permalink)
|
|
460
463
|
items.push({
|
|
461
464
|
text: L._('Permalink'),
|
|
462
|
-
callback:
|
|
465
|
+
callback: () => {
|
|
463
466
|
window.open(permalink)
|
|
464
467
|
},
|
|
465
468
|
})
|
|
@@ -473,7 +476,7 @@ U.FeatureMixin = {
|
|
|
473
476
|
let items = ['-']
|
|
474
477
|
if (this.map.editedFeature !== this) {
|
|
475
478
|
items.push({
|
|
476
|
-
text: L._('Edit this feature')
|
|
479
|
+
text: `${L._('Edit this feature')} (⇧+Click)`,
|
|
477
480
|
callback: this.edit,
|
|
478
481
|
context: this,
|
|
479
482
|
iconCls: 'umap-edit',
|
|
@@ -504,6 +507,7 @@ U.FeatureMixin = {
|
|
|
504
507
|
onRemove: function (map) {
|
|
505
508
|
this.parentClass.prototype.onRemove.call(this, map)
|
|
506
509
|
if (this.map.editedFeature === this) {
|
|
510
|
+
this._marked_for_deletion = true
|
|
507
511
|
this.endEdit()
|
|
508
512
|
this.map.editPanel.close()
|
|
509
513
|
}
|
|
@@ -528,7 +532,7 @@ U.FeatureMixin = {
|
|
|
528
532
|
},
|
|
529
533
|
|
|
530
534
|
isFiltered: function () {
|
|
531
|
-
const filterKeys = this.
|
|
535
|
+
const filterKeys = this.datalayer.getFilterKeys()
|
|
532
536
|
const filter = this.map.browser.options.filter
|
|
533
537
|
if (filter && !this.matchFilter(filter, filterKeys)) return true
|
|
534
538
|
if (!this.matchFacets()) return true
|
|
@@ -537,8 +541,12 @@ U.FeatureMixin = {
|
|
|
537
541
|
|
|
538
542
|
matchFilter: function (filter, keys) {
|
|
539
543
|
filter = filter.toLowerCase()
|
|
544
|
+
if (U.Utils.hasVar(keys)) {
|
|
545
|
+
return this.getDisplayName().toLowerCase().indexOf(filter) !== -1
|
|
546
|
+
}
|
|
547
|
+
keys = keys.split(',')
|
|
540
548
|
for (let i = 0, value; i < keys.length; i++) {
|
|
541
|
-
value =
|
|
549
|
+
value = `${this.properties[keys[i]] || ''}`
|
|
542
550
|
if (value.toLowerCase().indexOf(filter) !== -1) return true
|
|
543
551
|
}
|
|
544
552
|
return false
|
|
@@ -546,16 +554,16 @@ U.FeatureMixin = {
|
|
|
546
554
|
|
|
547
555
|
matchFacets: function () {
|
|
548
556
|
const selected = this.map.facets.selected
|
|
549
|
-
for (
|
|
557
|
+
for (const [name, { type, min, max, choices }] of Object.entries(selected)) {
|
|
550
558
|
let value = this.properties[name]
|
|
551
|
-
|
|
559
|
+
const parser = this.map.facets.getParser(type)
|
|
552
560
|
value = parser(value)
|
|
553
561
|
switch (type) {
|
|
554
562
|
case 'date':
|
|
555
563
|
case 'datetime':
|
|
556
564
|
case 'number':
|
|
557
|
-
if (!isNaN(min) && !isNaN(value) && min > value) return false
|
|
558
|
-
if (!isNaN(max) && !isNaN(value) && max < value) return false
|
|
565
|
+
if (!Number.isNaN(min) && !Number.isNaN(value) && min > value) return false
|
|
566
|
+
if (!Number.isNaN(max) && !Number.isNaN(value) && max < value) return false
|
|
559
567
|
break
|
|
560
568
|
default:
|
|
561
569
|
value = value || L._('<empty value>')
|
|
@@ -573,13 +581,9 @@ U.FeatureMixin = {
|
|
|
573
581
|
}).addTo(this.map, this, e.latlng, e.vertex)
|
|
574
582
|
},
|
|
575
583
|
|
|
576
|
-
getVertexActions:
|
|
577
|
-
return [U.DeleteVertexAction]
|
|
578
|
-
},
|
|
584
|
+
getVertexActions: () => [U.DeleteVertexAction],
|
|
579
585
|
|
|
580
|
-
isMulti:
|
|
581
|
-
return false
|
|
582
|
-
},
|
|
586
|
+
isMulti: () => false,
|
|
583
587
|
|
|
584
588
|
clone: function () {
|
|
585
589
|
const geoJSON = this.toGeoJSON()
|
|
@@ -598,7 +602,7 @@ U.FeatureMixin = {
|
|
|
598
602
|
if (locale) properties.locale = locale
|
|
599
603
|
if (L.lang) properties.lang = L.lang
|
|
600
604
|
properties.rank = this.getRank() + 1
|
|
601
|
-
if (this.hasGeom()) {
|
|
605
|
+
if (this._map && this.hasGeom()) {
|
|
602
606
|
center = this.getCenter()
|
|
603
607
|
properties.lat = center.lat
|
|
604
608
|
properties.lon = center.lng
|
|
@@ -655,11 +659,7 @@ U.Marker = L.Marker.extend({
|
|
|
655
659
|
},
|
|
656
660
|
|
|
657
661
|
_onMouseOut: function () {
|
|
658
|
-
if (
|
|
659
|
-
this.dragging &&
|
|
660
|
-
this.dragging._draggable &&
|
|
661
|
-
!this.dragging._draggable._moving
|
|
662
|
-
) {
|
|
662
|
+
if (this.dragging?._draggable && !this.dragging._draggable._moving) {
|
|
663
663
|
// Do not disable if the mouse went out while dragging
|
|
664
664
|
this._disableDragging()
|
|
665
665
|
}
|
|
@@ -680,14 +680,14 @@ U.Marker = L.Marker.extend({
|
|
|
680
680
|
|
|
681
681
|
_disableDragging: function () {
|
|
682
682
|
if (this.map.editEnabled) {
|
|
683
|
-
if (this.editor
|
|
683
|
+
if (this.editor?.drawing) return // when creating a new marker, the mouse can trigger the mouseover/mouseout event
|
|
684
684
|
// do not listen to them
|
|
685
685
|
this.disableEdit()
|
|
686
686
|
}
|
|
687
687
|
},
|
|
688
688
|
|
|
689
689
|
_redraw: function () {
|
|
690
|
-
if (this.datalayer
|
|
690
|
+
if (this.datalayer?.isVisible()) {
|
|
691
691
|
this._initIcon()
|
|
692
692
|
this.update()
|
|
693
693
|
}
|
|
@@ -702,8 +702,8 @@ U.Marker = L.Marker.extend({
|
|
|
702
702
|
},
|
|
703
703
|
|
|
704
704
|
_getTooltipAnchor: function () {
|
|
705
|
-
const anchor = this.options.icon.options.tooltipAnchor.clone()
|
|
706
|
-
|
|
705
|
+
const anchor = this.options.icon.options.tooltipAnchor.clone()
|
|
706
|
+
const direction = this.getOption('labelDirection')
|
|
707
707
|
if (direction === 'left') {
|
|
708
708
|
anchor.x *= -1
|
|
709
709
|
} else if (direction === 'bottom') {
|
|
@@ -738,22 +738,16 @@ U.Marker = L.Marker.extend({
|
|
|
738
738
|
return this._latlng
|
|
739
739
|
},
|
|
740
740
|
|
|
741
|
-
getClassName:
|
|
742
|
-
return 'marker'
|
|
743
|
-
},
|
|
741
|
+
getClassName: () => 'marker',
|
|
744
742
|
|
|
745
|
-
getShapeOptions:
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
]
|
|
752
|
-
},
|
|
743
|
+
getShapeOptions: () => [
|
|
744
|
+
'properties._umap_options.color',
|
|
745
|
+
'properties._umap_options.iconClass',
|
|
746
|
+
'properties._umap_options.iconUrl',
|
|
747
|
+
'properties._umap_options.iconOpacity',
|
|
748
|
+
],
|
|
753
749
|
|
|
754
|
-
getAdvancedOptions:
|
|
755
|
-
return ['properties._umap_options.zoomTo']
|
|
756
|
-
},
|
|
750
|
+
getAdvancedOptions: () => ['properties._umap_options.zoomTo'],
|
|
757
751
|
|
|
758
752
|
appendEditFieldsets: function (container) {
|
|
759
753
|
U.FeatureMixin.appendEditFieldsets.call(this, container)
|
|
@@ -839,21 +833,17 @@ U.PathMixin = {
|
|
|
839
833
|
'interactive',
|
|
840
834
|
],
|
|
841
835
|
|
|
842
|
-
getShapeOptions:
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
]
|
|
848
|
-
},
|
|
836
|
+
getShapeOptions: () => [
|
|
837
|
+
'properties._umap_options.color',
|
|
838
|
+
'properties._umap_options.opacity',
|
|
839
|
+
'properties._umap_options.weight',
|
|
840
|
+
],
|
|
849
841
|
|
|
850
|
-
getAdvancedOptions:
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
]
|
|
856
|
-
},
|
|
842
|
+
getAdvancedOptions: () => [
|
|
843
|
+
'properties._umap_options.smoothFactor',
|
|
844
|
+
'properties._umap_options.dashArray',
|
|
845
|
+
'properties._umap_options.zoomTo',
|
|
846
|
+
],
|
|
857
847
|
|
|
858
848
|
setStyle: function (options) {
|
|
859
849
|
options = options || {}
|
|
@@ -868,7 +858,7 @@ U.PathMixin = {
|
|
|
868
858
|
},
|
|
869
859
|
|
|
870
860
|
_redraw: function () {
|
|
871
|
-
if (this.datalayer
|
|
861
|
+
if (this.datalayer?.isVisible()) {
|
|
872
862
|
this.setStyle()
|
|
873
863
|
this.resetTooltip()
|
|
874
864
|
}
|
|
@@ -882,14 +872,14 @@ U.PathMixin = {
|
|
|
882
872
|
// this.map.on('showmeasure', this.showMeasureTooltip, this);
|
|
883
873
|
// this.map.on('hidemeasure', this.removeTooltip, this);
|
|
884
874
|
this.parentClass.prototype.onAdd.call(this, map)
|
|
885
|
-
if (this.editing
|
|
875
|
+
if (this.editing?.enabled()) this.editing.addHooks()
|
|
886
876
|
this.resetTooltip()
|
|
887
877
|
},
|
|
888
878
|
|
|
889
879
|
onRemove: function (map) {
|
|
890
880
|
// this.map.off('showmeasure', this.showMeasureTooltip, this);
|
|
891
881
|
// this.map.off('hidemeasure', this.removeTooltip, this);
|
|
892
|
-
if (this.editing
|
|
882
|
+
if (this.editing?.enabled()) this.editing.removeHooks()
|
|
893
883
|
U.FeatureMixin.onRemove.call(this, map)
|
|
894
884
|
},
|
|
895
885
|
|
|
@@ -911,7 +901,7 @@ U.PathMixin = {
|
|
|
911
901
|
},
|
|
912
902
|
|
|
913
903
|
_onMouseOver: function () {
|
|
914
|
-
if (this.map.measureTools
|
|
904
|
+
if (this.map.measureTools?.enabled()) {
|
|
915
905
|
this.map.tooltip.open({ content: this.getMeasure(), anchor: this })
|
|
916
906
|
} else if (this.map.editEnabled && !this.map.editedFeature) {
|
|
917
907
|
this.map.tooltip.open({ content: L._('Click to edit'), anchor: this })
|
|
@@ -1062,13 +1052,9 @@ U.Polyline = L.Polyline.extend({
|
|
|
1062
1052
|
mainColor: 'color',
|
|
1063
1053
|
},
|
|
1064
1054
|
|
|
1065
|
-
isSameClass:
|
|
1066
|
-
return other instanceof U.Polyline
|
|
1067
|
-
},
|
|
1055
|
+
isSameClass: (other) => other instanceof U.Polyline,
|
|
1068
1056
|
|
|
1069
|
-
getClassName:
|
|
1070
|
-
return 'polyline'
|
|
1071
|
-
},
|
|
1057
|
+
getClassName: () => 'polyline',
|
|
1072
1058
|
|
|
1073
1059
|
getMeasure: function (shape) {
|
|
1074
1060
|
const length = L.GeoUtil.lineLength(this.map, shape || this._defaultShape())
|
|
@@ -1161,11 +1147,11 @@ U.Polyline = L.Polyline.extend({
|
|
|
1161
1147
|
from.reverse()
|
|
1162
1148
|
toMerge = [from, to]
|
|
1163
1149
|
}
|
|
1164
|
-
const a = toMerge[0]
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1150
|
+
const a = toMerge[0]
|
|
1151
|
+
const b = toMerge[1]
|
|
1152
|
+
const p1 = this.map.latLngToContainerPoint(a[a.length - 1])
|
|
1153
|
+
const p2 = this.map.latLngToContainerPoint(b[0])
|
|
1154
|
+
const tolerance = 5 // px on screen
|
|
1169
1155
|
if (Math.abs(p1.x - p2.x) <= tolerance && Math.abs(p1.y - p2.y) <= tolerance) {
|
|
1170
1156
|
a.pop()
|
|
1171
1157
|
}
|
|
@@ -1190,8 +1176,8 @@ U.Polyline = L.Polyline.extend({
|
|
|
1190
1176
|
},
|
|
1191
1177
|
|
|
1192
1178
|
getVertexActions: function (e) {
|
|
1193
|
-
const actions = U.FeatureMixin.getVertexActions.call(this, e)
|
|
1194
|
-
|
|
1179
|
+
const actions = U.FeatureMixin.getVertexActions.call(this, e)
|
|
1180
|
+
const index = e.vertex.getIndex()
|
|
1195
1181
|
if (index === 0 || index === e.vertex.getLastIndex())
|
|
1196
1182
|
actions.push(U.ContinueLineAction)
|
|
1197
1183
|
else actions.push(U.SplitLineAction)
|
|
@@ -1206,15 +1192,11 @@ U.Polygon = L.Polygon.extend({
|
|
|
1206
1192
|
mainColor: 'fillColor',
|
|
1207
1193
|
},
|
|
1208
1194
|
|
|
1209
|
-
isSameClass:
|
|
1210
|
-
return other instanceof U.Polygon
|
|
1211
|
-
},
|
|
1195
|
+
isSameClass: (other) => other instanceof U.Polygon,
|
|
1212
1196
|
|
|
1213
|
-
getClassName:
|
|
1214
|
-
return 'polygon'
|
|
1215
|
-
},
|
|
1197
|
+
getClassName: () => 'polygon',
|
|
1216
1198
|
|
|
1217
|
-
getShapeOptions:
|
|
1199
|
+
getShapeOptions: () => {
|
|
1218
1200
|
const options = U.PathMixin.getShapeOptions()
|
|
1219
1201
|
options.push(
|
|
1220
1202
|
'properties._umap_options.stroke',
|
|
@@ -1225,7 +1207,7 @@ U.Polygon = L.Polygon.extend({
|
|
|
1225
1207
|
return options
|
|
1226
1208
|
},
|
|
1227
1209
|
|
|
1228
|
-
getInteractionOptions:
|
|
1210
|
+
getInteractionOptions: () => {
|
|
1229
1211
|
const options = U.FeatureMixin.getInteractionOptions()
|
|
1230
1212
|
options.push('properties._umap_options.interactive')
|
|
1231
1213
|
return options
|
|
@@ -1237,8 +1219,8 @@ U.Polygon = L.Polygon.extend({
|
|
|
1237
1219
|
},
|
|
1238
1220
|
|
|
1239
1221
|
getContextMenuEditItems: function (e) {
|
|
1240
|
-
const items = U.PathMixin.getContextMenuEditItems.call(this, e)
|
|
1241
|
-
|
|
1222
|
+
const items = U.PathMixin.getContextMenuEditItems.call(this, e)
|
|
1223
|
+
const shape = this.shapeAt(e.latlng)
|
|
1242
1224
|
// No multi and no holes.
|
|
1243
1225
|
if (shape && !this.isMulti() && (L.LineUtil.isFlat(shape) || shape.length === 1)) {
|
|
1244
1226
|
items.push({
|