@leafer-ui/effect 1.8.0 → 1.9.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/effect",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "@leafer-ui/effect",
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.8.0",
26
- "@leafer-ui/draw": "1.8.0"
25
+ "@leafer/core": "1.9.0",
26
+ "@leafer-ui/draw": "1.9.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.8.0",
30
- "@leafer-ui/interface": "1.8.0"
29
+ "@leafer/interface": "1.9.0",
30
+ "@leafer-ui/interface": "1.9.0"
31
31
  }
32
32
  }
@@ -25,11 +25,18 @@ export function innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape
25
25
 
26
26
  innerShadow.forEach((item, index) => {
27
27
 
28
+ let otherScale = 1 // 关联 scaleFixed 逻辑
29
+
30
+ if (item.scaleFixed) {
31
+ const sx = Math.abs(nowWorld.scaleX)
32
+ if (sx > 1) otherScale = 1 / sx
33
+ }
34
+
28
35
  other.save()
29
36
 
30
- other.setWorldShadow((offsetOutBounds.offsetX + item.x * scaleX), (offsetOutBounds.offsetY + item.y * scaleY), item.blur * scaleX)
37
+ other.setWorldShadow((offsetOutBounds.offsetX + item.x * scaleX * otherScale), (offsetOutBounds.offsetY + item.y * scaleY * otherScale), item.blur * scaleX * otherScale)
31
38
 
32
- spreadScale = item.spread ? 1 - item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0
39
+ spreadScale = item.spread ? 1 - item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0
33
40
 
34
41
  drawWorldShadow(other, offsetOutBounds, spreadScale, shape)
35
42
 
package/src/Shadow.ts CHANGED
@@ -24,9 +24,16 @@ export function shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): vo
24
24
 
25
25
  shadow.forEach((item, index) => {
26
26
 
27
- other.setWorldShadow((offsetOutBounds.offsetX + item.x * scaleX), (offsetOutBounds.offsetY + item.y * scaleY), item.blur * scaleX, ColorConvert.string(item.color))
27
+ let otherScale = 1 // 关联 scaleFixed 逻辑
28
28
 
29
- spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) : 0
29
+ if (item.scaleFixed) {
30
+ const sx = Math.abs(nowWorld.scaleX)
31
+ if (sx > 1) otherScale = 1 / sx
32
+ }
33
+
34
+ other.setWorldShadow((offsetOutBounds.offsetX + item.x * scaleX * otherScale), (offsetOutBounds.offsetY + item.y * scaleY * otherScale), item.blur * scaleX * otherScale, ColorConvert.string(item.color))
35
+
36
+ spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0
30
37
 
31
38
  drawWorldShadow(other, offsetOutBounds, spreadScale, shape)
32
39
 
@@ -55,7 +62,7 @@ export function shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): vo
55
62
  }
56
63
 
57
64
 
58
- export function drawWorldShadow(canvas: ILeaferCanvas, outBounds: IBoundsData, spreadScale: number, shape: ICachedShape,): void {
65
+ export function drawWorldShadow(canvas: ILeaferCanvas, outBounds: IBoundsData, spreadScale: number, shape: ICachedShape): void {
59
66
 
60
67
  const { bounds, shapeBounds } = shape
61
68
 
@@ -66,9 +73,9 @@ export function drawWorldShadow(canvas: ILeaferCanvas, outBounds: IBoundsData, s
66
73
  tempBounds.y += (outBounds.y - shapeBounds.y)
67
74
 
68
75
  if (spreadScale) {
69
- const { matrix } = shape
70
- tempBounds.x -= (bounds.x + (matrix ? matrix.e : 0) + bounds.width / 2) * (spreadScale - 1)
71
- tempBounds.y -= (bounds.y + (matrix ? matrix.f : 0) + bounds.height / 2) * (spreadScale - 1)
76
+ const { fitMatrix } = shape
77
+ tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1)
78
+ tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1)
72
79
  tempBounds.width *= spreadScale
73
80
  tempBounds.height *= spreadScale
74
81
  }