@leafer/interface 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/interface",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -118,8 +118,8 @@ interface ICanvasMethod {
118
118
  hitPixel(radiusPoint: IRadiusPointData, offset?: IPointData, scale?: number): boolean
119
119
 
120
120
 
121
- setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
122
- setStrokeOptions(options: ICanvasStrokeOptions): void
121
+ setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions, childOptions?: ICanvasStrokeOptions): void
122
+ setStrokeOptions(options: ICanvasStrokeOptions, childOptions?: ICanvasStrokeOptions): void
123
123
 
124
124
  setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
125
125
  useWorldTransform(worldTransform?: IMatrixData): void
@@ -5,7 +5,7 @@ import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
5
5
  import { IRenderOptions } from '../renderer/IRenderer'
6
6
 
7
7
  import { IObject, INumber, IBoolean, IValue, IString, IPathString, IFourNumber } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData, IRotationPointData } from '../math/IMath'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData, IRotationPointData, IScaleData } from '../math/IMath'
9
9
  import { IFunction } from '../function/IFunction'
10
10
 
11
11
  import { ILeafDataProxy } from './module/ILeafDataProxy'
@@ -258,6 +258,8 @@ export interface ILeafAttrData {
258
258
  lazy?: IBoolean
259
259
  pixelRatio?: INumber
260
260
 
261
+ renderSpread?: INumber // 扩大渲染边界
262
+
261
263
  path?: IPathCommandData | IPathCommandObject[] | IPathString
262
264
  windingRule?: IWindingRule
263
265
  closed?: IBoolean
@@ -359,6 +361,8 @@ export interface ILeafComputedData {
359
361
  lazy?: boolean
360
362
  pixelRatio?: number
361
363
 
364
+ renderSpread?: number
365
+
362
366
  path?: IPathCommandData
363
367
  windingRule?: IWindingRule
364
368
  closed?: boolean
@@ -515,6 +519,9 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
515
519
 
516
520
  readonly pathInputed: boolean
517
521
 
522
+ readonly isAutoWidth?: boolean
523
+ readonly isAutoHeight?: boolean
524
+
518
525
  destroyed: boolean
519
526
 
520
527
  reset(data?: ILeafInputData): void
@@ -597,6 +604,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
597
604
 
598
605
  // convert
599
606
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
607
+ getClampRenderScale(): number // 获取当前渲染元素的缩放比例,限制最小为1
608
+ getRenderScaleData(abs?: boolean, scaleFixed?: boolean): IScaleData // 当前渲染的比例数据,必须马上分解使用
600
609
 
601
610
  getTransform(relative?: ILocationType | ILeaf): IMatrixData
602
611
 
@@ -35,6 +35,7 @@ export interface IExportResult {
35
35
  height?: number
36
36
  renderBounds?: IBoundsData
37
37
  trimBounds?: IBoundsData
38
+ error?: any
38
39
  }
39
40
 
40
41
  export interface IExportResultFunction {
@@ -32,7 +32,7 @@ export interface ILeafLayout {
32
32
  // worldRenderBounds: IBoundsData // use leaf.__world
33
33
 
34
34
  // state
35
- resized: 'scale' | 'inner' | 'local' // (scale | inner) > local
35
+ resized: 'inner' | 'scale' | 'local' // inner > scale > local, 设置了inner之后不能被覆盖
36
36
  waitAutoLayout: boolean
37
37
 
38
38
  // matrix changed
package/types/index.d.ts CHANGED
@@ -877,7 +877,7 @@ interface ILeafLayout {
877
877
  worldContentBounds: IBoundsData;
878
878
  worldBoxBounds: IBoundsData;
879
879
  worldStrokeBounds: IBoundsData;
880
- resized: 'scale' | 'inner' | 'local';
880
+ resized: 'inner' | 'scale' | 'local';
881
881
  waitAutoLayout: boolean;
882
882
  matrixChanged: boolean;
883
883
  scaleChanged: boolean;
@@ -962,6 +962,7 @@ interface IExportResult {
962
962
  height?: number;
963
963
  renderBounds?: IBoundsData;
964
964
  trimBounds?: IBoundsData;
965
+ error?: any;
965
966
  }
966
967
  interface IExportResultFunction {
967
968
  (data: IExportResult): void;
@@ -1051,8 +1052,8 @@ interface ICanvasMethod {
1051
1052
  hitFill(point: IPointData, fillRule?: string): boolean;
1052
1053
  hitStroke(point: IPointData, strokeWidth?: number): boolean;
1053
1054
  hitPixel(radiusPoint: IRadiusPointData, offset?: IPointData, scale?: number): boolean;
1054
- setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void;
1055
- setStrokeOptions(options: ICanvasStrokeOptions): void;
1055
+ setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions, childOptions?: ICanvasStrokeOptions): void;
1056
+ setStrokeOptions(options: ICanvasStrokeOptions, childOptions?: ICanvasStrokeOptions): void;
1056
1057
  setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void;
1057
1058
  useWorldTransform(worldTransform?: IMatrixData): void;
1058
1059
  setWorldShadow(x: number, y: number, blur: number, color?: string): void;
@@ -1463,6 +1464,7 @@ interface ILeafAttrData {
1463
1464
  around?: IAlign | IUnitPointData;
1464
1465
  lazy?: IBoolean;
1465
1466
  pixelRatio?: INumber;
1467
+ renderSpread?: INumber;
1466
1468
  path?: IPathCommandData | IPathCommandObject[] | IPathString;
1467
1469
  windingRule?: IWindingRule;
1468
1470
  closed?: IBoolean;
@@ -1536,6 +1538,7 @@ interface ILeafComputedData {
1536
1538
  around?: IAlign | IUnitPointData;
1537
1539
  lazy?: boolean;
1538
1540
  pixelRatio?: number;
1541
+ renderSpread?: number;
1539
1542
  path?: IPathCommandData;
1540
1543
  windingRule?: IWindingRule;
1541
1544
  closed?: boolean;
@@ -1646,6 +1649,8 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1646
1649
  readonly __ignoreHitWorld: boolean;
1647
1650
  readonly __inLazyBounds: boolean;
1648
1651
  readonly pathInputed: boolean;
1652
+ readonly isAutoWidth?: boolean;
1653
+ readonly isAutoHeight?: boolean;
1649
1654
  destroyed: boolean;
1650
1655
  reset(data?: ILeafInputData): void;
1651
1656
  resetCustom(): void;
@@ -1702,6 +1707,8 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1702
1707
  __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
1703
1708
  __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
1704
1709
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
1710
+ getClampRenderScale(): number;
1711
+ getRenderScaleData(abs?: boolean, scaleFixed?: boolean): IScaleData;
1705
1712
  getTransform(relative?: ILocationType | ILeaf): IMatrixData;
1706
1713
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1707
1714
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;