sadais-piui 1.2.4-beta8 → 1.2.4-beta9

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.
@@ -36,11 +36,12 @@ export default {
36
36
  return arr.slice(0, 16).join('')
37
37
  },
38
38
  draw() {
39
+ let ctx
39
40
  // #ifdef MP-ALIPAY
40
- const ctx = uni.createCanvasContext(this.canvasId)
41
+ ctx = uni.createCanvasContext(this.canvasId)
41
42
  // #endif
42
43
  // #ifndef MP-ALIPAY
43
- const ctx = uni.createCanvasContext(this.canvasId, this)
44
+ ctx = uni.createCanvasContext(this.canvasId, this)
44
45
  // #endif
45
46
  ctx.save()
46
47
  // 填充裁剪窗口
@@ -52,18 +53,11 @@ export default {
52
53
  width: this.crop.width,
53
54
  height: this.crop.height
54
55
  })
55
- ctx.fillRect(
56
- 0,
57
- 0,
58
- this.crop.width * this.canvasZoom,
59
- this.crop.height * this.canvasZoom
60
- )
56
+ ctx.fillRect(0, 0, this.crop.width * this.canvasZoom, this.crop.height * this.canvasZoom)
61
57
  // 将画布的坐标原点 移动到裁剪窗口左上角对应的那个像素点的位置
62
58
  ctx.translate(
63
- (this.img.width * 0.5 + this.img.transform.x - this.crop.left) *
64
- this.canvasZoom,
65
- (this.img.height * 0.5 + this.img.transform.y - this.crop.top) *
66
- this.canvasZoom
59
+ (this.img.width * 0.5 + this.img.transform.x - this.crop.left) * this.canvasZoom,
60
+ (this.img.height * 0.5 + this.img.transform.y - this.crop.top) * this.canvasZoom
67
61
  )
68
62
  // 旋转图片
69
63
  ctx.rotate((this.img.transform.rotate * Math.PI) / 180)
@@ -94,7 +88,7 @@ export default {
94
88
  canvasId: this.canvasId,
95
89
  quality: this.quality,
96
90
  fileType: this.fileTpe,
97
- success: (res) => {
91
+ success: res => {
98
92
  // 裁剪成功
99
93
  // @arg 参数1 结构:{ img: 本地路径 or base64(h5端), width, height }
100
94
  this.$emit('cropped', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.4-beta8",
3
+ "version": "1.2.4-beta9",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {