uni-canvas-image 1.0.5 → 1.0.6

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": "uni-canvas-image",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "租房项目使用uniapp canvas合并图片",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -50,6 +50,8 @@ export async function base64ToBlob(base64Data) {
50
50
  export async function drawImageToCanvas(arr, canvasId = 'canvas-1', api) {
51
51
  return new Promise((resolve, reject) => {
52
52
  const ctx = uni.createCanvasContext(canvasId)
53
+ context.setFillStyle('#fff')
54
+ context.fillRect(0, 0, 375, 300)
53
55
  arr.forEach((item) => {
54
56
  if (item.type === 'image') {
55
57
  const { path, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight } = item
@@ -66,7 +68,6 @@ export async function drawImageToCanvas(arr, canvasId = 'canvas-1', api) {
66
68
  roundedRectPath(ctx, x, y, width, height, borderRadius) // x, y, width, height, radius
67
69
  ctx.fill()
68
70
  } else if (item.type === 'rect2') {
69
- console.log(item, 'item')
70
71
  const { dx: x, dy: y, dWidth: width, dHeight: height, color } = item
71
72
  ctx.setFillStyle(color) // 填充
72
73
  ctx.fillRect(x, y, width, height) // x, y