@leafer-ui/paint 1.5.0 → 1.5.2

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": "@leafer-ui/paint",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "@leafer-ui/paint",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.5.0",
26
- "@leafer-ui/draw": "1.5.0"
25
+ "@leafer/core": "1.5.2",
26
+ "@leafer-ui/draw": "1.5.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.5.0",
30
- "@leafer-ui/interface": "1.5.0"
29
+ "@leafer/interface": "1.5.2",
30
+ "@leafer-ui/interface": "1.5.2"
31
31
  }
32
32
  }
package/src/FillText.ts CHANGED
@@ -5,16 +5,20 @@ import { IUI, ITextRowData } from '@leafer-ui/interface'
5
5
 
6
6
  export function fillText(ui: IUI, canvas: ILeaferCanvas): void {
7
7
 
8
- let row: ITextRowData
9
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData
8
+ let row: ITextRowData, data = ui.__.__textDrawData
9
+ const { rows, decorationY } = data
10
10
 
11
11
  for (let i = 0, len = rows.length; i < len; i++) {
12
12
  row = rows[i]
13
13
 
14
14
  if (row.text) canvas.fillText(row.text, row.x, row.y)
15
15
  else if (row.data) row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y) })
16
+ }
16
17
 
17
- if (decorationY) canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight)
18
+ if (decorationY) {
19
+ const { decorationColor, decorationHeight } = data
20
+ if (decorationColor) canvas.fillStyle = decorationColor
21
+ rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)))
18
22
  }
19
23
 
20
24
  }
package/src/StrokeText.ts CHANGED
@@ -44,16 +44,19 @@ function drawAlignStroke(align: IStrokeAlign, stroke: string | ILeafPaint[], isS
44
44
 
45
45
  export function drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void {
46
46
 
47
- let row: ITextRowData
48
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData
47
+ let row: ITextRowData, data = ui.__.__textDrawData
48
+ const { rows, decorationY } = data
49
49
 
50
50
  for (let i = 0, len = rows.length; i < len; i++) {
51
51
  row = rows[i]
52
52
 
53
53
  if (row.text) canvas.strokeText(row.text, row.x, row.y)
54
54
  else if (row.data) row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y) })
55
+ }
55
56
 
56
- if (decorationY) canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight)
57
+ if (decorationY) {
58
+ const { decorationHeight } = data
59
+ rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)))
57
60
  }
58
61
 
59
62
  }