zydx-plus 1.32.293 → 1.32.295

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.293",
3
+ "version": "1.32.295",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -11,7 +11,19 @@
11
11
  <div class="wrap-can" ref="wrapCan">
12
12
  <canvas @click.stop="turnText" class="wrap-can-one" @mousedown.stop="mouseDown" @mousemove.stop="mouseMove" :id="id"></canvas>
13
13
  <canvas :id="`${id}2`"></canvas>
14
- <div v-if="state === 'text'&&textY2>0&&textX2>0" class="text-frame" :style="{top: textY2/sratio + 'px', left: textX2/sratio + 'px','min-height': fontSize+8 +'px', border: `1px dashed ${color}`}">
14
+ <div
15
+ v-show="state === 'text'&&textY2>0&&textX2>0"
16
+ class="text-frame"
17
+ @mousedown.stop="textMouseDown"
18
+ @dblclick="textDblclick"
19
+ :style="{
20
+ top: textY2/sratio + 'px',
21
+ left: textX2/sratio + 'px',
22
+ 'min-height': textHeight +'px',
23
+ border: `1px dashed ${color}`,
24
+ 'min-width': textWidth + 'px',
25
+ cursor: contenteditable? 'text': 'move'
26
+ }">
15
27
  <div class="text-input" ref="textInput" :style="{'font-size': fontSize + 'px',color: color}" :contenteditable="contenteditable"></div>
16
28
  </div>
17
29
  </div>
@@ -31,7 +43,7 @@
31
43
  </button>
32
44
  </div>
33
45
  </div>
34
- <div class="flip-tool" @click="flipTool" :style="{height: flipToolShow? '600px': '25px', overflow: flipToolShow2? 'visible':'hidden'}">
46
+ <div v-if="readingPen" class="flip-tool" @click="flipTool" :style="{height: flipToolShow? '600px': '25px', overflow: flipToolShow2? 'visible':'hidden'}">
35
47
  <div class="tool-text" v-if="!flipToolShow">
36
48
  <span>阅读笔</span>
37
49
  </div>
@@ -172,7 +184,12 @@ export default {
172
184
  pointsSelect: [],
173
185
  checkDrawing: false,
174
186
  checkX: 0,
175
- checkY: 0
187
+ checkY: 0,
188
+ textWidth: 0,
189
+ textHeight: 0,
190
+ textDownX: 0,
191
+ textDownY: 0,
192
+ textMoveStart: false,
176
193
  }
177
194
  },
