@leafer-ui/paint 1.9.0 → 1.9.1
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/Shape.ts +15 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/paint",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
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.9.
|
|
26
|
-
"@leafer-ui/draw": "1.9.
|
|
25
|
+
"@leafer/core": "1.9.1",
|
|
26
|
+
"@leafer-ui/draw": "1.9.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.9.
|
|
30
|
-
"@leafer-ui/interface": "1.9.
|
|
29
|
+
"@leafer/interface": "1.9.1",
|
|
30
|
+
"@leafer-ui/interface": "1.9.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/Shape.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBoundsData, ILeaferCanvas, IRenderOptions, IMatrix } from '@leafer/interface'
|
|
2
|
-
import { BoundsHelper, Matrix } from '@leafer/core'
|
|
2
|
+
import { BoundsHelper, Matrix, Platform } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IUI, ICachedShape } from '@leafer-ui/interface'
|
|
5
5
|
|
|
@@ -8,15 +8,13 @@ const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper
|
|
|
8
8
|
|
|
9
9
|
export function shape(ui: IUI, current: ILeaferCanvas, options: IRenderOptions): ICachedShape {
|
|
10
10
|
const canvas = current.getSameCanvas()
|
|
11
|
-
const nowWorld = ui.__nowWorld
|
|
11
|
+
const nowWorld = ui.__nowWorld, currentBounds = current.bounds
|
|
12
12
|
|
|
13
13
|
let bounds: IBoundsData, matrix: IMatrix, fitMatrix: IMatrix, shapeBounds: IBoundsData, worldCanvas: ILeaferCanvas
|
|
14
14
|
|
|
15
|
-
let { scaleX, scaleY } =
|
|
16
|
-
if (scaleX < 0) scaleX = -scaleX
|
|
17
|
-
if (scaleY < 0) scaleY = -scaleY
|
|
15
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true)
|
|
18
16
|
|
|
19
|
-
if (
|
|
17
|
+
if (currentBounds.includes(nowWorld)) {
|
|
20
18
|
|
|
21
19
|
worldCanvas = canvas
|
|
22
20
|
bounds = shapeBounds = nowWorld
|
|
@@ -24,8 +22,17 @@ export function shape(ui: IUI, current: ILeaferCanvas, options: IRenderOptions):
|
|
|
24
22
|
} else {
|
|
25
23
|
|
|
26
24
|
const { renderShapeSpread: spread } = ui.__layout
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
let worldClipBounds: IBoundsData // 作为绘制阴影的裁剪形状
|
|
27
|
+
|
|
28
|
+
if (Platform.fullImageShadow) { // fix: iOS Safari 18.5 以上, 只裁剪部分区域渲染阴影会有问题
|
|
29
|
+
worldClipBounds = nowWorld
|
|
30
|
+
} else {
|
|
31
|
+
const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : currentBounds
|
|
32
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorld)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fitMatrix = currentBounds.getFitMatrix(worldClipBounds)
|
|
29
36
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix
|
|
30
37
|
|
|
31
38
|
if (fitMatrix.a < 1) {
|