@leafer-ui/paint 1.0.7 → 1.0.9

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.0.7",
3
+ "version": "1.0.9",
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.0.7",
26
- "@leafer-ui/draw": "1.0.7"
25
+ "@leafer/core": "1.0.9",
26
+ "@leafer-ui/draw": "1.0.9"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.7",
30
- "@leafer-ui/interface": "1.0.7"
29
+ "@leafer/interface": "1.0.9",
30
+ "@leafer-ui/interface": "1.0.9"
31
31
  }
32
32
  }
package/src/Compute.ts CHANGED
@@ -20,12 +20,7 @@ export function compute(attrName: IPaintAttr, ui: IUI): void {
20
20
  (data as IObject)['_' + attrName] = leafPaints.length ? leafPaints : undefined
21
21
 
22
22
  if (leafPaints.length && leafPaints[0].image) hasOpacityPixel = leafPaints[0].image.hasOpacityPixel
23
-
24
- if (attrName === 'fill') {
25
- data.__pixelFill = hasOpacityPixel
26
- } else {
27
- data.__pixelStroke = hasOpacityPixel
28
- }
23
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel
29
24
  }
30
25
 
31
26
 
package/src/FillText.ts CHANGED
@@ -11,13 +11,8 @@ export function fillText(ui: IUI, canvas: ILeaferCanvas): void {
11
11
  for (let i = 0, len = rows.length; i < len; i++) {
12
12
  row = rows[i]
13
13
 
14
- if (row.text) {
15
- canvas.fillText(row.text, row.x, row.y)
16
- } else if (row.data) {
17
- row.data.forEach(charData => {
18
- canvas.fillText(charData.char, charData.x, row.y)
19
- })
20
- }
14
+ if (row.text) canvas.fillText(row.text, row.x, row.y)
15
+ else if (row.data) row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y) })
21
16
 
22
17
  if (decorationY) canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight)
23
18
  }
package/src/Stroke.ts CHANGED
@@ -47,11 +47,8 @@ export function stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void {
47
47
  options.windingRule ? out.clip(options.windingRule) : out.clip()
48
48
  out.clearWorld(ui.__layout.renderBounds)
49
49
 
50
- if (ui.__worldFlipped) {
51
- canvas.copyWorldByReset(out, ui.__nowWorld)
52
- } else {
53
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
54
- }
50
+ if (ui.__worldFlipped) canvas.copyWorldByReset(out, ui.__nowWorld)
51
+ else canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
55
52
 
56
53
  out.recycle(ui.__nowWorld)
57
54
  break
@@ -101,11 +98,8 @@ export function strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas):
101
98
  options.windingRule ? out.clip(options.windingRule) : out.clip()
102
99
  out.clearWorld(renderBounds)
103
100
 
104
- if (ui.__worldFlipped) {
105
- canvas.copyWorldByReset(out, ui.__nowWorld)
106
- } else {
107
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds)
108
- }
101
+ if (ui.__worldFlipped) canvas.copyWorldByReset(out, ui.__nowWorld)
102
+ else canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds)
109
103
 
110
104
  out.recycle(ui.__nowWorld)
111
105
  break
package/src/StrokeText.ts CHANGED
@@ -36,11 +36,8 @@ function drawAlignStroke(align: IStrokeAlign, stroke: string | ILeafPaint[], isS
36
36
  fillText(ui, out)
37
37
  out.blendMode = 'normal'
38
38
 
39
- if (ui.__worldFlipped) {
40
- canvas.copyWorldByReset(out, ui.__nowWorld)
41
- } else {
42
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
43
- }
39
+ if (ui.__worldFlipped) canvas.copyWorldByReset(out, ui.__nowWorld)
40
+ else canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
44
41
 
45
42
  out.recycle(ui.__nowWorld)
46
43
  }
@@ -53,13 +50,8 @@ export function drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void {
53
50
  for (let i = 0, len = rows.length; i < len; i++) {
54
51
  row = rows[i]
55
52
 
56
- if (row.text) {
57
- canvas.strokeText(row.text, row.x, row.y)
58
- } else if (row.data) {
59
- row.data.forEach(charData => {
60
- canvas.strokeText(charData.char, charData.x, row.y)
61
- })
62
- }
53
+ if (row.text) canvas.strokeText(row.text, row.x, row.y)
54
+ else if (row.data) row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y) })
63
55
 
64
56
  if (decorationY) canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight)
65
57
  }
@@ -74,7 +66,6 @@ export function drawStrokesStyle(strokes: ILeafStrokePaint[], isText: boolean, u
74
66
  if (item.image && PaintImage.checkImage(ui, canvas, item, false)) continue
75
67
 
76
68
  if (item.style) {
77
-
78
69
  canvas.strokeStyle = item.style
79
70
 
80
71
  if (item.blendMode) {