@leafer-ui/render 1.5.2 → 1.6.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/render",
3
- "version": "1.5.2",
3
+ "version": "1.6.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.5.2"
25
+ "@leafer-ui/external": "1.6.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.5.2",
29
- "@leafer-ui/interface": "1.5.2"
28
+ "@leafer/interface": "1.6.0",
29
+ "@leafer-ui/interface": "1.6.0"
30
30
  }
31
31
  }
package/src/RectRender.ts CHANGED
@@ -7,11 +7,12 @@ export const RectRender: IRectRenderModule = {
7
7
 
8
8
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void {
9
9
 
10
- let { width, height, fill, stroke, __drawAfterFill } = this.__
10
+ let { x, y, width, height } = this.__layout.boxBounds
11
+ const { fill, stroke, __drawAfterFill } = this.__
11
12
 
12
13
  if (fill) {
13
14
  canvas.fillStyle = fill
14
- canvas.fillRect(0, 0, width, height)
15
+ canvas.fillRect(x, y, width, height)
15
16
  }
16
17
 
17
18
  if (__drawAfterFill) this.__drawAfterFill(canvas, options)
@@ -33,12 +34,12 @@ export const RectRender: IRectRenderModule = {
33
34
  if (width < 0 || height < 0) {
34
35
  canvas.save()
35
36
  this.__clip(canvas, options)
36
- canvas.strokeRect(half, half, width, height)
37
+ canvas.strokeRect(x + half, y + half, width, height)
37
38
  canvas.restore()
38
- } else canvas.strokeRect(half, half, width, height)
39
+ } else canvas.strokeRect(x + half, y + half, width, height)
39
40
  break
40
41
  case 'outside':
41
- canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth)
42
+ canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth)
42
43
  break
43
44
  }
44
45
 
package/src/UIRender.ts CHANGED
@@ -7,22 +7,22 @@ import { Paint, Effect, Filter } from '@leafer-ui/external'
7
7
  export const UIRender: IUIRenderModule = {
8
8
 
9
9
  __updateChange(): void {
10
- const data = this.__
10
+ const data = this.__, w = this.__world
11
11
 
12
12
  if (data.__useEffect) {
13
13
  const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__
14
14
  data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter)
15
15
  }
16
16
 
17
+ const half = data.__hasHalf
18
+ w.half !== half && (w.half = half)
19
+
17
20
  data.__checkSingle()
18
21
 
19
22
  const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect
20
23
 
21
- if (complex) {
22
- data.__complex = true
23
- } else {
24
- data.__complex && (data.__complex = false)
25
- }
24
+ if (complex) data.__complex = true
25
+ else data.__complex && (data.__complex = false)
26
26
  },
27
27
 
28
28
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void {