@leafer/display 2.0.1 → 2.0.3
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 +12 -12
- package/src/Branch.ts +5 -2
- package/src/Leaf.ts +7 -10
- package/types/index.d.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "2.0.
|
|
26
|
-
"@leafer/data": "2.0.
|
|
27
|
-
"@leafer/layout": "2.0.
|
|
28
|
-
"@leafer/display-module": "2.0.
|
|
29
|
-
"@leafer/event": "2.0.
|
|
30
|
-
"@leafer/decorator": "2.0.
|
|
31
|
-
"@leafer/helper": "2.0.
|
|
32
|
-
"@leafer/image": "2.0.
|
|
33
|
-
"@leafer/debug": "2.0.
|
|
34
|
-
"@leafer/platform": "2.0.
|
|
25
|
+
"@leafer/math": "2.0.3",
|
|
26
|
+
"@leafer/data": "2.0.3",
|
|
27
|
+
"@leafer/layout": "2.0.3",
|
|
28
|
+
"@leafer/display-module": "2.0.3",
|
|
29
|
+
"@leafer/event": "2.0.3",
|
|
30
|
+
"@leafer/decorator": "2.0.3",
|
|
31
|
+
"@leafer/helper": "2.0.3",
|
|
32
|
+
"@leafer/image": "2.0.3",
|
|
33
|
+
"@leafer/debug": "2.0.3",
|
|
34
|
+
"@leafer/platform": "2.0.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@leafer/interface": "2.0.
|
|
37
|
+
"@leafer/interface": "2.0.3"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/Branch.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBoundsData, IFourNumber, ILeaf } from '@leafer/interface'
|
|
1
|
+
import { IBoundsData, IFourNumber, ILeaf, ILeafLayout } from '@leafer/interface'
|
|
2
2
|
import { ChildEvent } from '@leafer/event'
|
|
3
3
|
import { BoundsHelper } from '@leafer/math'
|
|
4
4
|
import { BranchHelper, LeafBoundsHelper } from '@leafer/helper'
|
|
@@ -30,9 +30,11 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
public __updateRenderSpread(): IFourNumber {
|
|
33
|
+
let layout: ILeafLayout
|
|
33
34
|
const { children } = this
|
|
34
35
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
35
|
-
|
|
36
|
+
layout = children[i].__layout
|
|
37
|
+
if (layout.renderSpread || layout.localOuterBounds) return 1
|
|
36
38
|
}
|
|
37
39
|
return 0
|
|
38
40
|
}
|
|
@@ -72,6 +74,7 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
72
74
|
if (!child.__) {
|
|
73
75
|
if (isArray(child)) return child.forEach(item => { this.add(item, index); noIndex || index++ }) // add []
|
|
74
76
|
else child = UICreator.get(child.tag, child) // add JSON
|
|
77
|
+
if (!child) return
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
if (child.parent) child.parent.remove(child)
|
package/src/Leaf.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferBase, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IBoundsType, ILocationType, IMatrixWithBoundsData, ILayoutBoundsData, IValue, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod, IMatrixData, IAttrDecorator, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAlign, IJSONOptions, IEventParamsMap, IEventOption, IAxis, IMotionPathData, IUnitData, IRotationPointData, ITransition, IValueFunction, IEventParams, IScaleData, IScaleFixed, IFourNumber } from '@leafer/interface'
|
|
2
|
-
import { BoundsHelper, IncrementId, MatrixHelper, PointHelper } from '@leafer/math'
|
|
2
|
+
import { BoundsHelper, IncrementId, MathHelper, MatrixHelper, PointHelper } from '@leafer/math'
|
|
3
3
|
import { LeafData, isUndefined, DataHelper } from '@leafer/data'
|
|
4
4
|
import { LeafLayout } from '@leafer/layout'
|
|
5
5
|
import { LeafDataProxy, LeafMatrix, LeafBounds, LeafEventer, LeafRender } from '@leafer/display-module'
|
|
@@ -10,12 +10,12 @@ import { ImageManager } from '@leafer/image'
|
|
|
10
10
|
import { Plugin } from '@leafer/debug'
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
const tempScaleData = {} as IScaleData
|
|
14
13
|
const { LEAF, create } = IncrementId
|
|
15
14
|
const { stintSet } = DataHelper
|
|
16
15
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper
|
|
17
16
|
const { toOuterOf } = BoundsHelper
|
|
18
17
|
const { copy, move } = PointHelper
|
|
18
|
+
const { getScaleFixedData } = MathHelper
|
|
19
19
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper
|
|
20
20
|
|
|
21
21
|
@useModule(LeafDataProxy)
|
|
@@ -46,6 +46,7 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
46
46
|
public get isBranch(): boolean { return false }
|
|
47
47
|
public get isBranchLeaf(): boolean { return false }
|
|
48
48
|
|
|
49
|
+
public skipJSON?: boolean // 跳过 JSON 导出
|
|
49
50
|
public syncEventer?: ILeaf // 同步触发一样事件的元素
|
|
50
51
|
public lockNormalStyle?: boolean
|
|
51
52
|
|
|
@@ -175,6 +176,7 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
175
176
|
this.__level = this.parent ? this.parent.__level + 1 : 1
|
|
176
177
|
if ((this as ILeaf).animation) this.__runAnimation('in')
|
|
177
178
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED)
|
|
179
|
+
if (leafer.cacheId) LeafHelper.cacheId(this)
|
|
178
180
|
} else {
|
|
179
181
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED)
|
|
180
182
|
}
|
|
@@ -362,13 +364,8 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
362
364
|
return scaleX > 1 ? scaleX : 1
|
|
363
365
|
}
|
|
364
366
|
|
|
365
|
-
public getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData {
|
|
366
|
-
|
|
367
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY)
|
|
368
|
-
if (scaleFixed === true || (scaleFixed === 'zoom-in' && scaleX > 1 && scaleY > 1)) scaleX = scaleY = 1
|
|
369
|
-
tempScaleData.scaleX = scaleX
|
|
370
|
-
tempScaleData.scaleY = scaleY
|
|
371
|
-
return tempScaleData
|
|
367
|
+
public getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale = true): IScaleData {
|
|
368
|
+
return getScaleFixedData(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs)
|
|
372
369
|
}
|
|
373
370
|
|
|
374
371
|
public getTransform(relative?: ILocationType | ILeaf): IMatrixData {
|
|
@@ -615,7 +612,7 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
615
612
|
|
|
616
613
|
public __updatePath(): void { }
|
|
617
614
|
|
|
618
|
-
public __updateRenderPath(): void { }
|
|
615
|
+
public __updateRenderPath(_updateCache?: boolean): void { }
|
|
619
616
|
|
|
620
617
|
// ---
|
|
621
618
|
|
package/types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
17
17
|
get isLeafer(): boolean;
|
|
18
18
|
get isBranch(): boolean;
|
|
19
19
|
get isBranchLeaf(): boolean;
|
|
20
|
+
skipJSON?: boolean;
|
|
20
21
|
syncEventer?: ILeaf;
|
|
21
22
|
lockNormalStyle?: boolean;
|
|
22
23
|
__: ILeafData;
|
|
@@ -112,7 +113,7 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
112
113
|
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
113
114
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
114
115
|
getClampRenderScale(): number;
|
|
115
|
-
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData;
|
|
116
|
+
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale?: boolean): IScaleData;
|
|
116
117
|
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
117
118
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
118
119
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
@@ -170,7 +171,7 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
170
171
|
__drawPath(_canvas: ILeaferCanvas): void;
|
|
171
172
|
__drawRenderPath(_canvas: ILeaferCanvas): void;
|
|
172
173
|
__updatePath(): void;
|
|
173
|
-
__updateRenderPath(): void;
|
|
174
|
+
__updateRenderPath(_updateCache?: boolean): void;
|
|
174
175
|
getMotionPathData(): IMotionPathData;
|
|
175
176
|
getMotionPoint(_motionDistance: number | IUnitData): IRotationPointData;
|
|
176
177
|
getMotionTotal(): number;
|