waibu-maps 2.4.0 → 2.4.1

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.
@@ -1,28 +1,28 @@
1
1
  import wmapsBase from '../wmaps-base.js'
2
2
 
3
- export function buildLayers (params) {
3
+ export function buildLayers () {
4
4
  const { isString, map } = this.app.lib._
5
5
  const { routePath, attrToArray } = this.app.waibu
6
6
  const { jsonStringify } = this.app.waibuMpa
7
7
 
8
- if (!isString(params.attr.layer)) return ''
9
- const items = map(attrToArray(params.attr.layer), item => routePath(item))
8
+ if (!isString(this.params.attr.layer)) return ''
9
+ const items = map(attrToArray(this.params.attr.layer), item => routePath(item))
10
10
  return `
11
11
  for (const l of ${jsonStringify(items, true)}) {
12
12
  const layer = await this.loadResource(l)
13
- layer.source = '${params.attr.name}'
13
+ layer.source = '${this.params.attr.name}'
14
14
  map.addLayer(layer)
15
15
  }
16
16
  `
17
17
  }
18
18
 
19
- export function buildImage (params) {
19
+ export function buildImage () {
20
20
  const { isString, map } = this.app.lib._
21
21
  const { routePath, attrToArray } = this.app.waibu
22
22
  const { jsonStringify } = this.app.waibuMpa
23
23
 
24
- if (!isString(params.attr.image)) return ''
25
- const items = map(attrToArray(params.attr.image), item => routePath(item))
24
+ if (!isString(this.params.attr.image)) return ''
25
+ const items = map(attrToArray(this.params.attr.image), item => routePath(item))
26
26
  return `
27
27
  for (const l of ${jsonStringify(items, true)}) {
28
28
  let [item, name] = l.split(';')
@@ -34,35 +34,35 @@ export function buildImage (params) {
34
34
  `
35
35
  }
36
36
 
37
- export async function buildSrcImages (params) {
37
+ export async function buildSrcImages () {
38
38
  const { isString } = this.app.lib._
39
39
  const { routePath, fetch } = this.app.waibu
40
40
 
41
- if (!isString(params.attr.srcImages)) return
42
- params.attr.srcImages = routePath(params.attr.srcImages)
43
- const items = await fetch(params.attr.srcImages)
41
+ if (!isString(this.params.attr.srcImages)) return
42
+ this.params.attr.srcImages = routePath(this.params.attr.srcImages)
43
+ const items = await fetch(this.params.attr.srcImages)
44
44
  const lines = []
45
45
  for (const key in items) {
46
46
  lines.push(`${items[key]};${key}`)
47
47
  }
48
- params.attr.image = lines.join(' ')
49
- return buildImage.call(this, params)
48
+ this.params.attr.image = lines.join(' ')
49
+ return buildImage.call(this)
50
50
  }
51
51
 
52
- export function buildSource (params, extra = []) {
52
+ export function buildSource (extra = []) {
53
53
  const { routePath } = this.app.waibu
54
- params.attr.src = routePath(params.attr.src)
54
+ this.params.attr.src = routePath(this.params.attr.src)
55
55
  return `
56
- const rsc = await this.loadResource('${params.attr.src}')
56
+ const rsc = await this.loadResource('${this.params.attr.src}')
57
57
  let data = {}
58
58
  if (rsc.type === 'geojson' && rsc.data) data = rsc
59
59
  else {
60
60
  data.type = 'geojson'
61
61
  data.data = rsc
62
62
  }
63
- ${params.attr.lineGradient ? 'data.lineMetrics = true' : ''}
63
+ ${this.params.attr.lineGradient ? 'data.lineMetrics = true' : ''}
64
64
  ${extra.join('\n')}
65
- map.addSource('${params.attr.name}', data)
65
+ map.addSource('${this.params.attr.name}', data)
66
66
  `
67
67
  }
68
68
 
@@ -91,9 +91,9 @@ async function layerGeojson () {
91
91
  }
92
92
 
93
93
  this.addBlock('mapLoad', `
94
- ${this.params.attr.srcImages ? (await buildSrcImages.call(this, this.params)) : buildImage.call(this, this.params)}
95
- ${buildSource.call(this, this.params, cluster)}
96
- ${buildLayers.call(this, this.params)}
94
+ ${this.params.attr.srcImages ? (await buildSrcImages.call(this)) : buildImage.call(this)}
95
+ ${buildSource.call(this, cluster)}
96
+ ${buildLayers.call(this)}
97
97
  `)
98
98
  this.params.html = this.writeBlock()
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-maps",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Maps for Waibu MPA",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-01
4
+
5
+ - [2.4.1] Bug fix in ```wmaps-layer-geojson``` widget
6
+
3
7
  ## 2026-05-25
4
8
 
5
9
  - [2.4.0] Auto detect theme & iconset