178
195
  props: {
@@ -203,6 +220,10 @@ export default {
203
220
  pointsData: {
204
221
  type: Array,
205
222
  default: () => []
223
+ },
224
+ readingPen: {
225
+ type: Boolean,
226
+ default: false
206
227
  }
207
228
  },
208
229
  watch: {
@@ -246,21 +267,35 @@ export default {
246
267
  emits: ['flip','updateData'],
247
268
  mounted() {
248
269
  this.id = 'canvas-wrap' + Math.random().toString(36).substr(2)
270
+ window.addEventListener('keydown', this.handleKeyEvent)
249
271
  // 在画板以外松开鼠标后冻结画笔
250
272
  document.onmouseup = () => {
251
273
  if (this.isDrawing || this.checkDrawing) this.mouseUp()
274
+ this.textMoveStart = false
252
275
  }
253
276
  },
277
+ beforeDestroy() {
278
+ window.removeEventListener('keydown', this.handleKeyEvent)
279
+ },
254
280
  methods: {
281
+ handleKeyEvent(e) {
282
+ const {key} = e
283
+ if (key === 'Backspace' || key === 'Delete') {
284
+ this.backward()
285
+ }
286
+ },
255
287
  empty() {
288
+ this.setShow = false
256
289
  this.points = []
257
290
  this.clearRect(true)
258
291
  },
259
292
  preserve() {
293
+ this.setShow = false
260
294
  this.$emit('updateData', this.points)
261
295
  },
262
296
  // 后退
263
297
  backward() {
298
+ this.setShow = false
264
299
  if(this.points.length === 0) return
265
300
  if(this.points[this.points.length - 1].type === 'line') {
266
301
  const id = this.points[this.points.length - 1].id
@@ -283,7 +318,7 @@ export default {
283
318
  // 画笔
284
319
  brush() {
285
320
  this.state = 'brush'
286
- this.setShow = !this.setShow
321
+ this.setShow = true
287
322
  this.top = 60
288
323
  },
289
324
  // 文字字号
@@ -293,34 +328,38 @@ export default {
293
328
  // 矩形
294
329
  rectangleTap() {
295
330
  this.state = 'rectangle'
296
- this.setShow = !this.setShow
331
+ this.setShow = true
297
332
  this.top = 60*3
298
333
  },
299
334
  // 圆形
300
335
  circularTap() {
301
336
  this.state = 'circular'
302
- this.setShow = !this.setShow
337
+ this.setShow = true
303
338
  this.top = 60*4
304
339
  },
305
340
  // 直线
306
341
  straightTap() {
307
342
  this.state = 'straight'
308
- this.setShow = !this.setShow
343
+ this.setShow = true
309
344
  this.top = 60*5
310
345
  },
311
346
  // 箭头
312
347
  arrowTap() {
313
348
  this.state = 'arrow'
314
- this.setShow = !this.setShow
349
+ this.setShow = true
315
350
  this.top = 60*6
316
351
  },
352
+ // 文字
317
353
  textTap() {
318
354
  this.state = 'text'
319
- this.setShow = !this.setShow
355
+ this.setShow = true
320
356
  this.top = 60*2
321
357
  this.textStart = true
322
358
  this.textX2 = 0
323
359
  this.textY2 = 0
360
+ this.textWidth = 100
361
+ this.textHeight = this.fontSize + 1
362
+ this.$refs.textInput.innerText = ''
324
363
  },
325
364
  flipTool() {
326
365
  this.setShow = false
@@ -355,36 +394,42 @@ export default {
355
394
  if (this.points[i].index === this.pageIndex) {
356
395
  const x1 = this.points[i].x*this.scales/this.points[i].scale
357
396
  const y1 = this.points[i].y*this.scales/this.points[i].scale
358
- if(this.points[i].type === 'arrow') {
359
- const x2 = this.points[i+1].x*this.scales/this.points[i].scale
360
- const y2 = this.points[i+1].y*this.scales/this.points[i].scale
361
- const x3 = obj.x
362
- const y3 = obj.y
363
- const a = Math.abs((x1-x2)*(y1-y3)-(x1-x3)*(y1-y2))
364
- const b = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))
365
- const c = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2))
366
- const d = Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2))
367
- if(a/b <= 5 && c <= b && d <= b) {
368
- console.log(this.points[i])
397
+ // 判断点击的是否是圆
398
+ if(this.points[i]?.type === 'circular') {
399
+ const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
400
+ const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
401
+ const a = Math.sqrt(Math.pow(x1-obj.x,1.65)+Math.pow(y1-obj.y,1.65))
402
+ const b = Math.sqrt(Math.pow(x2-obj.x,1.65)+Math.pow(y2-obj.y,1.65))
403
+ const c = Math.sqrt(Math.pow(x1-obj.x,1.65)+Math.pow(y2-obj.y,1.65))
404
+ const d = Math.sqrt(Math.pow(x2-obj.x,1.65)+Math.pow(y1-obj.y,1.65))
405
+ const e = this.points[i].width*this.scales/this.points[i].scale/2
406
+ if(a <= e || b <= e || c <= e || d <= e) {
407
+ this.pointsSelect.push(this.points[i])
408
+ this.circularProcessing(this.points[i],{x:0,y:0})
409
+ this.points.splice(i,1)
369
410
  }
370
411
  }
371
- if(this.points[i].type === 'text') {
372
- const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].text[0].length*this.points[i].size*this.scales/this.points[i].scale
373
- const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].text.length*this.points[i].size*this.scales/this.points[i].scale
412
+ if(this.points[i]?.type === 'text') {
413
+ // 取最长的一行文字
414
+ let len = 0
415
+ this.points[i].text.forEach(item => {
416
+ if(item.length > len) len = item.length
417
+ })
418
+ const x2 = this.points[i].x*this.scales/this.points[i].scale + len*this.points[i].size*this.sratio
419
+ const y2 = this.points[i].y*this.scales/this.points[i].scale + len*this.points[i].size*this.sratio
374
420
  if(obj.x >= x1 && obj.x <= x2 && obj.y >= y1 && obj.y <= y2) {
375
- console.log(this.points[i])
376
- }
377
- }
378
- if(this.points[i].type === 'circular') {
379
- const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
380
- const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
381
- const a = Math.sqrt(Math.pow(obj.x-x1,2)+Math.pow(obj.y-y1,2))
382
- const b = Math.sqrt(Math.pow(obj.x-x2,2)+Math.pow(obj.y-y2,2))
383
- if(a <= this.points[i].width*this.scales/this.points[i].scale && b <= this.points[i].width*this.scales/this.points[i].scale) {
384
- console.log(this.points[i])
421
+ this.state = 'text'
422
+ this.textX2 = x1
423
+ this.textY2 = y1
424
+ this.textWidth = 'auto'
425
+ this.color = this.points[i].color
426
+ this.textHeight = this.points[i].text.length*this.points[i].size + 1
427
+ this.$refs.textInput.innerText = this.points[i].text.join('\n')
428
+ this.points.splice(i,1)
429
+ this.clearRect()
385
430
  }
386
431
  }
387
- if(this.points[i].type === 'rectangle') {
432
+ if(this.points[i]?.type === 'rectangle') {
388
433
  const x2 = this.points[i].x*this.scales/this.points[i].scale + this.points[i].width*this.scales/this.points[i].scale
389
434
  const y2 = this.points[i].y*this.scales/this.points[i].scale + this.points[i].height*this.scales/this.points[i].scale
390
435
  if(obj.x >= x1 && obj.x <= x2 && obj.y >= y1 && obj.y <= y2) {
@@ -393,7 +438,7 @@ export default {
393
438
  this.points.splice(i,1)
394
439
  }
395
440
  }
396
- if(this.points[i].type === 'line') {
441
+ if(this.points[i]?.type === 'line') {
397
442
  const x2 = this.points[i+1]?this.points[i+1].x*this.scales/this.points[i].scale:0
398
443
  const y2 = this.points[i+1]?this.points[i+1].y*this.scales/this.points[i].scale:0
399
444
  const x3 = obj.x
@@ -402,27 +447,47 @@ export default {
402
447
  const b = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))
403
448
  const c = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2))
404
449
  const d = Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2))
405
- if(a/b <= 7 && c <= b && d <= b) {
406
- for(let i=0; i<this.points.length; i++) {
407
- if(this.points[i].id === this.points[i].id) {
408
- this.pointsSelect.push(this.points[i])
409
- this.lineProcessing(this.points[i],this.points[i+1],{x:0,y:0})
410
- this.points.splice(i,1)
411
- i--
450
+ if(a/b <= 5 && c <= b && d <= b) {
451
+ const id = this.points[i].id
452
+ for(let j=0; j<this.points.length; j++) {
453
+ if(this.points[j].id === id) {
454
+ this.pointsSelect.push(this.points[j])
455
+ this.lineProcessing(this.points[j],this.points[j+1],{x:0,y:0})
456
+ this.points.splice(j,1)
457
+ j--
412
458
  }
413
459
  }
414
460
  }
415
461
  }
462
+ if(this.points[i]?.type === 'straight' || this.points[i]?.type === 'arrow') {
463
+ const x2 = this.points[i].x2*this.scales/this.points[i].scale
464
+ const y2 = this.points[i].y2*this.scales/this.points[i].scale
465
+ const x3 = obj.x
466
+ const y3 = obj.y
467
+ const a = Math.abs((x1-x2)*(y1-y3)-(x1-x3)*(y1-y2))
468
+ const b = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))
469
+ const c = Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2))
470
+ const d = Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2))
471
+ if(a/b <= 5 && c <= b && d <= b) {
472
+ this.pointsSelect.push(this.points[i])
473
+ if(this.points[i].type === 'straight') {
474
+ this.straightProcessing(this.points[i],{x:0,y:0})
475
+ }else {
476
+ this.arrowProcessing(this.points[i],{x:0,y:0})
477
+ }
478
+ this.points.splice(i,1)
479
+ }
480
+ }
416
481
  }
