xy-map 1.0.39 → 1.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xy-map",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "地图组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -92,7 +92,7 @@ export default {
92
92
 
93
93
  map.on('draw.create', this.drawEnd)
94
94
  map.on('draw.update', this.drawUpdate)
95
-
95
+ map.on('draw.selectionchange', this.select)
96
96
 
97
97
  // map.on('draw.modechange', (e) => {
98
98
  // const data = draw.getAll()
@@ -142,8 +142,11 @@ export default {
142
142
  this.$emit('clear')
143
143
  }
144
144
  },
145
- fullScreen () {
146
-
145
+ clear () {
146
+ this.drawDelete()
147
+ },
148
+ select (e) {
149
+ this.$emit('select', e.features)
147
150
  }
148
151
  }
149
152
  }
@@ -126,10 +126,8 @@ export default {
126
126
  this.edit()
127
127
  },
128
128
  edit () { // 开启编辑
129
- if (this.geoJson && this.geoJson.features.length > 0) {
130
- this.geoJson.features.forEach(item => {
131
- this.$refs.draw.drawEdit(item.geometry)
132
- })
129
+ if (this.geoJson) {
130
+ this.$refs.draw.drawEdit(this.geoJson)
133
131
  }
134
132
  },
135
133
  drawUpdate (data, autoZoom = false) {
@@ -126,10 +126,8 @@ export default {
126
126
  this.edit()
127
127
  },
128
128
  edit () { // 开启编辑
129
- if (this.geoJson && this.geoJson.features.length > 0) {
130
- this.geoJson.features.forEach(item => {
131
- this.$refs.draw.drawEdit(item.geometry)
132
- })
129
+ if (this.geoJson) {
130
+ this.$refs.draw.drawEdit(this.geoJson)
133
131
  }
134
132
  },
135
133
  drawUpdate (data, autoZoom = false) {
@@ -159,6 +157,7 @@ export default {
159
157
  this.position = ''
160
158
  },
161
159
  getShp (shp) {
160
+ console.log(shp)
162
161
  this.$refs.draw.drawDelete() // 先清空画布
163
162
  this.drawUpdate(shp, true)
164
163
  this.edit()