@leafer/display 1.1.0 → 1.1.2

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",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "@leafer/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,17 +22,17 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.1.0",
26
- "@leafer/data": "1.1.0",
27
- "@leafer/layout": "1.1.0",
28
- "@leafer/display-module": "1.1.0",
29
- "@leafer/event": "1.1.0",
30
- "@leafer/decorator": "1.1.0",
31
- "@leafer/helper": "1.1.0",
32
- "@leafer/debug": "1.1.0",
33
- "@leafer/platform": "1.1.0"
25
+ "@leafer/math": "1.1.2",
26
+ "@leafer/data": "1.1.2",
27
+ "@leafer/layout": "1.1.2",
28
+ "@leafer/display-module": "1.1.2",
29
+ "@leafer/event": "1.1.2",
30
+ "@leafer/decorator": "1.1.2",
31
+ "@leafer/helper": "1.1.2",
32
+ "@leafer/debug": "1.1.2",
33
+ "@leafer/platform": "1.1.2"
34
34
  },
35
35
  "devDependencies": {
36
- "@leafer/interface": "1.1.0"
36
+ "@leafer/interface": "1.1.2"
37
37
  }
38
38
  }
package/src/Branch.ts CHANGED
@@ -5,6 +5,7 @@ import { BranchHelper, LeafBoundsHelper } from '@leafer/helper'
5
5
  import { useModule } from '@leafer/decorator'
6
6
  import { BranchRender } from '@leafer/display-module'
7
7
  import { UICreator } from '@leafer/platform'
8
+ import { Debug } from '@leafer/debug'
8
9
 
9
10
  import { Leaf } from './Leaf'
10
11
 
@@ -12,7 +13,7 @@ import { Leaf } from './Leaf'
12
13
  const { setListWithFn } = BoundsHelper
13
14
  const { sort } = BranchHelper
14
15
  const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper
15
-
16
+ const debug = new Debug('Branch')
16
17
 
17
18
  @useModule(BranchRender)
18
19
  export class Branch extends Leaf { // tip: rewrited Group
@@ -64,7 +65,8 @@ export class Branch extends Leaf { // tip: rewrited Group
64
65
  }
65
66
 
66
67
  public add(child: ILeaf, index?: number): void {
67
- if (child === this) return
68
+ if (child === this || child.destroyed) return debug.warn('add self or destroyed')
69
+
68
70
  const noIndex = index === undefined
69
71
  if (!child.__) {
70
72
  if (child instanceof Array) return child.forEach(item => { this.add(item, index); noIndex || index++ }) // add []
@@ -77,8 +79,9 @@ export class Branch extends Leaf { // tip: rewrited Group
77
79
  noIndex ? this.children.push(child) : this.children.splice(index, 0, child)
78
80
  if (child.isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1
79
81
 
80
- child.__layout.boxChanged || child.__layout.boxChange() // layouted(removed), need update
81
- child.__layout.matrixChanged || child.__layout.matrixChange() // layouted(removed), need update
82
+ const childLayout = child.__layout
83
+ childLayout.boxChanged || childLayout.boxChange() // layouted(removed), need update
84
+ childLayout.matrixChanged || childLayout.matrixChange() // layouted(removed), need update
82
85
 
83
86
  if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD)
84
87
 
package/src/Leaf.ts CHANGED
@@ -314,8 +314,8 @@ export class Leaf implements ILeaf {
314
314
  canvas.restore()
315
315
  }
316
316
 
317
- public __updateMask(value?: boolean): void {
318
- this.__hasMask = value ? true : this.children.some(item => item.__.mask)
317
+ public __updateMask(_value?: boolean): void {
318
+ this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity)
319
319
  }
320
320
 
321
321
  // LeafMask rewrite
package/types/index.d.ts CHANGED
@@ -103,7 +103,7 @@ declare class Leaf implements ILeaf {
103
103
  __onUpdateSize(): void;
104
104
  __updateEraser(value?: boolean): void;
105
105
  __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
106
- __updateMask(value?: boolean): void;
106
+ __updateMask(_value?: boolean): void;
107
107
  __renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
108
108
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
109
109
  getTransform(relative?: ILocationType | ILeaf): IMatrixData;