@leafer/display 1.8.0 → 1.9.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 +12 -12
- package/src/Branch.ts +4 -3
- package/src/Leaf.ts +12 -9
- package/types/index.d.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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": "1.
|
|
26
|
-
"@leafer/data": "1.
|
|
27
|
-
"@leafer/layout": "1.
|
|
28
|
-
"@leafer/display-module": "1.
|
|
29
|
-
"@leafer/event": "1.
|
|
30
|
-
"@leafer/decorator": "1.
|
|
31
|
-
"@leafer/helper": "1.
|
|
32
|
-
"@leafer/image": "1.
|
|
33
|
-
"@leafer/debug": "1.
|
|
34
|
-
"@leafer/platform": "1.
|
|
25
|
+
"@leafer/math": "1.9.0",
|
|
26
|
+
"@leafer/data": "1.9.0",
|
|
27
|
+
"@leafer/layout": "1.9.0",
|
|
28
|
+
"@leafer/display-module": "1.9.0",
|
|
29
|
+
"@leafer/event": "1.9.0",
|
|
30
|
+
"@leafer/decorator": "1.9.0",
|
|
31
|
+
"@leafer/helper": "1.9.0",
|
|
32
|
+
"@leafer/image": "1.9.0",
|
|
33
|
+
"@leafer/debug": "1.9.0",
|
|
34
|
+
"@leafer/platform": "1.9.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@leafer/interface": "1.
|
|
37
|
+
"@leafer/interface": "1.9.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
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 { isArray, isUndefined } from '@leafer/data'
|
|
8
9
|
import { Debug } from '@leafer/debug'
|
|
9
10
|
|
|
10
11
|
import { Leaf } from './Leaf'
|
|
@@ -67,9 +68,9 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
67
68
|
public add(child: ILeaf, index?: number): void {
|
|
68
69
|
if (child === this || child.destroyed) return debug.warn('add self or destroyed')
|
|
69
70
|
|
|
70
|
-
const noIndex = index
|
|
71
|
+
const noIndex = isUndefined(index)
|
|
71
72
|
if (!child.__) {
|
|
72
|
-
if (child
|
|
73
|
+
if (isArray(child)) return child.forEach(item => { this.add(item, index); noIndex || index++ }) // add []
|
|
73
74
|
else child = UICreator.get(child.tag, child) // add JSON
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -105,7 +106,7 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
105
106
|
|
|
106
107
|
} else this.find(child as any).forEach(item => this.remove(item, destroy)) //
|
|
107
108
|
|
|
108
|
-
} else if (child
|
|
109
|
+
} else if (isUndefined(child)) {
|
|
109
110
|
super.remove(null, destroy)
|
|
110
111
|
}
|
|
111
112
|
}
|
package/src/Leaf.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 } from '@leafer/interface'
|
|
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 } from '@leafer/interface'
|
|
2
2
|
import { BoundsHelper, IncrementId, MatrixHelper, PointHelper } from '@leafer/math'
|
|
3
|
-
import { LeafData } from '@leafer/data'
|
|
3
|
+
import { LeafData, isUndefined } from '@leafer/data'
|
|
4
4
|
import { LeafLayout } from '@leafer/layout'
|
|
5
5
|
import { LeafDataProxy, LeafMatrix, LeafBounds, LeafEventer, LeafRender } from '@leafer/display-module'
|
|
6
6
|
import { boundsType, useModule, defineDataProcessor } from '@leafer/decorator'
|
|
@@ -247,10 +247,10 @@ export class Leaf implements ILeaf {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
public forceUpdate(attrName?: string): void {
|
|
250
|
-
if (attrName
|
|
250
|
+
if (isUndefined(attrName)) attrName = 'width'
|
|
251
251
|
else if (attrName === 'surface') attrName = 'blendMode'
|
|
252
252
|
const value = this.__.__getInput(attrName);
|
|
253
|
-
(this.__ as any)[attrName] = value
|
|
253
|
+
(this.__ as any)[attrName] = isUndefined(value) ? null : undefined;
|
|
254
254
|
(this as any)[attrName] = value
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -355,11 +355,12 @@ export class Leaf implements ILeaf {
|
|
|
355
355
|
return scaleX > 1 ? scaleX : 1
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
public getRenderScaleData(abs?: boolean, scaleFixed?:
|
|
359
|
-
|
|
360
|
-
if (
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
public getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData {
|
|
359
|
+
let { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld
|
|
360
|
+
if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY)
|
|
361
|
+
if (scaleFixed === true || (scaleFixed === 'zoom-in' && scaleX > 1 && scaleY > 1)) scaleX = scaleY = 1
|
|
362
|
+
tempScaleData.scaleX = scaleX
|
|
363
|
+
tempScaleData.scaleY = scaleY
|
|
363
364
|
return tempScaleData
|
|
364
365
|
}
|
|
365
366
|
|
|
@@ -557,6 +558,8 @@ export class Leaf implements ILeaf {
|
|
|
557
558
|
|
|
558
559
|
// @leafer-ui/hit LeafHit rewrite
|
|
559
560
|
|
|
561
|
+
public hit(_world: IPointData, _hitRadius?: number): boolean { return true }
|
|
562
|
+
|
|
560
563
|
public __hitWorld(_point: IRadiusPointData): boolean { return true }
|
|
561
564
|
|
|
562
565
|
public __hit(_local: IRadiusPointData): boolean { return true }
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventParamsMap, IEventListenerMap, ILeafInputData, IFunction, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, IScaleData, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, ITransition, IAlign, IAxis, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventParams, IEventListener, IEventOption, IEventListenerId, IEvent, IValueFunction, IAttrDecorator } from '@leafer/interface';
|
|
1
|
+
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventParamsMap, IEventListenerMap, ILeafInputData, IFunction, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, IScaleFixed, IScaleData, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, ITransition, IAlign, IAxis, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventParams, IEventListener, IEventOption, IEventListenerId, IEvent, IValueFunction, IAttrDecorator } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/data';
|
|
3
3
|
import { LeafLayout } from '@leafer/layout';
|
|
4
4
|
|
|
@@ -109,7 +109,7 @@ declare class Leaf implements ILeaf {
|
|
|
109
109
|
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
110
110
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
111
111
|
getClampRenderScale(): number;
|
|
112
|
-
getRenderScaleData(abs?: boolean, scaleFixed?:
|
|
112
|
+
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed): IScaleData;
|
|
113
113
|
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
114
114
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
115
115
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
@@ -148,6 +148,7 @@ declare class Leaf implements ILeaf {
|
|
|
148
148
|
__scaleResize(_scaleX: number, _scaleY: number): void;
|
|
149
149
|
resizeWidth(_width: number): void;
|
|
150
150
|
resizeHeight(_height: number): void;
|
|
151
|
+
hit(_world: IPointData, _hitRadius?: number): boolean;
|
|
151
152
|
__hitWorld(_point: IRadiusPointData): boolean;
|
|
152
153
|
__hit(_local: IRadiusPointData): boolean;
|
|
153
154
|
__hitFill(_inner: IRadiusPointData): boolean;
|