@leafer/display 2.0.2 → 2.0.4
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 +4 -2
- package/src/Leaf.ts +11 -15
- package/types/index.d.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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.4",
|
|
26
|
+
"@leafer/data": "2.0.4",
|
|
27
|
+
"@leafer/layout": "2.0.4",
|
|
28
|
+
"@leafer/display-module": "2.0.4",
|
|
29
|
+
"@leafer/event": "2.0.4",
|
|
30
|
+
"@leafer/decorator": "2.0.4",
|
|
31
|
+
"@leafer/helper": "2.0.4",
|
|
32
|
+
"@leafer/image": "2.0.4",
|
|
33
|
+
"@leafer/debug": "2.0.4",
|
|
34
|
+
"@leafer/platform": "2.0.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@leafer/interface": "2.0.
|
|
37
|
+
"@leafer/interface": "2.0.4"
|
|
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
|
}
|
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)
|
|
@@ -176,6 +176,7 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
176
176
|
this.__level = this.parent ? this.parent.__level + 1 : 1
|
|
177
177
|
if ((this as ILeaf).animation) this.__runAnimation('in')
|
|
178
178
|
if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED)
|
|
179
|
+
if (leafer.cacheId) LeafHelper.cacheId(this)
|
|
179
180
|
} else {
|
|
180
181
|
this.__emitLifeEvent(ChildEvent.UNMOUNTED)
|
|
181
182
|
}
|
|
@@ -363,13 +364,8 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
363
364
|
return scaleX > 1 ? scaleX : 1
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
public getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData {
|
|
367
|
-
|
|
368
|
-
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY)
|
|
369
|
-
if (scaleFixed === true || (scaleFixed === 'zoom-in' && scaleX > 1 && scaleY > 1)) scaleX = scaleY = 1
|
|
370
|
-
tempScaleData.scaleX = scaleX
|
|
371
|
-
tempScaleData.scaleY = scaleY
|
|
372
|
-
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)
|
|
373
369
|
}
|
|
374
370
|
|
|
375
371
|
public getTransform(relative?: ILocationType | ILeaf): IMatrixData {
|
|
@@ -419,18 +415,20 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
419
415
|
relative.innerToWorld(world, to, distance)
|
|
420
416
|
world = to ? to : world
|
|
421
417
|
}
|
|
422
|
-
toInnerPoint(this.
|
|
418
|
+
toInnerPoint(this.worldTransform, world, to, distance)
|
|
423
419
|
}
|
|
424
420
|
|
|
425
421
|
public innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void {
|
|
426
|
-
toOuterPoint(this.
|
|
422
|
+
toOuterPoint(this.worldTransform, inner, to, distance)
|
|
427
423
|
if (relative) relative.worldToInner(to ? to : inner, null, distance)
|
|
428
424
|
}
|
|
429
425
|
|
|
430
426
|
// simple
|
|
431
427
|
|
|
432
428
|
public getBoxPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData {
|
|
433
|
-
|
|
429
|
+
const inner = this.getInnerPoint(world, relative, distance, change)
|
|
430
|
+
if (distance) return inner
|
|
431
|
+
return this.getBoxPointByInner(inner, null, null, true)
|
|
434
432
|
}
|
|
435
433
|
|
|
436
434
|
public getBoxPointByInner(inner: IPointData, _relative?: ILeaf, _distance?: boolean, change?: boolean): IPointData {
|
|
@@ -589,8 +587,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
589
587
|
|
|
590
588
|
public __render(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
591
589
|
|
|
592
|
-
public __renderComplex(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
593
|
-
|
|
594
590
|
public __drawFast(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
595
591
|
|
|
596
592
|
public __draw(_canvas: ILeaferCanvas, _options: IRenderOptions, _originCanvas?: ILeaferCanvas): void { }
|
|
@@ -618,7 +614,7 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
618
614
|
|
|
619
615
|
public __updatePath(): void { }
|
|
620
616
|
|
|
621
|
-
public __updateRenderPath(): void { }
|
|
617
|
+
public __updateRenderPath(_updateCache?: boolean): void { }
|
|
622
618
|
|
|
623
619
|
// ---
|
|
624
620
|
|
package/types/index.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
113
113
|
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
114
114
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
115
115
|
getClampRenderScale(): number;
|
|
116
|
-
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData;
|
|
116
|
+
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale?: boolean): IScaleData;
|
|
117
117
|
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
118
118
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
119
119
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
@@ -161,7 +161,6 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
161
161
|
__drawHitPath(_canvas: ILeaferCanvas): void;
|
|
162
162
|
__updateHitCanvas(): void;
|
|
163
163
|
__render(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
164
|
-
__renderComplex(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
165
164
|
__drawFast(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
166
165
|
__draw(_canvas: ILeaferCanvas, _options: IRenderOptions, _originCanvas?: ILeaferCanvas): void;
|
|
167
166
|
__clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
@@ -172,7 +171,7 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
172
171
|
__drawPath(_canvas: ILeaferCanvas): void;
|
|
173
172
|
__drawRenderPath(_canvas: ILeaferCanvas): void;
|
|
174
173
|
__updatePath(): void;
|
|
175
|
-
__updateRenderPath(): void;
|
|
174
|
+
__updateRenderPath(_updateCache?: boolean): void;
|
|
176
175
|
getMotionPathData(): IMotionPathData;
|
|
177
176
|
getMotionPoint(_motionDistance: number | IUnitData): IRotationPointData;
|
|
178
177
|
getMotionTotal(): number;
|