waibu-maps 1.2.6 → 1.2.8

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/index.js CHANGED
@@ -13,9 +13,16 @@ async function factory (pkgName) {
13
13
  mapOptions: {
14
14
  center: [106.8229, -6.1944],
15
15
  zoom: 7
16
+ },
17
+ waibuAdmin: {
18
+ modelDisabled: []
16
19
  }
17
20
  }
18
21
  }
22
+
23
+ init = async () => {
24
+ if (this.app.sumbaMaps) this.config.waibuAdmin.modelDisabled.push('icon')
25
+ }
19
26
  }
20
27
  }
21
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-maps",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Maps for Waibu MPA",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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: false }
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
- await wmaps.createControlNative('NavigationControl', ${jsonStringify(opts, true)})
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
  }
@@ -118,6 +118,7 @@ async function map () {
118
118
  measure: Alpine.$persist('nautical').as('mapMeasure'),
119
119
  zoomScrollCenter: Alpine.$persist(false).as('mapZoomScrollCenter'),
120
120
  noMapRotate: Alpine.$persist(false).as('mapNoMapRotate'),
121
+ hideCompass: Alpine.$persist(false).as('mapHideCompass'),
121
122
  center: Alpine.$persist(null).as('mapCenter'),
122
123
  zoom: Alpine.$persist(null).as('mapZoom'),
123
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