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('options.', '')
|
||||
console.log(property)
|
||||
const splits = property.split('.')
|
||||
const nested = splits.length > 1
|
||||
if (nested) property = splits[0]
|
||||
|
|
|
@ -210,6 +210,9 @@ U.Map = L.Map.extend({
|
|||
if (!U.Utils.isObject(this.options.overlay)) {
|
||||
this.options.overlay = {}
|
||||
}
|
||||
if (!U.Utils.isObject(this.options.tilelayer)) {
|
||||
this.options.tilelayer = {}
|
||||
}
|
||||
|
||||
this.initShortcuts()
|
||||
this.onceDataLoaded(function () {
|
||||
|
@ -1317,9 +1320,6 @@ U.Map = L.Map.extend({
|
|||
},
|
||||
|
||||
_editTilelayer: function (container) {
|
||||
if (!U.Utils.isObject(this.options.tilelayer)) {
|
||||
this.options.tilelayer = {}
|
||||
}
|
||||
const tilelayerFields = [
|
||||
[
|
||||
'options.tilelayer.name',
|
||||
|
|
|
@ -469,8 +469,8 @@ U.Layer.Heat = L.HeatLayer.extend({
|
|||
this._latlngs[i].alt !== undefined
|
||||
? this._latlngs[i].alt
|
||||
: this._latlngs[i][2] !== undefined
|
||||
? +this._latlngs[i][2]
|
||||
: 1
|
||||
? +this._latlngs[i][2]
|
||||
: 1
|
||||
|
||||
grid[y] = grid[y] || []
|
||||
cell = grid[y][x]
|
||||
|
@ -576,6 +576,10 @@ U.DataLayer = L.Evented.extend({
|
|||
}
|
||||
this.setUmapId(data.id)
|
||||
this.setOptions(data)
|
||||
|
||||
if (!U.Utils.isObject(this.options.remoteData)) {
|
||||
this.options.remoteData = {}
|
||||
}
|
||||
// Retrocompat
|
||||
if (this.options.remoteData && this.options.remoteData.from) {
|
||||
this.options.fromZoom = this.options.remoteData.from
|
||||
|
@ -1367,9 +1371,6 @@ U.DataLayer = L.Evented.extend({
|
|||
)
|
||||
popupFieldset.appendChild(builder.build())
|
||||
|
||||
if (!U.Utils.isObject(this.options.remoteData)) {
|
||||
this.options.remoteData = {}
|
||||
}
|
||||
const remoteDataFields = [
|
||||
[
|
||||
'options.remoteData.url',
|
||||
|
|
|
@ -690,6 +690,16 @@ describe('Utils', function () {
|
|||
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', () => {
|
||||
|
|
Loading…
Reference in a new issue