417
482
  }
418
483
  },
419
484
  checkMove(e) {
485
+ if(this.pointsSelect.length === 0) return
420
486
  let obj = {
421
487
  x: e.offsetX*this.sratio - this.checkX,
422
488
  y: e.offsetY*this.sratio - this.checkY
423
489
  }
424
490
  this.clearRect()
425
- console.log(this.pointsSelect)
426
491
  for(let i=0; i<this.pointsSelect.length; i++) {
427
492
  if(this.pointsSelect[i].type === 'line') {
428
493
  this.lineProcessing(this.pointsSelect[i],this.pointsSelect[i+1],obj)
@@ -430,6 +495,15 @@ export default {
430
495
  if(this.pointsSelect[i].type === 'rectangle') {
431
496
  this.rectangleProcessing(this.pointsSelect[i],obj)
432
497
  }
498
+ if(this.pointsSelect[i].type === 'straight') {
499
+ this.straightProcessing(this.pointsSelect[i],obj)
500
+ }
501
+ if(this.pointsSelect[i].type === 'arrow') {
502
+ this.arrowProcessing(this.pointsSelect[i],obj)
503
+ }
504
+ if(this.pointsSelect[i].type === 'circular') {
505
+ this.circularProcessing(this.pointsSelect[i],obj)
506
+ }
433
507
  }
434
508
  },
435
509
  checkUp(e) {
@@ -440,6 +514,10 @@ export default {
440
514
  for(let i=0; i<this.pointsSelect.length; i++) {
441
515
  this.pointsSelect[i].x = this.pointsSelect[i].x + obj.x
442
516
  this.pointsSelect[i].y = this.pointsSelect[i].y + obj.y
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
520
+ }
443
521
  this.points.push(this.pointsSelect[i])
444
522
  }
445
523
  },
@@ -449,7 +527,7 @@ export default {
449
527
  e.preventDefault()
450
528
  if(this.state === null) {
451
529
  this.checkDrawing = true
452
- // this.checkDown(e)
530
+ this.checkDown(e)
453
531
  return
454
532
  }
455
533
  this.isDrawing = true
@@ -459,11 +537,24 @@ export default {
459
537
  }
460
538
  this.drawStart(obj)
461
539
  },
540
+ textDblclick() {
541
+ if(!this.contenteditable) this.contenteditable = true
542
+ },
543
+ textMouseDown(e) {
544
+ e = e || event
545
+ this.textDownX = e.offsetX
546
+ this.textDownY = e.offsetY
547
+ this.textMoveStart = true
548
+ },
462
549
  mouseMove (e) {
463
550
  e = e || event
464
551
  e.preventDefault()
552
+ if(this.textMoveStart) {
553
+ this.textX2 = e.offsetX*this.sratio - this.textDownX
554
+ this.textY2 = e.offsetY*this.sratio - this.textDownY
555
+ }
465
556
  if(this.state === null) {
466
- // if(this.checkDrawing) this.checkMove(e)
557
+ if(this.checkDrawing) this.checkMove(e)
467
558
  return
468
559
  }
469
560
  if (this.isDrawing) {
@@ -479,7 +570,7 @@ export default {
479
570
  e.preventDefault()
480
571
  if(this.state === null) {
481
572
  this.checkDrawing = false
482
- // this.checkUp(e)
573
+ this.checkUp(e)
483
574
  return
484
575
  }
485
576
  let obj = {
@@ -560,6 +651,7 @@ export default {
560
651
  this.ctx.fillStyle = this.color;
561
652
  this.ctx.fillText(arr[i],this.textX2,this.textY2 + this.fontSize*this.sratio*i + this.fontSize*this.sratio);
562
653
  this.ctx.stroke()
654
+ this.ctx.closePath()
563
655
  }
564
656
  this.points.push({
565
657
  x: this.textX2,
@@ -603,6 +695,7 @@ export default {
603
695
  arrowY = obj.y + botY;
604
696
  this.ctx.lineTo(arrowX, arrowY)
605
697
  this.ctx.stroke()
698
+ this.ctx.closePath()
606
699
  if(type === 'end') {
607
700
  this.points.push({
608
701
  x: this.textX,
@@ -633,6 +726,7 @@ export default {
633
726
  this.ctx.moveTo(this.textX, this.textY)
634
727
  this.ctx.lineTo(obj.x, obj.y)
635
728
  this.ctx.stroke()
729
+ this.ctx.closePath()
636
730
  if(type === 'end') {
637
731
  this.points.push({
638
732
  x: this.textX,
@@ -664,6 +758,7 @@ export default {
664
758
  this.ctx.moveTo(obj.x,this.textY)
665
759
  this.ctx.arc(this.textX, this.textY, obj.x-this.textX, 0, 2 * Math.PI, false);
666
760
  this.ctx.stroke()
761
+ this.ctx.closePath()
667
762
  if(type === 'end') {
668
763
  this.points.push({
669
764
  x: this.textX,
@@ -692,6 +787,7 @@ export default {
692
787
  this.ctx.strokeStyle = this.color
693
788
  this.ctx.rect(this.textX, this.textY, obj.x-this.textX, obj.y-this.textY);
694
789
  this.ctx.stroke()
790
+ this.ctx.closePath()
695
791
  if(type === 'end') {
696
792
  this.points.push({
697
793
  x: this.textX,
@@ -746,12 +842,65 @@ export default {
746
842
  this.ctx.stroke()
747
843
  this.ctx.closePath()
748
844
  },
749
- rectangleProcessing(data,v = {x:0,y:0}) {
845
+ rectangleProcessing(data,v) {
750
846
  this.ctx.beginPath()
751
847
  this.ctx.lineWidth = data.border * this.sratio
752
848
  this.ctx.strokeStyle = data.color
753
849
  this.ctx.strokeRect(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y, data.width*this.scales/data.scale, data.height*this.scales/data.scale);
754
850
  this.ctx.stroke()
851
+ this.ctx.closePath()
852
+ },
853
+ circularProcessing(data,v) {
854
+ this.ctx.beginPath()
855
+ this.ctx.lineWidth = data.border * this.sratio
856
+ this.ctx.strokeStyle = data.color
857
+ this.ctx.arc(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y, data.width*this.scales/data.scale, 0, 2 * Math.PI, false);
858
+ this.ctx.stroke()
859
+ this.ctx.closePath()
860
+ },
861
+ straightProcessing(data,v) {
862
+ this.ctx.beginPath()
863
+ this.ctx.lineWidth = data.border * this.sratio
864
+ this.ctx.strokeStyle = data.color
865
+ this.ctx.moveTo(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y)
866
+ this.ctx.lineTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y)
867
+ this.ctx.stroke()
868
+ this.ctx.closePath()
869
+ },
870
+ arrowProcessing(data,v) {
871
+ const angle = Math.atan2(data.y*this.scales/data.scale - data.y2*this.scales/data.scale, data.x*this.scales/data.scale - data.x2*this.scales/data.scale) * 180 / Math.PI
872
+ const angle1 = (angle + 20) * Math.PI / 180
873
+ const angle2 = (angle - 20) * Math.PI / 180
874
+ const topX = 30 * Math.cos(angle1)
875
+ const topY = 30 * Math.sin(angle1)
876
+ const botX = 30 * Math.cos(angle2)
877
+ const botY = 30 * Math.sin(angle2)
878
+ this.ctx.beginPath();
879
+ this.ctx.lineWidth = data.border * this.sratio
880
+ this.ctx.strokeStyle = data.color
881
+ let arrowX, arrowY
882
+ this.ctx.moveTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y);
883
+ this.ctx.lineTo(data.x*this.scales/data.scale + v.x, data.y*this.scales/data.scale + v.y);
884
+ arrowX = data.x2*this.scales/data.scale + topX + v.x
885
+ arrowY = data.y2*this.scales/data.scale + topY + v.y
886
+ this.ctx.moveTo(arrowX, arrowY);
887
+ this.ctx.lineTo(data.x2*this.scales/data.scale + v.x, data.y2*this.scales/data.scale + v.y)
888
+ arrowX = data.x2*this.scales/data.scale + botX + v.x;
889
+ arrowY = data.y2*this.scales/data.scale + botY + v.y;
890
+ this.ctx.lineTo(arrowX, arrowY)
891
+ this.ctx.stroke()
892
+ this.ctx.closePath()
893
+ },
894
+ textProcessing(data,v) {
895
+ const arr = data.text
896
+ for(let i = 0; i < arr.length; i++) {
897
+ this.ctx.beginPath();
898
+ this.ctx.font = `${data.size*this.sratio}px 黑体`;
899
+ this.ctx.fillStyle = data.color;
900
+ this.ctx.fillText(arr[i],data.x*this.scales/data.scale + v.x,data.y*this.scales/data.scale + v.y + data.size*this.sratio*i + data.size*this.sratio);
901
+ this.ctx.stroke()
902
+ this.ctx.closePath()
903
+ }
755
904
  },
756
905
  // 处理数据
757
906
  processing() {
@@ -764,52 +913,16 @@ export default {
764
913
  this.rectangleProcessing(this.points[i],{x:0,y:0})
765
914
  }
766
915
  if(this.points[i].type === 'circular') {
767
- this.ctx.beginPath()
768
- this.ctx.lineWidth = this.points[i].border * this.sratio
769
- this.ctx.strokeStyle = this.points[i].color
770
- this.ctx.arc(this.points[i].x*this.scales/this.points[i].scale, this.points[i].y*this.scales/this.points[i].scale, this.points[i].width*this.scales/this.points[i].scale, 0, 2 * Math.PI, false);
771
- this.ctx.stroke()
916
+ this.circularProcessing(this.points[i],{x:0,y:0})
772
917
  }
773
918
  if(this.points[i].type === 'straight') {
774
- this.ctx.beginPath()
775
- this.ctx.lineWidth = this.points[i].border * this.sratio
776
- this.ctx.strokeStyle = this.points[i].color
777
- this.ctx.moveTo(this.points[i].x*this.scales/this.points[i].scale, this.points[i].y*this.scales/this.points[i].scale)
778
- this.ctx.lineTo(this.points[i].x2*this.scales/this.points[i].scale, this.points[i].y2*this.scales/this.points[i].scale)
779
- this.ctx.stroke()
919
+ this.straightProcessing(this.points[i],{x:0,y:0})
780
920
  }
781
921
  if(this.points[i].type === 'arrow') {
782
- const angle = Math.atan2(this.points[i].y*this.scales/this.points[i].scale - this.points[i].y2*this.scales/this.points[i].scale, this.points[i].x*this.scales/this.points[i].scale - this.points[i].x2*this.scales/this.points[i].scale) * 180 / Math.PI
783
- const angle1 = (angle + 20) * Math.PI / 180
784
- const angle2 = (angle - 20) * Math.PI / 180
785
- const topX = 30 * Math.cos(angle1)
786
- const topY = 30 * Math.sin(angle1)
787
- const botX = 30 * Math.cos(angle2)
788
- const botY = 30 * Math.sin(angle2)
789
- this.ctx.beginPath();
790
- this.ctx.lineWidth = this.points[i].border * this.sratio
791
- this.ctx.strokeStyle = this.points[i].color
792
- let arrowX, arrowY
793
- this.ctx.moveTo(this.points[i].x2*this.scales/this.points[i].scale, this.points[i].y2*this.scales/this.points[i].scale);
794
- this.ctx.lineTo(this.points[i].x*this.scales/this.points[i].scale, this.points[i].y*this.scales/this.points[i].scale);
795
- arrowX = this.points[i].x2*this.scales/this.points[i].scale + topX
796
- arrowY = this.points[i].y2*this.scales/this.points[i].scale + topY
797
- this.ctx.moveTo(arrowX, arrowY);
798
- this.ctx.lineTo(this.points[i].x2*this.scales/this.points[i].scale, this.points[i].y2*this.scales/this.points[i].scale)
799
- arrowX = this.points[i].x2*this.scales/this.points[i].scale + botX;
800
- arrowY = this.points[i].y2*this.scales/this.points[i].scale + botY;
801
- this.ctx.lineTo(arrowX, arrowY)
802
- this.ctx.stroke();
922
+ this.arrowProcessing(this.points[i],{x:0,y:0})
803
923
  }
804
924
  if(this.points[i].type === 'text') {
805
- const arr = this.points[i].text
806
- for(let j = 0; j < arr.length; j++) {
807
- this.ctx.beginPath();
808
- this.ctx.font = `${this.points[i].size*this.sratio}px 黑体`;
809
- this.ctx.fillStyle = this.points[i].color;
810
- this.ctx.fillText(arr[j],this.points[i].x*this.scales/this.points[i].scale,this.points[i].y*this.scales/this.points[i].scale + this.points[i].size*this.sratio*j + this.points[i].size*this.sratio);
811
- this.ctx.stroke();
812
- }
925
+ this.textProcessing(this.points[i],{x:0,y:0})
813
926
  }
814
927
  }
815
928
  }
@@ -926,7 +1039,9 @@ export default {
926
1039
  position: absolute;
927
1040
  z-index: 10;
928
1041
  display: inline-block;
929
- min-width: 100px;
1042
+ line-height: 1.1;
1043
+ user-select: none;
1044
+ transition: all 0s;
930
1045
  }
931
1046
  .text-input{
932
1047
  width: 100%;
package/src/index.js CHANGED
@@ -81,7 +81,7 @@ function install(app) {
81
81
  }
82
82
 
83
83
  export default {
84
- version: '1.32.293',
84
+ version: '1.32.295',
85
85
  install,
86
86
  Calendar,
87
87
  Message,