@leafer-ui/render 1.6.6 → 1.7.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/UIRender.ts +13 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/render",
3
- "version": "1.6.6",
3
+ "version": "1.7.0",
4
4
  "description": "@leafer-ui/render",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,10 +22,10 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer-ui/external": "1.6.6"
25
+ "@leafer-ui/external": "1.7.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.6.6",
29
- "@leafer-ui/interface": "1.6.6"
28
+ "@leafer/interface": "1.7.0",
29
+ "@leafer-ui/interface": "1.7.0"
30
30
  }
31
31
  }
package/src/UIRender.ts CHANGED
@@ -11,19 +11,21 @@ export const UIRender: IUIRenderModule = {
11
11
  __updateChange(): void {
12
12
  const data = this.__
13
13
 
14
+ if (data.__useStroke) {
15
+ const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth)
16
+ stintSet(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2) // 是否存在半逻辑像素渲染(奇数线宽的居中线条),可以半像素为起点绘制,防止模糊
17
+ stintSet(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill)
18
+ }
19
+
14
20
  if (data.__useEffect) {
15
21
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter
16
22
  stintSet(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')))
17
23
  data.__useEffect = !!(shadow || otherEffect)
18
24
  }
19
25
 
20
- stintSet(this.__world, 'half', data.__hasHalf)
21
-
22
- stintSet(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill)
23
-
24
26
  data.__checkSingle()
25
27
 
26
- stintSet(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect)
28
+ stintSet(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect) as boolean)
27
29
  },
28
30
 
29
31
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void {
@@ -92,18 +94,14 @@ export const UIRender: IUIRenderModule = {
92
94
  }
93
95
  },
94
96
 
95
- __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void {
96
- if (this.__worldOpacity) {
97
- canvas.setWorld(this.__nowWorld = this.__getNowWorld(options))
97
+ __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void {
98
+ this.__drawRenderPath(canvas)
98
99
 
99
- const { fill, stroke } = this.__
100
+ const data = this.__, { fill, stroke } = data
100
101
 
101
- this.__drawRenderPath(canvas)
102
-
103
- if (fill && !ignoreFill) this.__.__isAlphaPixelFill ? Paint.fills(fill as ILeafPaint[], this, canvas) : Paint.fill('#000000', this, canvas)
104
- if (this.__.__isCanvas) this.__drawAfterFill(canvas, options)
105
- if (stroke && !ignoreStroke) this.__.__isAlphaPixelStroke ? Paint.strokes(stroke as ILeafStrokePaint[], this, canvas) : Paint.stroke('#000000', this, canvas)
106
- }
102
+ if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill as ILeafPaint[], this, canvas) : Paint.fill('#000000', this, canvas)
103
+ if (data.__isCanvas) this.__drawAfterFill(canvas, options)
104
+ if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke as ILeafStrokePaint[], this, canvas) : Paint.stroke('#000000', this, canvas)
107
105
  },
108
106
 
109
107
  __drawAfterFill(canvas: ILeaferCanvas, options: IRenderOptions): void {