@leafer/display-module 1.5.3 → 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/display-module",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/helper": "1.5.3",
26
- "@leafer/event": "1.5.3",
27
- "@leafer/math": "1.5.3",
28
- "@leafer/debug": "1.5.3"
25
+ "@leafer/helper": "1.6.0",
26
+ "@leafer/event": "1.6.0",
27
+ "@leafer/math": "1.6.0",
28
+ "@leafer/debug": "1.6.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@leafer/interface": "1.5.3"
31
+ "@leafer/interface": "1.6.0"
32
32
  }
33
33
  }
@@ -23,9 +23,14 @@ export const BranchRender: IBranchRenderModule = {
23
23
 
24
24
  if (this.__worldOpacity) {
25
25
 
26
- if (this.__.__single) {
26
+ const data = this.__
27
27
 
28
- if (this.__.eraser === 'path') return this.__renderEraser(canvas, options)
28
+ if (data.dim) options.dimOpacity = data.dim === true ? 0.2 : data.dim
29
+ else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0)
30
+
31
+ if (data.__single) {
32
+
33
+ if (data.eraser === 'path') return this.__renderEraser(canvas, options)
29
34
 
30
35
  const tempCanvas = canvas.getSameCanvas(false, true)
31
36
 
@@ -33,8 +38,8 @@ export const BranchRender: IBranchRenderModule = {
33
38
 
34
39
  const nowWorld = this.__nowWorld
35
40
 
36
- canvas.opacity = this.__.opacity
37
- canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, this.__.__blendMode, true)
41
+ canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity
42
+ canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true)
38
43
 
39
44
  tempCanvas.recycle(nowWorld)
40
45
 
package/src/LeafRender.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ILeaferCanvas, IRenderOptions, ILeafRenderModule } from '@leafer/interface'
2
+ import { Debug } from '@leafer/debug'
2
3
 
3
4
 
4
5
  export const LeafRender: ILeafRenderModule = {
@@ -6,20 +7,22 @@ export const LeafRender: ILeafRenderModule = {
6
7
  __render(canvas: ILeaferCanvas, options: IRenderOptions): void {
7
8
  if (this.__worldOpacity) {
8
9
 
10
+ const data = this.__
11
+
9
12
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options))
10
- canvas.opacity = this.__.opacity
13
+ canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity
11
14
 
12
15
  if (this.__.__single) {
13
16
 
14
- if (this.__.eraser === 'path') return this.__renderEraser(canvas, options)
17
+ if (data.eraser === 'path') return this.__renderEraser(canvas, options)
15
18
 
16
19
  const tempCanvas = canvas.getSameCanvas(true, true)
17
20
  this.__draw(tempCanvas, options, canvas)
18
21
 
19
22
  if (this.__worldFlipped) {
20
- canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, this.__.__blendMode, true)
23
+ canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true)
21
24
  } else {
22
- canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, this.__.__blendMode)
25
+ canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode)
23
26
  }
24
27
 
25
28
  tempCanvas.recycle(this.__nowWorld)
@@ -30,6 +33,8 @@ export const LeafRender: ILeafRenderModule = {
30
33
 
31
34
  }
32
35
 
36
+ if (Debug.showBounds) Debug.drawBounds(this, canvas, options)
37
+
33
38
  }
34
39
  },
35
40