@leafer-ui/render 1.0.0-alpha.1 → 1.0.0-alpha.21
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 +8 -7
- package/src/ImageRender.ts +12 -0
- package/src/RectRender.ts +1 -1
- package/src/TextRender.ts +1 -1
- package/src/UIRender.ts +16 -8
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/render",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.21",
|
|
4
4
|
"description": "@leafer-ui/render",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/leaferjs/ui.git"
|
|
@@ -13,15 +15,14 @@
|
|
|
13
15
|
"homepage": "https://github.com/leaferjs/ui/tree/main/packages/render",
|
|
14
16
|
"bugs": "https://github.com/leaferjs/ui/issues",
|
|
15
17
|
"keywords": [
|
|
16
|
-
"leaferui",
|
|
17
18
|
"leafer-ui",
|
|
18
19
|
"leaferjs"
|
|
19
20
|
],
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@leafer-ui/external": "1.0.0-alpha.
|
|
22
|
+
"@leafer-ui/external": "1.0.0-alpha.21"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
"@leafer/interface": "1.0.0-alpha.21",
|
|
26
|
+
"@leafer-ui/interface": "1.0.0-alpha.21"
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILeaferCanvas, IRenderOptions } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
import { IImageRenderModule } from '@leafer-ui/interface'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const ImageRender: IImageRenderModule = {
|
|
7
|
+
|
|
8
|
+
__draw(_canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
package/src/RectRender.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IRectRenderModule } from '@leafer-ui/interface'
|
|
|
5
5
|
|
|
6
6
|
export const RectRender: IRectRenderModule = {
|
|
7
7
|
|
|
8
|
-
__drawFast(canvas: ILeaferCanvas,
|
|
8
|
+
__drawFast(canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
9
9
|
|
|
10
10
|
const { width, height, fill, stroke } = this.__
|
|
11
11
|
|
package/src/TextRender.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IUIRenderModule } from '@leafer-ui/interface'
|
|
|
5
5
|
|
|
6
6
|
export const TextRender: IUIRenderModule = {
|
|
7
7
|
|
|
8
|
-
__drawFast(canvas: ILeaferCanvas,
|
|
8
|
+
__drawFast(canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
9
9
|
|
|
10
10
|
const { fill, stroke, content, __font } = this.__
|
|
11
11
|
|
package/src/UIRender.ts
CHANGED
|
@@ -8,16 +8,16 @@ export const UIRender: IUIRenderModule = {
|
|
|
8
8
|
|
|
9
9
|
__updateChange(): void {
|
|
10
10
|
let data = this.__
|
|
11
|
-
let complex = data.__isFills || data.__isStrokes || data.
|
|
11
|
+
let complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect
|
|
12
12
|
|
|
13
13
|
if (complex) {
|
|
14
|
-
|
|
14
|
+
data.__complex = true
|
|
15
15
|
} else {
|
|
16
|
-
|
|
16
|
+
data.__complex && (data.__complex = false)
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
-
__drawFast(canvas: ILeaferCanvas,
|
|
20
|
+
__drawFast(canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
21
21
|
const { fill, stroke } = this.__
|
|
22
22
|
|
|
23
23
|
this.__drawRenderPath(canvas)
|
|
@@ -27,12 +27,20 @@ export const UIRender: IUIRenderModule = {
|
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void {
|
|
30
|
-
|
|
30
|
+
if (this.__.__complex) {
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const { fill, stroke } = this.__
|
|
33
|
+
|
|
34
|
+
this.__drawRenderPath(canvas)
|
|
35
|
+
|
|
36
|
+
if (fill) this.__.__isFills ? Paint.fills(this, canvas, fill as ILeafPaint[]) : Paint.fill(this, canvas, fill)
|
|
37
|
+
if (stroke) this.__.__isStrokes ? Paint.strokes(this, canvas, stroke as ILeafStrokePaint[]) : Paint.stroke(this, canvas, stroke)
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
} else {
|
|
40
|
+
|
|
41
|
+
this.__drawFast(canvas, options)
|
|
42
|
+
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
}
|