zydx-plus 1.32.295 → 1.32.296

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.296",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -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
 
@@ -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>
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.296',
85
85
  install,
86
86
  Calendar,
87
87
  Message,