@leafer/display 1.0.0-rc.28 → 1.0.0-rc.30
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 +10 -10
- package/src/Leaf.ts +8 -21
- package/types/index.d.ts +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.30",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.0.0-rc.
|
|
26
|
-
"@leafer/data": "1.0.0-rc.
|
|
27
|
-
"@leafer/layout": "1.0.0-rc.
|
|
28
|
-
"@leafer/display-module": "1.0.0-rc.
|
|
29
|
-
"@leafer/event": "1.0.0-rc.
|
|
30
|
-
"@leafer/decorator": "1.0.0-rc.
|
|
31
|
-
"@leafer/helper": "1.0.0-rc.
|
|
32
|
-
"@leafer/platform": "1.0.0-rc.
|
|
25
|
+
"@leafer/math": "1.0.0-rc.30",
|
|
26
|
+
"@leafer/data": "1.0.0-rc.30",
|
|
27
|
+
"@leafer/layout": "1.0.0-rc.30",
|
|
28
|
+
"@leafer/display-module": "1.0.0-rc.30",
|
|
29
|
+
"@leafer/event": "1.0.0-rc.30",
|
|
30
|
+
"@leafer/decorator": "1.0.0-rc.30",
|
|
31
|
+
"@leafer/helper": "1.0.0-rc.30",
|
|
32
|
+
"@leafer/platform": "1.0.0-rc.30"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@leafer/interface": "1.0.0-rc.
|
|
35
|
+
"@leafer/interface": "1.0.0-rc.30"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/Leaf.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferBase, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IBoundsType, ILocationType, IMatrixWithBoundsData, ILayoutBoundsData, IValue, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod,
|
|
1
|
+
import { ILeaferBase, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IBoundsType, ILocationType, IMatrixWithBoundsData, ILayoutBoundsData, IValue, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod, IMatrixData, IAttrDecorator, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAlign, IJSONOptions } from '@leafer/interface'
|
|
2
2
|
import { BoundsHelper, IncrementId, MatrixHelper, PointHelper } from '@leafer/math'
|
|
3
3
|
import { LeafData } from '@leafer/data'
|
|
4
4
|
import { LeafLayout } from '@leafer/layout'
|
|
@@ -179,12 +179,13 @@ export class Leaf implements ILeaf {
|
|
|
179
179
|
|
|
180
180
|
public getComputedAttr(name: string): any { return (this.__ as IObject)[name] }
|
|
181
181
|
|
|
182
|
-
public toJSON(): IObject {
|
|
183
|
-
|
|
182
|
+
public toJSON(options?: IJSONOptions): IObject {
|
|
183
|
+
if (options) this.__layout.update()
|
|
184
|
+
return this.__.__getInputData(null, options)
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
public toString(): string {
|
|
187
|
-
return JSON.stringify(this.toJSON())
|
|
187
|
+
public toString(options?: IJSONOptions): string {
|
|
188
|
+
return JSON.stringify(this.toJSON(options))
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
public toSVG(): string { return undefined }
|
|
@@ -327,14 +328,6 @@ export class Leaf implements ILeaf {
|
|
|
327
328
|
}
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
|
|
331
|
-
public getWorld(attrName: ILayoutAttr): number {
|
|
332
|
-
this.__layout.update()
|
|
333
|
-
if (attrName === 'x') return this.__world.e
|
|
334
|
-
if (attrName === 'y') return this.__world.f
|
|
335
|
-
return this.getLayoutBounds()[attrName]
|
|
336
|
-
}
|
|
337
|
-
|
|
338
331
|
public getTransform(relative?: ILocationType | ILeaf): IMatrixData {
|
|
339
332
|
return this.__layout.getTransform(relative || 'local')
|
|
340
333
|
}
|
|
@@ -492,15 +485,9 @@ export class Leaf implements ILeaf {
|
|
|
492
485
|
public __scaleResize(_scaleX: number, _scaleY: number): void { }
|
|
493
486
|
|
|
494
487
|
|
|
495
|
-
public resizeWidth(
|
|
496
|
-
const scale = width / this.__localBoxBounds.width
|
|
497
|
-
this.scaleResize(scale, this.__.lockRatio ? scale : 1)
|
|
498
|
-
}
|
|
488
|
+
public resizeWidth(_width: number): void { }
|
|
499
489
|
|
|
500
|
-
public resizeHeight(
|
|
501
|
-
const scale = height / this.__localBoxBounds.height
|
|
502
|
-
this.scaleResize(this.__.lockRatio ? scale : 1, scale)
|
|
503
|
-
}
|
|
490
|
+
public resizeHeight(_height: number): void { }
|
|
504
491
|
|
|
505
492
|
|
|
506
493
|
// @leafer-ui/hit LeafHit rewrite
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventListenerMap, IFunction, ILeafInputData, IObject, IValue, IFindMethod, ILeaferCanvas, IRenderOptions,
|
|
1
|
+
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventListenerMap, IFunction, ILeafInputData, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, IAlign, IRadiusPointData, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IAttrDecorator } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/data';
|
|
3
3
|
import { LeafLayout } from '@leafer/layout';
|
|
4
4
|
|
|
@@ -63,8 +63,8 @@ declare class Leaf implements ILeaf {
|
|
|
63
63
|
setAttr(name: string, value: any): void;
|
|
64
64
|
getAttr(name: string): any;
|
|
65
65
|
getComputedAttr(name: string): any;
|
|
66
|
-
toJSON(): IObject;
|
|
67
|
-
toString(): string;
|
|
66
|
+
toJSON(options?: IJSONOptions): IObject;
|
|
67
|
+
toString(options?: IJSONOptions): string;
|
|
68
68
|
toSVG(): string;
|
|
69
69
|
__SVG(_data: IObject): void;
|
|
70
70
|
toHTML(): string;
|
|
@@ -102,7 +102,6 @@ declare class Leaf implements ILeaf {
|
|
|
102
102
|
__updateMask(value?: boolean): void;
|
|
103
103
|
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
104
104
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
105
|
-
getWorld(attrName: ILayoutAttr): number;
|
|
106
105
|
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
107
106
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
108
107
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
@@ -133,8 +132,8 @@ declare class Leaf implements ILeaf {
|
|
|
133
132
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
134
133
|
scaleResize(scaleX: number, scaleY?: number, _noResize?: boolean): void;
|
|
135
134
|
__scaleResize(_scaleX: number, _scaleY: number): void;
|
|
136
|
-
resizeWidth(
|
|
137
|
-
resizeHeight(
|
|
135
|
+
resizeWidth(_width: number): void;
|
|
136
|
+
resizeHeight(_height: number): void;
|
|
138
137
|
__hitWorld(_point: IRadiusPointData): boolean;
|
|
139
138
|
__hit(_local: IRadiusPointData): boolean;
|
|
140
139
|
__hitFill(_inner: IRadiusPointData): boolean;
|