@leafer-ui/paint 1.6.3 → 1.6.4
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/Compute.ts +3 -4
- package/src/Stroke.ts +6 -9
- package/src/StrokeText.ts +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/paint",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
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.6.
|
|
26
|
-
"@leafer-ui/draw": "1.6.
|
|
25
|
+
"@leafer/core": "1.6.4",
|
|
26
|
+
"@leafer-ui/draw": "1.6.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.6.
|
|
30
|
-
"@leafer-ui/interface": "1.6.
|
|
29
|
+
"@leafer/interface": "1.6.4",
|
|
30
|
+
"@leafer-ui/interface": "1.6.4"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/Compute.ts
CHANGED
|
@@ -16,8 +16,7 @@ export function compute(attrName: IPaintAttr, ui: IUI): void {
|
|
|
16
16
|
recycleMap = PaintImage.recycleImage(attrName, data)
|
|
17
17
|
|
|
18
18
|
for (let i = 0, len = paints.length, item: ILeafPaint; i < len; i++) {
|
|
19
|
-
item = getLeafPaint(attrName, paints[i], ui)
|
|
20
|
-
if (item) leafPaints.push(item)
|
|
19
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item)
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
(data as IObject)['_' + attrName] = leafPaints.length ? leafPaints : undefined
|
|
@@ -59,8 +58,8 @@ function getLeafPaint(attrName: string, paint: IPaint, ui: IUI): ILeafPaint {
|
|
|
59
58
|
data = PaintGradient.conicGradient(paint, boxBounds)
|
|
60
59
|
break
|
|
61
60
|
case 'solid':
|
|
62
|
-
const { type,
|
|
63
|
-
data = { type,
|
|
61
|
+
const { type, color, opacity } = paint
|
|
62
|
+
data = { type, style: ColorConvert.string(color, opacity) }
|
|
64
63
|
break
|
|
65
64
|
default:
|
|
66
65
|
if ((paint as IRGB).r !== undefined) data = { type: 'solid', style: ColorConvert.string(paint) }
|
package/src/Stroke.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ILeaferCanvas } from '@leafer/interface'
|
|
2
|
-
import { Platform } from '@leafer-ui/core'
|
|
3
2
|
|
|
4
3
|
import { IUI, ILeafPaint } from '@leafer-ui/interface'
|
|
5
|
-
import { Paint } from '@leafer-ui/
|
|
4
|
+
import { Paint } from '@leafer-ui/draw'
|
|
6
5
|
|
|
7
|
-
import { strokeText, drawStrokesStyle } from './StrokeText'
|
|
6
|
+
import { strokeText, drawStrokesStyle, copyWorld } from './StrokeText'
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
export function stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas): void {
|
|
@@ -48,9 +47,8 @@ function drawCenter(stroke: string | ILeafPaint[], strokeWidthScale: number, ui:
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
function drawInside(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas) {
|
|
51
|
-
const data = ui.__
|
|
52
50
|
canvas.save()
|
|
53
|
-
|
|
51
|
+
canvas.clipUI(ui)
|
|
54
52
|
|
|
55
53
|
drawCenter(stroke, 2, ui, canvas)
|
|
56
54
|
canvas.restore()
|
|
@@ -69,12 +67,11 @@ function drawOutside(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanv
|
|
|
69
67
|
|
|
70
68
|
drawCenter(stroke, 2, ui, out)
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
out.clipUI(data)
|
|
73
71
|
out.clearWorld(renderBounds)
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
else canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds)
|
|
73
|
+
copyWorld(canvas, out, ui)
|
|
77
74
|
|
|
78
75
|
out.recycle(ui.__nowWorld)
|
|
79
76
|
}
|
|
80
|
-
}
|
|
77
|
+
}
|
package/src/StrokeText.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferCanvas } from '@leafer/interface'
|
|
2
|
-
import { Platform } from
|
|
2
|
+
import { Platform } from "@leafer/core"
|
|
3
3
|
|
|
4
4
|
import { IUI, ITextRowData, ILeafPaint, IStrokeAlign, ILeafStrokePaint } from '@leafer-ui/interface'
|
|
5
5
|
import { PaintImage } from "@leafer-ui/draw"
|
|
@@ -36,13 +36,18 @@ function drawAlign(stroke: string | ILeafPaint[], align: IStrokeAlign, ui: IUI,
|
|
|
36
36
|
fillText(ui, out)
|
|
37
37
|
out.blendMode = 'normal'
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
else canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
|
|
39
|
+
copyWorld(canvas, out, ui)
|
|
41
40
|
|
|
42
41
|
out.recycle(ui.__nowWorld)
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
|
|
45
|
+
export function copyWorld(canvas: ILeaferCanvas, out: ILeaferCanvas, ui: IUI): void {
|
|
46
|
+
if (ui.__worldFlipped || Platform.fullImageShadow) canvas.copyWorldByReset(out, ui.__nowWorld)
|
|
47
|
+
else canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
46
51
|
export function drawTextStroke(ui: IUI, canvas: ILeaferCanvas): void {
|
|
47
52
|
|
|
48
53
|
let row: ITextRowData, data = ui.__.__textDrawData
|