@leafer-ui/render 1.0.0-beta → 1.0.0-beta.11

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/UIRender.ts +13 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/render",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "@leafer-ui/render",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,10 +19,10 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer-ui/external": "1.0.0-beta"
22
+ "@leafer-ui/external": "1.0.0-beta.11"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-beta",
26
- "@leafer-ui/interface": "1.0.0-beta"
25
+ "@leafer/interface": "1.0.0-beta.11",
26
+ "@leafer-ui/interface": "1.0.0-beta.11"
27
27
  }
28
28
  }
package/src/UIRender.ts CHANGED
@@ -7,14 +7,16 @@ import { Paint, Effect } from '@leafer-ui/external'
7
7
  export const UIRender: IUIRenderModule = {
8
8
 
9
9
  __updateChange(): void {
10
- let data = this.__
10
+ const data = this.__
11
11
 
12
12
  if (data.__useEffect) {
13
13
  const { shadow, innerShadow, blur, backgroundBlur } = this.__
14
14
  data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur)
15
15
  }
16
16
 
17
- let complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect || (data.blendMode && data.blendMode !== 'pass-through')
17
+ data.__checkSingle()
18
+
19
+ const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect
18
20
 
19
21
  if (complex) {
20
22
  data.__complex = true
@@ -28,23 +30,16 @@ export const UIRender: IUIRenderModule = {
28
30
 
29
31
  this.__drawRenderPath(canvas)
30
32
 
31
- if (fill) Paint.fill(this, canvas, fill)
33
+ if (fill) Paint.fill(this, canvas, fill as string)
32
34
  if (__drawAfterFill) this.__drawAfterFill(canvas, options)
33
- if (stroke) Paint.stroke(this, canvas, stroke)
35
+ if (stroke) Paint.stroke(this, canvas, stroke as string)
34
36
  },
35
37
 
36
38
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void {
37
39
 
38
40
  if (this.__.__complex) {
39
41
 
40
- const { fill, stroke, __drawAfterFill, __blendLayer } = this.__
41
-
42
- let orginCanvas: ILeaferCanvas
43
-
44
- if (__blendLayer) {
45
- orginCanvas = canvas
46
- canvas = canvas.getSameCanvas(true)
47
- }
42
+ const { fill, stroke, __drawAfterFill } = this.__
48
43
 
49
44
  this.__drawRenderPath(canvas)
50
45
 
@@ -54,30 +49,25 @@ export const UIRender: IUIRenderModule = {
54
49
 
55
50
  const { shadow, innerShadow } = this.__
56
51
 
57
- if (shadow) Effect.shadow(this, canvas, shape)
52
+ if (shadow) Effect.shadow(this, canvas, shape, options)
58
53
 
59
- if (fill) this.__.__isFills ? Paint.fills(this, canvas, fill as ILeafPaint[]) : Paint.fill(this, canvas, fill)
54
+ if (fill) this.__.__isFills ? Paint.fills(this, canvas, fill as ILeafPaint[]) : Paint.fill(this, canvas, fill as string)
60
55
 
61
56
  if (__drawAfterFill) this.__drawAfterFill(canvas, options)
62
57
 
63
- if (innerShadow) Effect.innerShadow(this, canvas, shape)
58
+ if (innerShadow) Effect.innerShadow(this, canvas, shape, options)
64
59
 
65
- if (stroke) this.__.__isStrokes ? Paint.strokes(this, canvas, stroke as ILeafStrokePaint[]) : Paint.stroke(this, canvas, stroke)
60
+ if (stroke) this.__.__isStrokes ? Paint.strokes(this, canvas, stroke as ILeafStrokePaint[]) : Paint.stroke(this, canvas, stroke as string)
66
61
 
67
62
  if (shape.worldCanvas) shape.worldCanvas.recycle()
68
63
  shape.canvas.recycle()
69
64
 
70
65
  } else {
71
66
 
72
- if (fill) this.__.__isFills ? Paint.fills(this, canvas, fill as ILeafPaint[]) : Paint.fill(this, canvas, fill)
67
+ if (fill) this.__.__isFills ? Paint.fills(this, canvas, fill as ILeafPaint[]) : Paint.fill(this, canvas, fill as string)
73
68
  if (__drawAfterFill) this.__drawAfterFill(canvas, options)
74
- if (stroke) this.__.__isStrokes ? Paint.strokes(this, canvas, stroke as ILeafStrokePaint[]) : Paint.stroke(this, canvas, stroke)
75
-
76
- }
69
+ if (stroke) this.__.__isStrokes ? Paint.strokes(this, canvas, stroke as ILeafStrokePaint[]) : Paint.stroke(this, canvas, stroke as string)
77
70
 
78
- if (orginCanvas) {
79
- orginCanvas.copyWorldToInner(canvas, this.__world, this.__layout.renderBounds, this.__.blendMode)
80
- canvas.recycle()
81
71
  }
82
72
 
83
73