@leafer/display 1.7.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/display",
3
- "version": "1.7.0",
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.7.0",
26
- "@leafer/data": "1.7.0",
27
- "@leafer/layout": "1.7.0",
28
- "@leafer/display-module": "1.7.0",
29
- "@leafer/event": "1.7.0",
30
- "@leafer/decorator": "1.7.0",
31
- "@leafer/helper": "1.7.0",
32
- "@leafer/debug": "1.7.0",
33
- "@leafer/platform": "1.7.0"
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.7.0"
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
  }
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;