umap-project 3.3.1__py3-none-any.whl → 3.3.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.
umap/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "3.3.1"
1
+ VERSION = "3.3.2"
@@ -43,7 +43,6 @@ export class DataLayer {
43
43
  this._umap = umap
44
44
  this.sync = umap.syncEngine.proxy(this)
45
45
  this.features = new FeatureManager()
46
- this._geojson = null
47
46
  this._propertiesIndex = []
48
47
 
49
48
  this._leafletMap = leafletMap
@@ -306,7 +305,6 @@ export class DataLayer {
306
305
  fromGeoJSON(geojson, sync = true) {
307
306
  if (!geojson) return []
308
307
  const features = this.addData(geojson, sync)
309
- this._geojson = geojson
310
308
  this._needsFetch = false
311
309
  this.onDataLoaded()
312
310
  this.dataChanged()
@@ -331,12 +329,6 @@ export class DataLayer {
331
329
  }
332
330
  }
333
331
 
334
- backupData() {
335
- if (this._geojson) {
336
- this._geojson_bk = Utils.CopyJSON(this._geojson)
337
- }
338
- }
339
-
340
332
  showAtZoom() {
341
333
  const from = Number.parseInt(this.properties.fromZoom, 10)
342
334
  const to = Number.parseInt(this.properties.toZoom, 10)
@@ -751,7 +743,7 @@ export class DataLayer {
751
743
  const properties = Utils.CopyJSON(this.properties)
752
744
  properties.name = translate('Clone of {name}', { name: this.properties.name })
753
745
  delete properties.id
754
- const geojson = Utils.CopyJSON(this._geojson)
746
+ const geojson = Utils.CopyJSON(this.umapGeoJSON())
755
747
  const datalayer = this._umap.createDirtyDataLayer(properties)
756
748
  datalayer.fromGeoJSON(geojson)
757
749
  return datalayer
@@ -1331,7 +1323,6 @@ export class DataLayer {
1331
1323
  ? { 'X-Datalayer-Reference': this._referenceVersion }
1332
1324
  : {}
1333
1325
  const status = await this._trySave(saveURL, headers, formData)
1334
- this._geojson = geojson
1335
1326
  return status
1336
1327
  }
1337
1328
 
@@ -1371,7 +1362,6 @@ export class DataLayer {
1371
1362
 
1372
1363
  this.setReferenceVersion({ response, sync: true })
1373
1364
 
1374
- this.backupData()
1375
1365
  this.connectToMap()
1376
1366
  this.redraw() // Needed for reordering features
1377
1367
  return true
@@ -29,6 +29,7 @@ const FeatureMixin = {
29
29
  },
30
30
 
31
31
  onRemove: function (map) {
32
+ this.removeInteractions()
32
33
  this.parentClass.prototype.onRemove.call(this, map)
33
34
  if (map._umap.editedFeature === this.feature) {
34
35
  this.feature.endEdit()
@@ -49,6 +50,13 @@ const FeatureMixin = {
49
50
  this.on('mouseover', this.onMouseOver)
50
51
  },
51
52
 
53
+ removeInteractions: function () {
54
+ this.off('contextmenu editable:vertex:contextmenu', this.onContextMenu)
55
+ this.off('click', this.onClick)
56
+ this.off('editable:edited', this.onCommit)
57
+ this.off('mouseover', this.onMouseOver)
58
+ },
59
+
52
60
  onMouseOver: function () {
53
61
  if (this._map._umap.editEnabled && !this._map._umap.editedFeature) {
54
62
  this._map._umap.tooltip.open({
@@ -112,17 +120,26 @@ const PointMixin = {
112
120
 
113
121
  addInteractions() {
114
122
  FeatureMixin.addInteractions.call(this)
115
- this.on('dragend', (event) => {
116
- this.feature.edit(event)
117
- if (this._cluster) {
118
- delete this._originalLatLng
119
- this.feature.datalayer.dataChanged()
120
- }
121
- })
123
+ this.on('dragend', this._onDragEnd)
122
124
  if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging)
123
125
  this.on('mouseout', this._onMouseOut)
124
126
  },
125
127
 
128
+ removeInteractions() {
129
+ FeatureMixin.removeInteractions.call(this)
130
+ this.off('dragend', this._onDragEnd)
131
+ if (!this.feature.isReadOnly()) this.off('mouseover', this._enableDragging)
132
+ this.off('mouseout', this._onMouseOut)
133
+ },
134
+
135
+ _onDragEnd(event) {
136
+ if (this._cluster) {
137
+ delete this._originalLatLng
138
+ this.feature.datalayer.dataChanged()
139
+ }
140
+ this.feature.edit(event)
141
+ },
142
+
126
143
  _onMouseOut: function () {
127
144
  if (this.dragging?._draggable && !this.dragging._draggable._moving) {
128
145
  // Do not disable if the mouse went out while dragging
@@ -180,6 +197,12 @@ export const LeafletMarker = Marker.extend({
180
197
  this.on('popupclose', this.resetHighlight)
181
198
  },
182
199
 
200
+ removeInteractions() {
201
+ PointMixin.removeInteractions.call(this)
202
+ this.off('popupopen', this.highlight)
203
+ this.off('popupclose', this.resetHighlight)
204
+ },
205
+
183
206
  onMoveEnd: function () {
184
207
  this._initIcon()
185
208
  this.update()
@@ -298,6 +321,13 @@ const PathMixin = {
298
321
  this.on('popupclose', this._redraw)
299
322
  },
300
323
 
324
+ removeInteractions: function () {
325
+ FeatureMixin.removeInteractions.call(this)
326
+ this.off('drag editable:drag', this._onDrag)
327
+ this.off('popupopen', this.highlightPath)
328
+ this.off('popupclose', this._redraw)
329
+ },
330
+
301
331
  bindTooltip: function (content, options) {
302
332
  options.sticky = !options.permanent
303
333
  this.parentClass.prototype.bindTooltip.call(this, content, options)
@@ -489,6 +519,12 @@ export const LeafletRoute = LeafletPolyline.extend({
489
519
  this.on('editable:vertex:dragend editable:vertex:deleted', this.onDrawingMoved)
490
520
  },
491
521
 
522
+ removeInteractions: function () {
523
+ PathMixin.removeInteractions.call(this)
524
+ this.off('editable:drawing:clicked', this.onDrawingClick)
525
+ this.off('editable:vertex:dragend editable:vertex:deleted', this.onDrawingMoved)
526
+ },
527
+
492
528
  getEditorClass: (tools) => {
493
529
  return RouteEditor
494
530
  },
@@ -69,6 +69,7 @@ def test_cancel_deleting_datalayer_should_restore(
69
69
 
70
70
 
71
71
  def test_can_clone_datalayer(live_server, openmap, login, datalayer, page):
72
+ assert DataLayer.objects.count() == 1
72
73
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
73
74
  page.get_by_title("Open browser").click()
74
75
  layers = page.locator(".umap-browser .datalayer")
@@ -81,6 +82,9 @@ def test_can_clone_datalayer(live_server, openmap, login, datalayer, page):
81
82
  page.get_by_role("button", name="Clone").click()
82
83
  expect(layers).to_have_count(2)
83
84
  expect(markers).to_have_count(2)
85
+ with page.expect_response(re.compile(".*/datalayer/create/.*")):
86
+ page.get_by_role("button", name="Save").click()
87
+ assert DataLayer.objects.count() == 2
84
88
 
85
89
 
86
90
  def test_can_change_icon_class(live_server, openmap, page):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: umap-project
3
- Version: 3.3.1
3
+ Version: 3.3.2
4
4
  Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
5
5
  Author-email: Yohan Boniface <yb@enix.org>
6
6
  Maintainer-email: David Larlet <david@larlet.fr>
@@ -1,4 +1,4 @@
1
- umap/__init__.py,sha256=P-LYADqNpYK0atH4JUdWBBlQqMSI8J0AD5JUh0pP-UY,18
1
+ umap/__init__.py,sha256=XR5V70-CcKGe7acoBLPVZiecGOP_E2HYEw-TWEmuZ0Q,18
2
2
  umap/admin.py,sha256=YlK4CgEWb2eFYRKiklsKouxeiQ8z_b-H2Fv2XCaiGFQ,3014
3
3
  umap/apps.py,sha256=5ssKqPUuNJlapaBmr4LY_HDb7J1NFCT3wzythxQOOfs,109
4
4
  umap/asgi.py,sha256=sJkGqDLgMoPkq2nMRyRE_Hz3ZLJm1X5lgXiQJu6rYt0,660
@@ -264,7 +264,7 @@ umap/static/umap/js/modules/umap.js,sha256=_9A2AjVY4vkeprghMtEmL0J6XmOnMUyeGjU14
264
264
  umap/static/umap/js/modules/urls.js,sha256=76cFqycj2O8huuoYYBvxnVt2Fc2UDbgrRsiv6lQmcSY,890
265
265
  umap/static/umap/js/modules/utils.js,sha256=rT_RILODFUWAvvgjFpT5TtNbu8A9jzn0mlkpHEB8QqM,16044
266
266
  umap/static/umap/js/modules/data/features.js,sha256=FAOZjITU5U9dpezWLF9EMF-pFGtvGva0sckvzwlcT58,38266
267
- umap/static/umap/js/modules/data/layer.js,sha256=Z1eSIFIvNrTC5RDSryB6ycprj2W4c_GuLEYv8vRmEws,43873
267
+ umap/static/umap/js/modules/data/layer.js,sha256=popFJ6SNeIYQm6h2-poSGIxrMZUbHCkzSeNP1x0GPXg,43665
268
268
  umap/static/umap/js/modules/form/builder.js,sha256=akRoO8VpKXqWr3LO4Y_B1zr9gXJL2S5RCJqRDREweq8,6452
269
269
  umap/static/umap/js/modules/form/fields.js,sha256=yUEUPDHF3tgnpDv7UdfMXHsabCMaGsUDXQq2-Qe1krg,36152
270
270
  umap/static/umap/js/modules/importers/banfr.js,sha256=TBwL3GQJdzYtaDtxeHxyPQ7Ycy5zTaQyvzXa55X7n2I,2932
@@ -280,7 +280,7 @@ umap/static/umap/js/modules/rendering/icon.js,sha256=c4kTghfdjku03Ey825LIp9sZ9MS
280
280
  umap/static/umap/js/modules/rendering/map.js,sha256=zdBF7153X_vE-k0pZhcsNJKIc3nvLT3K0g_VHPfaMDE,12796
281
281
  umap/static/umap/js/modules/rendering/popup.js,sha256=OtQYpjhWCoW20XBFeeSKCXMqN-szohaX1TKWhPc9eBo,2577
282
282
  umap/static/umap/js/modules/rendering/template.js,sha256=n74YzbZOS_4CeK3-Jn7NXbkzqsh4zjCbEX9w15QxKu0,11468
283
- umap/static/umap/js/modules/rendering/ui.js,sha256=d4CkbXjTcLxKm7eg45t5qZvKWxwFO48ehapzlhUFw3c,16403
283
+ umap/static/umap/js/modules/rendering/ui.js,sha256=GzU3OW2fL5A4IgDk2mPEQ68ZWFUMqUwKJm1zqviSjnA,17559
284
284
  umap/static/umap/js/modules/rendering/layers/base.js,sha256=G9H41vTrh-6Yn5H9UhKj5BOx03Xp2jcevpZINTDCtHI,2528
285
285
  umap/static/umap/js/modules/rendering/layers/classified.js,sha256=CLktnkjf5_6CzkKVyZcx5wAKvhsRp4pRpCIBauwKeO0,15068
286
286
  umap/static/umap/js/modules/rendering/layers/cluster.js,sha256=y0wO6K3CMFxXLA4xub0wTJi5gQ3e9O7ZNf2pfVfx-cE,7789
@@ -570,7 +570,7 @@ umap/tests/integration/test_datalayer.py,sha256=CNxT97ZVB-pPjgXh77i3n3hJKgi4Sm0r
570
570
  umap/tests/integration/test_draw_polygon.py,sha256=WNKXcxMqlTmwI0Yro_PbdpTi-M4gZNeIVa-fSXpS6rE,25298
571
571
  umap/tests/integration/test_draw_polyline.py,sha256=RgivhjEzjHVE6niPG5uAxJjtmEVD11ftuU4Tb47bXh8,14717
572
572
  umap/tests/integration/test_draw_route.py,sha256=hxa_uVqHLLEbbSsEIMsPsq5fMCNoKWY7cRCpMwqudmM,7276
573
- umap/tests/integration/test_edit_datalayer.py,sha256=Ayp4GbCbGTrNaKXBqKLKBApSm4QdMIT8QMC7zgk0LNw,10015
573
+ umap/tests/integration/test_edit_datalayer.py,sha256=l5DwzpWXsy80HxMKrF7z7HZPZi1RtFluONpjDrUBqb8,10224
574
574
  umap/tests/integration/test_edit_map.py,sha256=0TXwrjgSKok7nxa-wy7WjVb8-lG0-zfS8s-f9klmqOQ,8784
575
575
  umap/tests/integration/test_edit_marker.py,sha256=hnKsitnSYJdMEPPRGrfODsCxJx3KfFGbD__wfVjiFns,5271
576
576
  umap/tests/integration/test_edit_polygon.py,sha256=l2CxnTnblRYUiiBV3ERwPkZ-VQTEWzFSFWhAzTF9BgA,5252
@@ -602,8 +602,8 @@ umap/tests/integration/test_view_marker.py,sha256=NFCwNez__E_WsE1DuW5RuB0HVKDP4C
602
602
  umap/tests/integration/test_view_polygon.py,sha256=NMJC6Nt9VpQ8FIU9Pqq2OspHv49xsWlsoXCr8iBa0VA,2060
603
603
  umap/tests/integration/test_view_polyline.py,sha256=aJoXKmLhJaN0yhPdDCVskZNGx3q3mLDkjVPhZ30cadA,13959
604
604
  umap/tests/integration/test_websocket_sync.py,sha256=n3Nd9cDdYMfJjMIkGUidqeceAW2loM8nx17Bh57m0fo,28341
605
- umap_project-3.3.1.dist-info/METADATA,sha256=40YRcftApH08jDGwcfbfBunpp4xfqDPQwnIYB5hlC4w,5747
606
- umap_project-3.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
607
- umap_project-3.3.1.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
608
- umap_project-3.3.1.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
609
- umap_project-3.3.1.dist-info/RECORD,,
605
+ umap_project-3.3.2.dist-info/METADATA,sha256=tKowCtiioD6jD3ihntyJxYw8nnHvxdSIXPMe_qZDrn8,5747
606
+ umap_project-3.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
607
+ umap_project-3.3.2.dist-info/entry_points.txt,sha256=gz-KDQfEsMLBae8ABOD3foJsCYGPW1tA4Y394R_1RW8,39
608
+ umap_project-3.3.2.dist-info/licenses/LICENSE,sha256=kQtrtRKgiPhcl7aO0-lmvbrNAXu7WHyiXvPrUk-TD2Q,820
609
+ umap_project-3.3.2.dist-info/RECORD,,