openatc-components 0.0.101 → 0.0.102

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": "openatc-components",
3
- "version": "0.0.101",
3
+ "version": "0.0.102",
4
4
  "description": "A Vue.js project",
5
5
  "author": "openatc developer",
6
6
  "private": false,
@@ -83,22 +83,13 @@ export default {
83
83
  }
84
84
  this.mapreset = true
85
85
  }
86
+ this.$nextTick(() => {
87
+ // 底图大小改变后,需要同步svg的宽高
88
+ this.synchroSVGSize()
89
+ })
86
90
  },
87
91
  deep: true
88
92
  },
89
- // crossmapitem: {
90
- // handler: function (newval, oldval) {
91
- // if ((JSON.stringify(oldval) !== '{}') && !this.isEqual(newval, oldval)) {
92
- // // 更改原数据的位置大小数据
93
- // let data = {
94
- // ...this.CrossMapData,
95
- // ...newval
96
- // }
97
- // let fields = Object.keys(newval)
98
- // this.$emit('changeCrossMap', data, fields)
99
- // }
100
- // }
101
- // },
102
93
  pointchange: {
103
94
  handler: function (val) {
104
95
  // 解决光标样式被选区样式覆盖问题
@@ -127,21 +118,25 @@ export default {
127
118
  this.crossmapitem = JSON.parse(JSON.stringify(final))
128
119
  this.handleChangeData()
129
120
  },
130
- mapResizeStop (origin, final) {
131
- // 底图改变大小停止
121
+ synchroSVGSize () {
132
122
  let svgdom = document.querySelector('.cross-map svg')
133
123
  if (svgdom) {
134
124
  // 解决svg源文件里有宽高属性,此时对svg父容器改变宽高,svg尺寸不会改变的问题
135
125
  // 因此要修改svg文件的宽高属性
136
126
  if (svgdom.getAttribute('width')) {
137
- svgdom.setAttribute('width', final.w + 'px')
127
+ svgdom.setAttribute('width', this.crossmapitem.w + 'px')
138
128
  }
139
129
  if (svgdom.getAttribute('height')) {
140
- svgdom.setAttribute('height', final.h + 'px')
130
+ svgdom.setAttribute('height', this.crossmapitem.h + 'px')
141
131
  }
142
132
  }
133
+ },
134
+
135
+ mapResizeStop (origin, final) {
136
+ // 底图改变大小停止
143
137
  this.resetMapSvg()
144
138
  this.crossmapitem = JSON.parse(JSON.stringify(final))
139
+ this.synchroSVGSize()
145
140
  this.handleChangeData()
146
141
  },
147
142
  mapRotateStop (origin, final) {
@@ -25,11 +25,6 @@ export default class Svgmethods {
25
25
  return
26
26
  }
27
27
  if (filetype === 'image/svg+xml') {
28
- reader.readAsText(file, 'UTF-8')
29
- reader.addEventListener('load', async (readerEvent) => {
30
- const content = readerEvent.target.result
31
- call('vectorgraph', content)
32
- })
33
28
  reader2.readAsDataURL(file)
34
29
  reader2.addEventListener('load', async (readerEvent) => {
35
30
  const imageSrc = readerEvent.target.result
@@ -41,6 +36,11 @@ export default class Svgmethods {
41
36
  height
42
37
  }
43
38
  call2('vectorgraph', svgsize)
39
+ reader.readAsText(file, 'UTF-8')
40
+ reader.addEventListener('load', async (readerEvent) => {
41
+ const content = readerEvent.target.result
42
+ call('vectorgraph', content)
43
+ })
44
44
  })
45
45
  })
46
46
  }
@@ -48,9 +48,6 @@ export default class Svgmethods {
48
48
  reader.readAsDataURL(file)
49
49
  reader.addEventListener('load', async (readerEvent) => {
50
50
  // 图片的 base64 格式, 可以直接当成 img 的 src 属性值
51
- const _base64 = reader.result
52
- const content = _base64
53
- call('picture', content)
54
51
  const imageSrc = readerEvent.target.result
55
52
  // 调用计算图片大小的方法
56
53
  calculateImageSize(imageSrc).then(function ({width, height}) {
@@ -60,6 +57,9 @@ export default class Svgmethods {
60
57
  height
61
58
  }
62
59
  call2('picture', pngsize)
60
+ const _base64 = reader.result
61
+ const content = _base64
62
+ call('picture', content)
63
63
  })
64
64
  })
65
65
  }