uni-canvas-image 1.0.2 → 1.0.4

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.2",
3
+ "version": "1.0.4",
4
4
  "description": "租房项目使用uniapp canvas合并图片",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -76,7 +76,7 @@ export async function drawImageToCanvas(arr, canvasId = 'canvas-1', api) {
76
76
  uni.canvasToTempFilePath({
77
77
  canvasId,
78
78
  fileType: 'jpg',
79
- quality: 0.1,
79
+ quality: 1,
80
80
  destWidth: 1500,
81
81
  destHeight: 1200,
82
82
  success: async (tempRes) => {
@@ -131,7 +131,7 @@ export function handleParagraph(text, lineLength = 25, line = 2) {
131
131
  for (let i = 0; i < line; i++) {
132
132
  let str = text.slice(i * lineLength, (i + 1) * lineLength)
133
133
  if (i === line - 1 && text.length > (i + 1) * lineLength) str = str.slice(0, -1) + '...'
134
- if (str.trim()) textArray.push(str)
134
+ if (str && str.trim()) textArray.push(str)
135
135
  }
136
136
  return textArray
137
137
  }
@@ -81,7 +81,7 @@ function handleItems(arr, canvasId, api) {
81
81
  }
82
82
  })
83
83
  // 标签
84
- const tagsInfos = hanleTagsInfo(obj.tags, 160, 60 + i * 152)
84
+ const tagsInfos = hanleTagsInfo(obj.tags, 160, (titleInfos.length > 1 ? 60 : 54) + i * 152)
85
85
  // 分类信息
86
86
  const category = [
87
87
  { text: '单价', x: 160, y: 90 + i * 152, fontSize: 14, color: '#9B9B9B' },
@@ -40,7 +40,7 @@ function handleItem(obj, canvasId, api) {
40
40
  type: 'text',
41
41
  text,
42
42
  x: 10,
43
- y: 230 + index * 18,
43
+ y: (titleInfos.length > 1 ? 230 : 220) + index * 18,
44
44
  fontSize: 12,
45
45
  color: '#9B9B9B',
46
46
  }
@@ -82,7 +82,7 @@ function handleItems(arr, canvasId, api) {
82
82
  type: 'text',
83
83
  text,
84
84
  x: 144,
85
- y: 60 + i * 140 + index * 18,
85
+ y: (titleInfos.length > 1 ? 60 : 50) + i * 140 + index * 18,
86
86
  fontSize: 10,
87
87
  color: '#9B9B9B',
88
88
  }