Compare commits

...

6 commits

Author SHA1 Message Date
Yohan Boniface
05e3f5ce3d
fix: use real redraw for datalayer, instead of hide/show (#2568)
Some checks are pending
Test & Docs / tests (postgresql, 3.10) (push) Waiting to run
Test & Docs / tests (postgresql, 3.12) (push) Waiting to run
Test & Docs / lint (push) Waiting to run
The problem we've tried to fix is, during sync:
- peer A is editing a feature
- peer B changes the datalayer of this feature
- edit panel is closed for peer A
2025-03-12 17:41:18 +01:00
Yohan Boniface
c417e94698
fix(sync): fix tilelayer change not synced (#2569) 2025-03-12 17:39:19 +01:00
Yohan Boniface
e53d208d7c
fix: cast value to string before calling trim (#2567)
fix #2566
2025-03-12 17:36:42 +01:00
Yohan Boniface
e20648104b fix: fix tilelayer change not synced
Co-authored-by: Alexis Métaireau <alexis@notmyidea.org>
2025-03-12 13:01:26 +01:00
Yohan Boniface
0c9d5325ba fix: use real redraw for datalayer, instead of hide/show
The problem we've tried to fix is, during sync:
- peer A is editing a feature
- peer B changes the datalayer of this feature
- edit panel is closed for peer A

Co-authored-by: Alexis Métaireau <alexis@notmyidea.org>
2025-03-12 12:23:54 +01:00
Yohan Boniface
90be14ae89 fix: cast value to string before calling trim
fix #2566
2025-03-11 21:43:21 +01:00
6 changed files with 17 additions and 6 deletions

View file

@ -329,7 +329,7 @@ class Feature {
}
for (const key of keys) {
const value = this.properties[key]
if (value) return value.trim()
if (value) return String(value).trim()
}
return this.datalayer.getName().trim()
}

View file

@ -144,11 +144,10 @@ export class DataLayer extends ServerStored {
if (fields.includes('options.type')) {
this.resetLayer()
}
this.hide()
for (const field of fields) {
this.layer.onEdit(field, builder)
}
this.show()
this.redraw()
break
case 'remote-data':
this.fetchRemoteData()
@ -652,8 +651,7 @@ export class DataLayer extends ServerStored {
redraw() {
if (!this.isVisible()) return
this.hide()
this.show()
this.eachFeature((feature) => feature.redraw())
}
edit() {

View file

@ -269,8 +269,12 @@ export const LeafletMap = BaseMap.extend({
this.renderUI()
},
renderUI: function () {
pullProperties() {
setOptions(this, this._umap.properties)
},
renderUI: function () {
this.pullProperties()
if (this.options.scrollWheelZoom) {
this.scrollWheelZoom.enable()
this.dragging.enable()

View file

@ -47,6 +47,7 @@ export class MapUpdater extends BaseUpdater {
this.updateObjectValue(this._umap, key, value)
}
this._umap.onPropertiesUpdated([key])
this._umap.render([key])
}
}

View file

@ -1329,6 +1329,10 @@ export default class Umap extends ServerStored {
}
}
onPropertiesUpdated(fields = []) {
this._leafletMap.pullProperties()
}
render(fields = []) {
// Propagate will remove the fields it has already
// processed

View file

@ -302,6 +302,10 @@ U.TileLayerChooser = L.Control.extend({
if (options?.edit) {
this.map._umap.properties.tilelayer = tilelayer.toJSON()
this.map._umap.isDirty = true
this.map._umap.sync.update(
'properties.tilelayer',
this.map._umap.properties.tilelayer
)
}
},
this