zydx-plus 1.32.295 → 1.32.297

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": "zydx-plus",
3
- "version": "1.32.295",
3
+ "version": "1.32.297",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1149,6 +1149,7 @@ li {
1149
1149
  .z-editor {
1150
1150
  border: 1px solid rgba(204, 204, 204, 1);
1151
1151
  position: relative;
1152
+ width: 100%;
1152
1153
  }
1153
1154
 
1154
1155
  .editor-header {
@@ -1251,7 +1252,7 @@ li {
1251
1252
  .editing-cont {
1252
1253
  padding: 120px 0 66px 0;
1253
1254
  box-sizing: border-box;
1254
- max-width: 794px;
1255
+ max-width: 594px;
1255
1256
  min-height: 700px;
1256
1257
  margin: 0 auto;
1257
1258
  }
@@ -17,8 +17,7 @@
17
17
  @mousedown.stop="textMouseDown"
18
18
  @dblclick="textDblclick"
19
19
  :style="{
20
- top: textY2/sratio + 'px',
21
- left: textX2/sratio + 'px',
20
+ transform: `translate(${textX2/sratio + 'px'},${textY2/sratio + 'px'})`,
22
21
  'min-height': textHeight +'px',
23
22
  border: `1px dashed ${color}`,
24
23
  'min-width': textWidth + 'px',
@@ -314,6 +313,7 @@ export default {
314
313
  mouse() {
315
314
  this.state = null
316
315
  this.setShow = false
316
+ this.turnText()
317
317
  },
318
318
  // 画笔
319
319
  brush() {
@@ -512,12 +512,20 @@ export default {
512
512
  y: e.offsetY*this.sratio - this.checkY
513
513
  }
514
514
  for(let i=0; i<this.pointsSelect.length; i++) {
515
- this.pointsSelect[i].x = this.pointsSelect[i].x + obj.x
516
- this.pointsSelect[i].y = this.pointsSelect[i].y + obj.y
515
+ this.pointsSelect[i].x = this.pointsSelect[i].x*this.scales/this.pointsSelect[i].scale + obj.x
516
+ this.pointsSelect[i].y = this.pointsSelect[i].y*this.scales/this.pointsSelect[i].scale + obj.y
517
517
  if(this.pointsSelect[i].type === 'straight' || this.pointsSelect[i].type === 'arrow') {
518
- this.pointsSelect[i].x2 = this.pointsSelect[i].x2 + obj.x
519
- this.pointsSelect[i].y2 = this.pointsSelect[i].y2 + obj.y
518
+ this.pointsSelect[i].x2 = this.pointsSelect[i].x2*this.scales/this.pointsSelect[i].scale + obj.x
519
+ this.pointsSelect[i].y2 = this.pointsSelect[i].y2*this.scales/this.pointsSelect[i].scale + obj.y
520
520
  }
521
+ if(this.pointsSelect[i].type === 'rectangle') {
522
+ this.pointsSelect[i].width = this.pointsSelect[i].width*this.scales/this.pointsSelect[i].scale
523
+ this.pointsSelect[i].height = this.pointsSelect[i].height*this.scales/this.pointsSelect[i].scale
524
+ }
525
+ if(this.pointsSelect[i].type === 'circular') {
526
+ this.pointsSelect[i].width = this.pointsSelect[i].width*this.scales/this.pointsSelect[i].scale
527
+ }
528
+ this.pointsSelect[i].scale = this.scales
521
529
  this.points.push(this.pointsSelect[i])
522
530
  }
523
531
  },
@@ -1037,11 +1045,13 @@ export default {
1037
1045
  }
1038
1046
  .text-frame{
1039
1047
  position: absolute;
1048
+ top: 0;
1049
+ left: 0;
1040
1050
  z-index: 10;
1041
1051
  display: inline-block;
1042
1052
  line-height: 1.1;
1043
1053
  user-select: none;
1044
- transition: all 0s;
1054
+ transition-duration: 0.05s;
1045
1055
  }
1046
1056
  .text-input{
1047
1057
  width: 100%;
@@ -1240,6 +1250,7 @@ export default {
1240
1250
  .wrap-can {
1241
1251
  display: inline-block;
1242
1252
  margin: 0 auto;
1253
+ position: relative;
1243
1254
  //cursor: none;
1244
1255
  }
1245
1256
 
@@ -20,7 +20,7 @@
20
20
  <div v-for="(it,ind) in item.alist">
21
21
  <div v-if="it.annexType === '0'">
22
22
  <div class="subject-html-title">{{ titleText }}{{ ind + 1 }}</div>
23
- <div class="subject-html-cont" v-html="it.annexContent"></div>
23
+ <div class="subject-html-cont" v-html="annexHtml(it.annexContent)"></div>
24
24
  </div>
25
25
  </div>
26
26
  </div>
@@ -143,6 +143,9 @@ export default {
143
143
  })
144
144
  })
145
145
  },
146
+ annexHtml(x) {
147
+ return json2html({node: "root", child: typeof x === 'string' ? JSON.parse(x) : x})
148
+ },
146
149
  init() {
147
150
  const val = JSON.parse(JSON.stringify(this.data))
148
151
  this.value = val.map((item, index) => { // 转换html
@@ -152,12 +155,6 @@ export default {
152
155
  item.open = item.open !== undefined ? item.open : true
153
156
  item.error = item.error !== undefined ? item.error : false
154
157
  item.subject = item.subject !== undefined ? item.subject : true
155
- if (item.alist) {
156
- item.alist.map(x => {
157
- x.annexContent = json2html({node: "root", child: typeof x.annexContent === 'string' ? JSON.parse(x.annexContent) : x.annexContent})
158
- return x
159
- })
160
- }
161
158
  if (item.testKey) {
162
159
  item.testKey = typeof item.testKey === 'string' ? JSON.parse(item.testKey) : item.testKey
163
160
  let judge = item?.judgeAnswer
@@ -2,11 +2,10 @@
2
2
  <div class="sketchpad" ref="sketchpad">
3
3
  <canvas :id="id"></canvas>
4
4
  <div class="tool"
5
- @mouseup.stop="mouseup"
6
5
  @mousedown.stop="mousedown"
7
6
  :style="{transform: `translate(${x}px, ${y}px)`}">
8
7
  <div class="tool-list" @click.stop="set">
9
- <img src="./img/shezi.png" alt=""/>
8
+ <img class="img-1" src="./img/shezi.png" alt=""/>
10
9
  <div v-if="setShow" class="set">
11
10
  <div class="set-list">
12
11
  <span>线条粗细</span>
@@ -18,17 +17,17 @@
18
17
  </div>
19
18
  </div>
20
19
  </div>
21
- <div class="tool-list" @click.stop="mouse">
22
- <img src="./img/shubiao.png" alt=""/>
20
+ <div class="tool-list" @click.stop="mouse()">
21
+ <img class="img-2" src="./img/shubiao.png" alt=""/>
23
22
  </div>
24
- <div class="tool-list" @click.stop="brush">
25
- <img src="./img/huabi.png" alt=""/>
23
+ <div class="tool-list" @click.stop="brush()">
24
+ <img class="img-3" src="./img/huabi.png" alt=""/>
26
25
  </div>
27
- <div class="tool-list" @click.stop="rectangle">
28
- <img src="./img/juxing.png" alt=""/>
26
+ <div class="tool-list" @click.stop="rectangle()">
27
+ <img class="img-4" src="./img/juxing.png" alt=""/>
29
28
  </div>
30
- <div class="tool-list" @click.stop="addTextBox">
31
- <img src="./img/wenzi.png" alt=""/>
29
+ <div class="tool-list" @click.stop="addTextBox()">
30
+ <img class="img-5" src="./img/wenzi.png" alt=""/>
32
31
  <div v-if="textShow" class="set">
33
32
  <div class="set-list">
34
33
  <span>字号</span>
@@ -43,20 +42,20 @@
43
42
  </div>
44
43
  </div>
45
44
  </div>
46
- <div class="tool-list" @click.stop="rotundity">
47
- <img src="./img/yuan.png" alt=""/>
45
+ <div class="tool-list" @click.stop="rotundity()">
46
+ <img class="img-6" src="./img/yuan.png" alt=""/>
48
47
  </div>
49
- <div class="tool-list" @click.stop="addLine">
50
- <img src="./img/jian.png" alt=""/>
48
+ <div class="tool-list" @click.stop="addLine()">
49
+ <img class="img-7" src="./img/jian.png" alt=""/>
51
50
  </div>
52
- <div class="tool-list" @click.stop="arrow">
53
- <img src="./img/jiantou.png" alt=""/>
51
+ <div class="tool-list" @click.stop="arrow()">
52
+ <img class="img-8" src="./img/jiantou.png" alt=""/>
54
53
  </div>
55
- <div class="tool-list" @click.stop="save">
56
- <img src="./img/baocun.png" alt=""/>
54
+ <div class="tool-list" @click.stop="save()">
55
+ <img class="img-9" src="./img/baocun.png" alt=""/>
57
56
  </div>
58
- <div class="tool-list" @click.stop="clear">
59
- <img src="./img/xiangpi.png" alt=""/>
57
+ <div class="tool-list" @click.stop="clear()">
58
+ <img class="img-10" src="./img/xiangpi.png" alt=""/>
60
59
  </div>
61
60
  </div>
62
61
  </div>
@@ -88,7 +87,7 @@ export default {
88
87
  left: 0,
89
88
  top: 0,
90
89
  isMove: false,
91
- x: -50,
90
+ x: 0,
92
91
  y: 0,
93
92
  offLeft: 0,
94
93
  offTop: 0,
@@ -126,17 +125,13 @@ export default {
126
125
  this.init()
127
126
  }, 0)
128
127
  window.addEventListener('keydown', this.handleKeyEvent)
129
- const ids = this.$refs.sketchpad.getBoundingClientRect()
130
- const bodyWidth = (document.documentElement.clientWidth - this.$refs.sketchpad.offsetLeft - ids.width) / 2
131
- this.offLeft = this.$refs.sketchpad.offsetLeft + bodyWidth
132
- this.offTop = ids.top
133
- // 监听滚动
134
- this.throttleHandleScroll()
135
- window.addEventListener('scroll', this.throttleHandleScroll);
136
128
  document.addEventListener('mousemove', (event) => {
137
129
  if (!this.isMove) return
138
- this.x = event.clientX - this.left;
139
- this.y = event.clientY - this.top;
130
+ const ids = this.$refs.sketchpad.getBoundingClientRect()
131
+ this.offLeft = ids.left
132
+ this.offTop = ids.top
133
+ this.x = event.clientX - this.left - this.offLeft
134
+ this.y = event.clientY - this.top - this.offTop
140
135
  })
141
136
  document.addEventListener('mouseup', (event) => {
142
137
  this.isMove = false
@@ -153,20 +148,24 @@ export default {
153
148
  textInputTap() {
154
149
  this.$refs.textInput.focus()
155
150
  },
156
- throttleHandleScroll() {
157
- this.scrollTop = document.documentElement.scrollTop || document.body.scrollTop
158
- },
159
151
  mousedown(event) {
160
- event.preventDefault()
152
+ const e = event.target || event.srcElement
153
+ let x = 0, y = 0
154
+ if(e.nodeName === 'IMG') {
155
+ const rect = e.getBoundingClientRect()
156
+ const index = e.className.split(' ')[0].split('-')[1]
157
+ x = event.clientX - rect.left
158
+ y = event.clientY - rect.top + 30*index
159
+ }else {
160
+ x = event.offsetX
161
+ y = event.offsetY
162
+ }
163
+ console.log(x,y)
161
164
  //鼠标按下事件
162
- this.left = event.offsetX + this.offLeft + 25
163
- this.top = event.offsetY + this.offTop - this.scrollTop
165
+ this.left = x
166
+ this.top = y
164
167
  this.isMove = true
165
168
  },
166
- mouseup() {
167
- //鼠标松开事件
168
- this.isMove = false
169
- },
170
169
  sizeTap(v) {
171
170
  this.fontSize = Number(v)
172
171
  },
@@ -177,9 +176,11 @@ export default {
177
176
  },
178
177
  strokeColTap(v) {
179
178
  this.color = v
179
+ this.canvas.freeDrawingBrush.color = this.color
180
180
  },
181
181
  strokeTap(v) {
182
182
  this.strokeWidth = Number(v)
183
+ this.canvas.freeDrawingBrush.width = this.strokeWidth
183
184
  },
184
185
  set() {
185
186
  this.textShow = false
@@ -521,4 +522,4 @@ export default {
521
522
  .set-right {
522
523
  text-align: right;
523
524
  }
524
- </style>
525
+ </style>
@@ -65,7 +65,7 @@
65
65
  <div v-for="(it,ind) in item.alist">
66
66
  <div v-if="it.annexType === '0'">
67
67
  <div class="subject-html-title">{{ titleText }}{{ ind + 1 }}</div>
68
- <div class="subject-html-cont" v-html="it.annexContent"></div>
68
+ <div class="subject-html-cont" v-html="annexHtml(it.annexContent)"></div>
69
69
  </div>
70
70
  </div>
71
71
  </div>
@@ -287,6 +287,9 @@ export default {
287
287
  }
288
288
  e.onClick(e,d)
289
289
  },
290
+ annexHtml(x) {
291
+ return json2html({node: "root", child: typeof x === 'string' ? JSON.parse(x) : x})
292
+ },
290
293
  init() {
291
294
  this.value = JSON.parse(JSON.stringify(this.data))
292
295
  this.value.map((item, index) => { // 转换html
@@ -299,12 +302,6 @@ export default {
299
302
  item.review = item.review !== undefined ? item.review : true
300
303
  item.subject = item.subject !== undefined ? item.subject : true
301
304
  item.error = item.error !== undefined ? item.error : false
302
- if (item.alist) {
303
- item.alist.map(x => {
304
- x.annexContent = json2html({node: "root", child: typeof x.annexContent === 'string' ? JSON.parse(x.annexContent) : x.annexContent})
305
- return x
306
- })
307
- }
308
305
  if (item.testKey) {
309
306
  item.testKey = typeof item.testKey === 'string' ? JSON.parse(item.testKey) : item.testKey
310
307
  let judge = item?.judgeAnswer
package/src/index.js CHANGED
@@ -81,7 +81,7 @@ function install(app) {
81
81
  }
82
82
 
83
83
  export default {
84
- version: '1.32.295',
84
+ version: '1.32.297',
85
85
  install,
86
86
  Calendar,
87
87
  Message,