@leafer/display 1.6.7 → 1.8.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 -11
- package/src/Leaf.ts +20 -2
- package/types/index.d.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,17 +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/
|
|
33
|
-
"@leafer/
|
|
25
|
+
"@leafer/math": "1.8.0",
|
|
26
|
+
"@leafer/data": "1.8.0",
|
|
27
|
+
"@leafer/layout": "1.8.0",
|
|
28
|
+
"@leafer/display-module": "1.8.0",
|
|
29
|
+
"@leafer/event": "1.8.0",
|
|
30
|
+
"@leafer/decorator": "1.8.0",
|
|
31
|
+
"@leafer/helper": "1.8.0",
|
|
32
|
+
"@leafer/image": "1.8.0",
|
|
33
|
+
"@leafer/debug": "1.8.0",
|
|
34
|
+
"@leafer/platform": "1.8.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@leafer/interface": "1.
|
|
37
|
+
"@leafer/interface": "1.8.0"
|
|
37
38
|
}
|
|
38
39
|
}
|
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, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod, IMatrixData, IAttrDecorator, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAlign, IJSONOptions, IEventParamsMap, IEventOption, IAxis, IMotionPathData, IUnitData, IRotationPointData, ITransition, IValueFunction, IEventParams } 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 } 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'
|
|
@@ -6,9 +6,11 @@ import { LeafDataProxy, LeafMatrix, LeafBounds, LeafEventer, LeafRender } from '
|
|
|
6
6
|
import { boundsType, useModule, defineDataProcessor } from '@leafer/decorator'
|
|
7
7
|
import { LeafHelper } from '@leafer/helper'
|
|
8
8
|
import { ChildEvent } from '@leafer/event'
|
|
9
|
+
import { ImageManager } from '@leafer/image'
|
|
9
10
|
import { Plugin } from '@leafer/debug'
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
const tempScaleData = {} as IScaleData
|
|
12
14
|
const { LEAF, create } = IncrementId
|
|
13
15
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper
|
|
14
16
|
const { toOuterOf } = BoundsHelper
|
|
@@ -347,6 +349,20 @@ export class Leaf implements ILeaf {
|
|
|
347
349
|
}
|
|
348
350
|
}
|
|
349
351
|
|
|
352
|
+
public getClampRenderScale(): number {
|
|
353
|
+
let { scaleX } = this.__nowWorld || this.__world
|
|
354
|
+
if (scaleX < 0) scaleX = -scaleX
|
|
355
|
+
return scaleX > 1 ? scaleX : 1
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
public getRenderScaleData(abs?: boolean, scaleFixed?: boolean): IScaleData {
|
|
359
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld
|
|
360
|
+
if (scaleFixed) tempScaleData.scaleX = tempScaleData.scaleY = 1
|
|
361
|
+
else if (abs) tempScaleData.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData.scaleY = scaleY < 0 ? -scaleY : scaleY
|
|
362
|
+
else tempScaleData.scaleX = scaleX, tempScaleData.scaleY = scaleY
|
|
363
|
+
return tempScaleData
|
|
364
|
+
}
|
|
365
|
+
|
|
350
366
|
public getTransform(relative?: ILocationType | ILeaf): IMatrixData {
|
|
351
367
|
return this.__layout.getTransform(relative || 'local')
|
|
352
368
|
}
|
|
@@ -569,7 +585,9 @@ export class Leaf implements ILeaf {
|
|
|
569
585
|
|
|
570
586
|
public __clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
571
587
|
|
|
572
|
-
public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions
|
|
588
|
+
public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
589
|
+
|
|
590
|
+
public __drawShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
573
591
|
|
|
574
592
|
|
|
575
593
|
public __updateWorldOpacity(): void { }
|
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, 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, 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
|
|
|
@@ -108,6 +108,8 @@ declare class Leaf implements ILeaf {
|
|
|
108
108
|
__updateMask(_value?: boolean): void;
|
|
109
109
|
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
110
110
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
111
|
+
getClampRenderScale(): number;
|
|
112
|
+
getRenderScaleData(abs?: boolean, scaleFixed?: boolean): IScaleData;
|
|
111
113
|
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
112
114
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
113
115
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
@@ -157,7 +159,8 @@ declare class Leaf implements ILeaf {
|
|
|
157
159
|
__drawFast(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
158
160
|
__draw(_canvas: ILeaferCanvas, _options: IRenderOptions, _originCanvas?: ILeaferCanvas): void;
|
|
159
161
|
__clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
160
|
-
__renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions
|
|
162
|
+
__renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
163
|
+
__drawShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
161
164
|
__updateWorldOpacity(): void;
|
|
162
165
|
__updateChange(): void;
|
|
163
166
|
__drawPath(_canvas: ILeaferCanvas): void;
|