waibu-maps 1.2.5 → 1.2.7
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.
- package/dobo/fixture/icon.js +4 -4
- package/dobo/schema/icon.json +7 -0
- package/package.json +1 -1
- package/waibuBootstrap/theme/component/factory/control-navigation.js +10 -2
- package/waibuBootstrap/theme/component/factory/control-search.js +1 -1
- package/waibuBootstrap/theme/component/factory/map.js +2 -0
- package/waibuBootstrap/theme/component/factory/modal-misc.js +71 -0
- package/waibuRestApi/route/icon/model-builder.json +3 -0
package/dobo/fixture/icon.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
|
|
3
3
|
async function icon () {
|
|
4
|
-
const { map
|
|
4
|
+
const { map } = this.lib._
|
|
5
5
|
if (!this.app.waibuStatic) return []
|
|
6
6
|
const icons = await this.app.waibuStatic.listResources(`${this.name}.asset:/icon`)
|
|
7
7
|
return map(icons, icon => {
|
|
8
8
|
const base = path.basename(icon.href)
|
|
9
9
|
const dir = path.dirname(icon.href)
|
|
10
|
-
const
|
|
10
|
+
const id = `icon:/${path.basename(dir)}/${base}`
|
|
11
11
|
return {
|
|
12
|
-
id
|
|
13
|
-
|
|
12
|
+
id,
|
|
13
|
+
url: icon.href
|
|
14
14
|
}
|
|
15
15
|
})
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ async function controlNavigation () {
|
|
|
11
11
|
|
|
12
12
|
build = async () => {
|
|
13
13
|
const { jsonStringify } = this.plugin.app.waibuMpa
|
|
14
|
-
const opts = { showCompass:
|
|
14
|
+
const opts = { showCompass: true }
|
|
15
15
|
if (this.params.attr.compass) opts.showCompass = true
|
|
16
16
|
if (this.params.attr.noZoom) opts.showZoom = false
|
|
17
17
|
if (this.params.attr.visualizePitch) opts.visualizePitch = true
|
|
@@ -19,7 +19,15 @@ async function controlNavigation () {
|
|
|
19
19
|
opts.classGroup = true
|
|
20
20
|
opts.position = this.ctrlPos.includes(this.params.attr.position) ? this.params.attr.position : 'bottom-right'
|
|
21
21
|
this.addBlock('control', `
|
|
22
|
-
|
|
22
|
+
const navOpts = ${jsonStringify(opts, true)}
|
|
23
|
+
if (Alpine.store('map').noMapRotate) {
|
|
24
|
+
map.dragRotate.disable()
|
|
25
|
+
map.touchZoomRotate.disableRotation()
|
|
26
|
+
navOpts.showCompass = false
|
|
27
|
+
} else {
|
|
28
|
+
if (Alpine.store('map').hideCompass) navOpts.showCompass = false
|
|
29
|
+
}
|
|
30
|
+
await wmaps.createControlNative('NavigationControl', navOpts)
|
|
23
31
|
`)
|
|
24
32
|
this.params.html = this.writeBlock()
|
|
25
33
|
}
|
|
@@ -62,7 +62,7 @@ async function controlSearch () {
|
|
|
62
62
|
feeds.unshift({ code: 'latLng', name: 'gotoLatLng', feed: { id: 'latLng', label: 'latLng' } })
|
|
63
63
|
this.$store.mapSearch.feeds = feeds
|
|
64
64
|
const body = feeds.map(feed => '<c:dropdown-item :class="$store.mapSearch.feed === $el.getAttribute(\\'data-code-feedid\\') ? \\'active\\' : \\'\\'" data-code-feedid="' + feed.code + ':' + feed.feed.id + '" t:content="' + feed.feed.label + '" @click="$store.mapSearch.feed = \\'' + feed.code + ':' + feed.feed.id + '\\'"/>')
|
|
65
|
-
await wmpa.addComponent(body, '#${id} .input-group .dropdown-menu', 'div')
|
|
65
|
+
await wmpa.addComponent(body, '#${id} .input-group .dropdown-menu', 'div', true)
|
|
66
66
|
if (!this.$store.mapSearch.feed) this.$store.mapSearch.feed = feeds[0].code + ':' + feeds[0].feed.id
|
|
67
67
|
const html = this.$store.mapSearch.recent ?? ''
|
|
68
68
|
wmpa.replaceWithComponentHtml(html, '#${id} .result div', 'div')
|
|
@@ -68,6 +68,7 @@ async function map () {
|
|
|
68
68
|
${(this.block.mapStyle ?? []).join('\n')}
|
|
69
69
|
},
|
|
70
70
|
async onMissingImage (evt) {
|
|
71
|
+
if (evt.id.startsWith('icon:')) await wmaps.loadIcon(evt.id)
|
|
71
72
|
${(this.block.missingImage ?? []).join('\n')}
|
|
72
73
|
},
|
|
73
74
|
onLayerVisibility (layerId, shown) {
|
|
@@ -117,6 +118,7 @@ async function map () {
|
|
|
117
118
|
measure: Alpine.$persist('nautical').as('mapMeasure'),
|
|
118
119
|
zoomScrollCenter: Alpine.$persist(false).as('mapZoomScrollCenter'),
|
|
119
120
|
noMapRotate: Alpine.$persist(false).as('mapNoMapRotate'),
|
|
121
|
+
hideCompass: Alpine.$persist(false).as('mapHideCompass'),
|
|
120
122
|
center: Alpine.$persist(null).as('mapCenter'),
|
|
121
123
|
zoom: Alpine.$persist(null).as('mapZoom'),
|
|
122
124
|
bearing: Alpine.$persist(null).as('mapBearing'),
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import wmapsBase from '../wmaps-base.js'
|
|
2
|
+
|
|
3
|
+
async function modalMisc () {
|
|
4
|
+
const SmapsBase = await wmapsBase.call(this)
|
|
5
|
+
|
|
6
|
+
return class SmapsModalMisc extends SmapsBase {
|
|
7
|
+
constructor (options) {
|
|
8
|
+
super(options)
|
|
9
|
+
this.params.noTag = true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
build = async () => {
|
|
13
|
+
this.params.html = await this.component.buildSentence(`
|
|
14
|
+
<c:modal id="${this.params.attr.id}" t:title="generalSettings" x-data="{
|
|
15
|
+
measure: $store.map.measure,
|
|
16
|
+
degree: $store.map.degree,
|
|
17
|
+
zoomScrollCenter: $store.map.zoomScrollCenter,
|
|
18
|
+
noMapRotate: $store.map.noMapRotate,
|
|
19
|
+
hideCompass: $store.map.hideCompass,
|
|
20
|
+
submit () {
|
|
21
|
+
$store.map.measure = this.measure
|
|
22
|
+
$store.map.degree = this.degree
|
|
23
|
+
$store.map.zoomScrollCenter = this.zoomScrollCenter
|
|
24
|
+
$store.map.noMapRotate = this.noMapRotate
|
|
25
|
+
$store.map.hideCompass = this.hideCompass
|
|
26
|
+
window.location.reload()
|
|
27
|
+
},
|
|
28
|
+
toggleNoMapRotate (val) {
|
|
29
|
+
if (val) {
|
|
30
|
+
$refs.hideCompass.setAttribute('disabled', '')
|
|
31
|
+
this.hideCompass = false
|
|
32
|
+
} else {
|
|
33
|
+
$refs.hideCompass.removeAttribute('disabled')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}" x-init="
|
|
37
|
+
toggleNoMapRotate($store.map.noMapRotate)
|
|
38
|
+
$watch('noMapRotate', val => toggleNoMapRotate(val))
|
|
39
|
+
">
|
|
40
|
+
<c:grid-row>
|
|
41
|
+
<c:grid-col col="6-md">
|
|
42
|
+
<c:fieldset t:legend="measurement" legend-type="6" margin="bottom-3">
|
|
43
|
+
<c:form-radio t:label="nautical" value="nautical" x-model="measure" />
|
|
44
|
+
<c:form-radio t:label="imperial" value="imperial" x-model="measure" />
|
|
45
|
+
<c:form-radio t:label="metric" value="metric" x-model="measure" />
|
|
46
|
+
</c:fieldset>
|
|
47
|
+
</c:grid-col>
|
|
48
|
+
<c:grid-col col="6-md">
|
|
49
|
+
<c:fieldset t:legend="degreeFormat" legend-type="6" margin="bottom-3">
|
|
50
|
+
<c:form-radio t:label="degreeMinuteSecond" value="DMS" x-model="degree" />
|
|
51
|
+
<c:form-radio t:label="decimalDegree" value="DD" x-model="degree" />
|
|
52
|
+
</c:fieldset>
|
|
53
|
+
</c:grid-col>
|
|
54
|
+
<c:grid-col col="12">
|
|
55
|
+
<c:fieldset t:legend="misc" legend-type="6">
|
|
56
|
+
<c:form-check t:label="zoomScrollFromCenter" value="false" x-model="zoomScrollCenter" />
|
|
57
|
+
<c:form-check t:label="disableMapRotation" value="false" x-model="noMapRotate" />
|
|
58
|
+
<c:form-check t:label="hideCompass" value="false" x-model="hideCompass" x-ref="hideCompass"/>
|
|
59
|
+
</c:fieldset>
|
|
60
|
+
</c:grid-col>
|
|
61
|
+
</c:grid-row>
|
|
62
|
+
<c:div flex="justify-content:end" margin="top-3">
|
|
63
|
+
<c:btn color="primary" t:content="apply" @click="submit()"/>
|
|
64
|
+
</c:div>
|
|
65
|
+
</c:modal>
|
|
66
|
+
`)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default modalMisc
|