@leafer-ui/render 1.0.0-rc.1 → 1.0.0-rc.10
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 +5 -5
- package/src/RectRender.ts +7 -5
- package/src/UIRender.ts +23 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/render",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.10",
|
|
4
4
|
"description": "@leafer-ui/render",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/leaferjs/ui.git"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/leaferjs/ui/tree/main/packages/render",
|
|
18
|
+
"homepage": "https://github.com/leaferjs/ui/tree/main/packages/display-module/render",
|
|
19
19
|
"bugs": "https://github.com/leaferjs/ui/issues",
|
|
20
20
|
"keywords": [
|
|
21
21
|
"leafer-ui",
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer-ui/external": "1.0.0-rc.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.0.0-rc.
|
|
29
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
28
|
+
"@leafer/interface": "1.0.0-rc.10",
|
|
29
|
+
"@leafer-ui/interface": "1.0.0-rc.10"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/RectRender.ts
CHANGED
|
@@ -18,19 +18,21 @@ export const RectRender: IRectRenderModule = {
|
|
|
18
18
|
|
|
19
19
|
if (stroke) {
|
|
20
20
|
|
|
21
|
-
const { strokeAlign,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const { strokeAlign, __strokeWidth } = this.__
|
|
22
|
+
if (!__strokeWidth) return
|
|
23
|
+
|
|
24
|
+
canvas.setStroke(stroke, __strokeWidth, this.__)
|
|
25
|
+
const half = __strokeWidth / 2
|
|
24
26
|
|
|
25
27
|
switch (strokeAlign) {
|
|
26
28
|
case 'center':
|
|
27
29
|
canvas.strokeRect(0, 0, width, height)
|
|
28
30
|
break
|
|
29
31
|
case 'inside':
|
|
30
|
-
canvas.strokeRect(half, half, width -
|
|
32
|
+
canvas.strokeRect(half, half, width - __strokeWidth, height - __strokeWidth)
|
|
31
33
|
break
|
|
32
34
|
case 'outside':
|
|
33
|
-
canvas.strokeRect(-half, -half, width +
|
|
35
|
+
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth)
|
|
34
36
|
break
|
|
35
37
|
}
|
|
36
38
|
}
|
package/src/UIRender.ts
CHANGED
|
@@ -30,47 +30,51 @@ export const UIRender: IUIRenderModule = {
|
|
|
30
30
|
|
|
31
31
|
this.__drawRenderPath(canvas)
|
|
32
32
|
|
|
33
|
-
if (fill) Paint.fill(
|
|
33
|
+
if (fill) Paint.fill(fill as string, this, canvas)
|
|
34
34
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options)
|
|
35
|
-
if (stroke) Paint.stroke(
|
|
35
|
+
if (stroke) Paint.stroke(stroke as string, this, canvas)
|
|
36
36
|
},
|
|
37
37
|
|
|
38
38
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void {
|
|
39
39
|
|
|
40
40
|
if (this.__.__complex) {
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const data = this.__
|
|
43
|
+
|
|
44
|
+
if (data.__needComputePaint) data.__computePaint()
|
|
45
|
+
|
|
46
|
+
const { fill, stroke, __drawAfterFill } = data
|
|
43
47
|
|
|
44
48
|
this.__drawRenderPath(canvas)
|
|
45
49
|
|
|
46
|
-
if (
|
|
50
|
+
if (data.__useEffect) {
|
|
47
51
|
|
|
48
52
|
const shape = Paint.shape(this, canvas, options)
|
|
53
|
+
this.__nowWorld = this.__getNowWorld(options) // restore
|
|
49
54
|
|
|
50
|
-
const { shadow, innerShadow } =
|
|
55
|
+
const { shadow, innerShadow } = data
|
|
51
56
|
|
|
52
|
-
if (shadow) Effect.shadow(this, canvas, shape
|
|
57
|
+
if (shadow) Effect.shadow(this, canvas, shape)
|
|
53
58
|
|
|
54
|
-
if (fill)
|
|
59
|
+
if (fill) data.__isFills ? Paint.fills(fill as ILeafPaint[], this, canvas) : Paint.fill(fill as string, this, canvas)
|
|
55
60
|
|
|
56
61
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options)
|
|
57
62
|
|
|
58
|
-
if (innerShadow) Effect.innerShadow(this, canvas, shape
|
|
63
|
+
if (innerShadow) Effect.innerShadow(this, canvas, shape)
|
|
59
64
|
|
|
60
|
-
if (stroke)
|
|
65
|
+
if (stroke) data.__isStrokes ? Paint.strokes(stroke as ILeafStrokePaint[], this, canvas) : Paint.stroke(stroke as string, this, canvas)
|
|
61
66
|
|
|
62
67
|
if (shape.worldCanvas) shape.worldCanvas.recycle()
|
|
63
68
|
shape.canvas.recycle()
|
|
64
69
|
|
|
65
70
|
} else {
|
|
66
71
|
|
|
67
|
-
if (fill)
|
|
72
|
+
if (fill) data.__isFills ? Paint.fills(fill as ILeafPaint[], this, canvas) : Paint.fill(fill as string, this, canvas)
|
|
68
73
|
if (__drawAfterFill) this.__drawAfterFill(canvas, options)
|
|
69
|
-
if (stroke)
|
|
74
|
+
if (stroke) data.__isStrokes ? Paint.strokes(stroke as ILeafStrokePaint[], this, canvas) : Paint.stroke(stroke as string, this, canvas)
|
|
70
75
|
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
|
|
74
78
|
} else {
|
|
75
79
|
|
|
76
80
|
this.__drawFast(canvas, options)
|
|
@@ -79,16 +83,16 @@ export const UIRender: IUIRenderModule = {
|
|
|
79
83
|
},
|
|
80
84
|
|
|
81
85
|
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
canvas.setWorld(this.__world, options.matrix)
|
|
86
|
+
if (this.__worldOpacity) {
|
|
87
|
+
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options))
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
const { fill, stroke } = this.__
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
this.__drawRenderPath(canvas)
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
if (fill) this.__.__pixelFill ? Paint.fills(fill as ILeafPaint[], this, canvas) : Paint.fill('#000000', this, canvas)
|
|
94
|
+
if (stroke) this.__.__pixelStroke ? Paint.strokes(stroke as ILeafStrokePaint[], this, canvas) : Paint.stroke('#000000', this, canvas)
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
}
|