@leafer/display 1.0.10 → 1.1.1

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.0.10",
3
+ "version": "1.1.1",
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.0.10",
26
- "@leafer/data": "1.0.10",
27
- "@leafer/layout": "1.0.10",
28
- "@leafer/display-module": "1.0.10",
29
- "@leafer/event": "1.0.10",
30
- "@leafer/decorator": "1.0.10",
31
- "@leafer/helper": "1.0.10",
32
- "@leafer/debug": "1.0.10",
33
- "@leafer/platform": "1.0.10"
25
+ "@leafer/math": "1.1.1",
26
+ "@leafer/data": "1.1.1",
27
+ "@leafer/layout": "1.1.1",
28
+ "@leafer/display-module": "1.1.1",
29
+ "@leafer/event": "1.1.1",
30
+ "@leafer/decorator": "1.1.1",
31
+ "@leafer/helper": "1.1.1",
32
+ "@leafer/debug": "1.1.1",
33
+ "@leafer/platform": "1.1.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@leafer/interface": "1.0.10"
36
+ "@leafer/interface": "1.1.1"
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
@@ -470,13 +470,13 @@ export class Leaf implements ILeaf {
470
470
  transform(this, matrix, resize)
471
471
  }
472
472
 
473
- public move(x: number | IPointData, y?: number): void {
474
- moveLocal(this, x, y)
473
+ public move(x: number | IPointData, y?: number, transition?: any): void {
474
+ moveLocal(this, x, y, transition)
475
475
  }
476
476
 
477
477
 
478
- public moveInner(x: number | IPointData, y?: number): void {
479
- moveWorld(this, x, y, true)
478
+ public moveInner(x: number | IPointData, y?: number, transition?: any): void {
479
+ moveWorld(this, x, y, true, transition)
480
480
  }
481
481
 
482
482
  public scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void {
@@ -496,8 +496,8 @@ export class Leaf implements ILeaf {
496
496
  transformWorld(this, worldTransform, resize)
497
497
  }
498
498
 
499
- public moveWorld(x: number | IPointData, y?: number): void {
500
- moveWorld(this, x, y)
499
+ public moveWorld(x: number | IPointData, y?: number, transition?: any): void {
500
+ moveWorld(this, x, y, false, transition)
501
501
  }
502
502
 
503
503
  public scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void {
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;
@@ -129,13 +129,13 @@ declare class Leaf implements ILeaf {
129
129
  getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
130
130
  setTransform(matrix: IMatrixData, resize?: boolean): void;
131
131
  transform(matrix: IMatrixData, resize?: boolean): void;
132
- move(x: number | IPointData, y?: number): void;
133
- moveInner(x: number | IPointData, y?: number): void;
132
+ move(x: number | IPointData, y?: number, transition?: any): void;
133
+ moveInner(x: number | IPointData, y?: number, transition?: any): void;
134
134
  scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
135
135
  rotateOf(origin: IPointData | IAlign, rotation: number): void;
136
136
  skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
137
137
  transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
138
- moveWorld(x: number | IPointData, y?: number): void;
138
+ moveWorld(x: number | IPointData, y?: number, transition?: any): void;
139
139
  scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
140
140
  rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
141
141
  skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;