mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
fix(sync): Initialize tilelayer
and remoteData
earlier.
It makes it possible to set these values on a remote peer.
This commit is contained in:
parent
059103b66c
commit
b99c242648
4 changed files with 19 additions and 9 deletions
|
@ -68,7 +68,6 @@ export function propertyBelongsTo(property, subject, schema) {
|
||||||
property = property.replace('properties.', '').replace('_umap_options.', '')
|
property = property.replace('properties.', '').replace('_umap_options.', '')
|
||||||
}
|
}
|
||||||
property = property.replace('options.', '')
|
property = property.replace('options.', '')
|
||||||
console.log(property)
|
|
||||||
const splits = property.split('.')
|
const splits = property.split('.')
|
||||||
const nested = splits.length > 1
|
const nested = splits.length > 1
|
||||||
if (nested) property = splits[0]
|
if (nested) property = splits[0]
|
||||||
|
|
|
@ -210,6 +210,9 @@ U.Map = L.Map.extend({
|
||||||
if (!U.Utils.isObject(this.options.overlay)) {
|
if (!U.Utils.isObject(this.options.overlay)) {
|
||||||
this.options.overlay = {}
|
this.options.overlay = {}
|
||||||
}
|
}
|
||||||
|
if (!U.Utils.isObject(this.options.tilelayer)) {
|
||||||
|
this.options.tilelayer = {}
|
||||||
|
}
|
||||||
|
|
||||||
this.initShortcuts()
|
this.initShortcuts()
|
||||||
this.onceDataLoaded(function () {
|
this.onceDataLoaded(function () {
|
||||||
|
@ -1317,9 +1320,6 @@ U.Map = L.Map.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_editTilelayer: function (container) {
|
_editTilelayer: function (container) {
|
||||||
if (!U.Utils.isObject(this.options.tilelayer)) {
|
|
||||||
this.options.tilelayer = {}
|
|
||||||
}
|
|
||||||
const tilelayerFields = [
|
const tilelayerFields = [
|
||||||
[
|
[
|
||||||
'options.tilelayer.name',
|
'options.tilelayer.name',
|
||||||
|
|
|
@ -576,6 +576,10 @@ U.DataLayer = L.Evented.extend({
|
||||||
}
|
}
|
||||||
this.setUmapId(data.id)
|
this.setUmapId(data.id)
|
||||||
this.setOptions(data)
|
this.setOptions(data)
|
||||||
|
|
||||||
|
if (!U.Utils.isObject(this.options.remoteData)) {
|
||||||
|
this.options.remoteData = {}
|
||||||
|
}
|
||||||
// Retrocompat
|
// Retrocompat
|
||||||
if (this.options.remoteData && this.options.remoteData.from) {
|
if (this.options.remoteData && this.options.remoteData.from) {
|
||||||
this.options.fromZoom = this.options.remoteData.from
|
this.options.fromZoom = this.options.remoteData.from
|
||||||
|
@ -1367,9 +1371,6 @@ U.DataLayer = L.Evented.extend({
|
||||||
)
|
)
|
||||||
popupFieldset.appendChild(builder.build())
|
popupFieldset.appendChild(builder.build())
|
||||||
|
|
||||||
if (!U.Utils.isObject(this.options.remoteData)) {
|
|
||||||
this.options.remoteData = {}
|
|
||||||
}
|
|
||||||
const remoteDataFields = [
|
const remoteDataFields = [
|
||||||
[
|
[
|
||||||
'options.remoteData.url',
|
'options.remoteData.url',
|
||||||
|
|
|
@ -690,6 +690,16 @@ describe('Utils', function () {
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should accept options.tilelayer.url_template', function () {
|
||||||
|
let schema = {
|
||||||
|
tilelayer: { type: Object, belongsTo: ['map'] },
|
||||||
|
}
|
||||||
|
assert.deepEqual(
|
||||||
|
Utils.propertyBelongsTo('options.tilelayer.url_template', 'map', schema),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#parseNaiveDate', () => {
|
describe('#parseNaiveDate', () => {
|
||||||
|
|
Loading…
Reference in a new issue