@leafer/interface 1.0.0-rc.27 → 1.0.0-rc.28

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.0.0-rc.27",
3
+ "version": "1.0.0-rc.28",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@ import { IControl } from '../control/IControl'
17
17
  import { IFunction } from '../function/IFunction'
18
18
 
19
19
 
20
- export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart'
20
+ export type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
21
21
  export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
22
22
  start?: boolean
23
23
  type?: ILeaferType
@@ -70,7 +70,6 @@ export interface ILeaferAttrData {
70
70
  unlockLayout(): void
71
71
  lockLayout(): void
72
72
 
73
- forceRender(bounds?: IBoundsData): void
74
73
  updateCursor(cursor?: ICursorType): void
75
74
  resize(size: IScreenSizeData): void
76
75
 
@@ -158,6 +158,9 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
158
158
  backgroundColor?: string
159
159
  hittable?: boolean
160
160
 
161
+ zIndex?: number
162
+ childIndex?: number
163
+
161
164
  bounds: IBounds
162
165
  clientBounds: IBoundsData
163
166
 
@@ -556,6 +556,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
556
556
 
557
557
  readonly __onlyHitMask: boolean
558
558
  readonly __ignoreHitWorld: boolean
559
+ readonly __inLazyBounds: boolean
559
560
 
560
561
  readonly pathInputed: boolean
561
562
 
@@ -599,9 +600,10 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
599
600
  findId(id: number | string): ILeaf | undefined
600
601
 
601
602
  focus(value?: boolean): void
602
- forceUpdate(attrName?: string): void
603
603
 
604
604
  updateLayout(): void
605
+ forceUpdate(attrName?: string): void
606
+ forceRender(_bounds?: IBoundsData): void
605
607
 
606
608
  // ILeafMatrix ->
607
609
  __updateWorldMatrix(): void
@@ -643,6 +645,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
643
645
 
644
646
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
645
647
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
648
+ getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
646
649
 
647
650
  getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData
648
651
 
@@ -1,19 +1,21 @@
1
1
  import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
+ import { ICanvasContext2DSettings } from '../canvas/ICanvas'
2
3
  import { ILeaf } from '../display/ILeaf'
3
4
  import { ILocationType } from '../layout/ILeafLayout'
4
5
  import { IBoundsData } from '../math/IMath'
5
6
 
6
-
7
7
  export interface IExportOptions {
8
8
  quality?: number
9
9
  blob?: boolean
10
10
  scale?: number
11
+ smooth?: boolean
11
12
  pixelRatio?: number
12
13
  slice?: boolean
13
14
  trim?: boolean
14
15
  fill?: string
15
16
  screenshot?: IBoundsData | boolean
16
17
  relative?: ILocationType | ILeaf
18
+ contextSettings?: ICanvasContext2DSettings
17
19
  onCanvas?: IExportOnCanvasFunction
18
20
  }
19
21
 
@@ -82,10 +82,10 @@ export interface IInteractionCanvas extends ILeaferCanvas {
82
82
  export interface IInteractionConfig {
83
83
  wheel?: IWheelConfig
84
84
  pointer?: IPointerConfig
85
- cursor?: ICursorConfig
86
85
  zoom?: IZoomConfig
87
86
  move?: IMoveConfig
88
87
  eventer?: IObject
88
+ cursor?: boolean
89
89
  keyEvent?: boolean
90
90
  }
91
91
 
@@ -1,4 +1,4 @@
1
- import { IFunction } from '../function/IFunction'
1
+ import { IFunction, IStringFunction } from '../function/IFunction'
2
2
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
3
3
  import { ILeaf } from '../display/ILeaf'
4
4
  import { IExportFileType, IExportImageType } from '../file/IFileType'
@@ -43,8 +43,10 @@ export interface IPlatform {
43
43
  hitCanvasSize: number // 图片生成碰撞画布的最大尺寸(单边)
44
44
  maxCacheSize: number // 最大等级缓存,一般取当前屏幕大小,默认2k: 2560 * 1600
45
45
  maxPatternSize: number // 最大repeat pattern缓存, 默认4k: 4096 * 2160
46
- suffix: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
46
+ prefix?: string // url加前缀
47
+ suffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
47
48
  crossOrigin: string | false // 跨域设置
49
+ getRealURL: IStringFunction // 处理前缀、后缀
48
50
  }
49
51
  }
50
52
 
package/types/index.d.ts CHANGED
@@ -880,12 +880,14 @@ interface IExportOptions {
880
880
  quality?: number;
881
881
  blob?: boolean;
882
882
  scale?: number;
883
+ smooth?: boolean;
883
884
  pixelRatio?: number;
884
885
  slice?: boolean;
885
886
  trim?: boolean;
886
887
  fill?: string;
887
888
  screenshot?: IBoundsData | boolean;
888
889
  relative?: ILocationType | ILeaf;
890
+ contextSettings?: ICanvasContext2DSettings;
889
891
  onCanvas?: IExportOnCanvasFunction;
890
892
  }
891
893
  interface IExportResult {
@@ -1010,6 +1012,8 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
1010
1012
  readonly allowBackgroundColor?: boolean;
1011
1013
  backgroundColor?: string;
1012
1014
  hittable?: boolean;
1015
+ zIndex?: number;
1016
+ childIndex?: number;
1013
1017
  bounds: IBounds;
1014
1018
  clientBounds: IBoundsData;
1015
1019
  config: ILeaferCanvasConfig;
@@ -1538,6 +1542,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1538
1542
  __hasGrow?: boolean;
1539
1543
  readonly __onlyHitMask: boolean;
1540
1544
  readonly __ignoreHitWorld: boolean;
1545
+ readonly __inLazyBounds: boolean;
1541
1546
  readonly pathInputed: boolean;
1542
1547
  __parentWait?: IFunction[];
1543
1548
  __leaferWait?: IFunction[];
@@ -1568,8 +1573,9 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1568
1573
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined;
1569
1574
  findId(id: number | string): ILeaf | undefined;
1570
1575
  focus(value?: boolean): void;
1571
- forceUpdate(attrName?: string): void;
1572
1576
  updateLayout(): void;
1577
+ forceUpdate(attrName?: string): void;
1578
+ forceRender(_bounds?: IBoundsData): void;
1573
1579
  __updateWorldMatrix(): void;
1574
1580
  __updateLocalMatrix(): void;
1575
1581
  __updateWorldBounds(): void;
@@ -1596,6 +1602,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1596
1602
  getTransform(relative?: ILocationType | ILeaf): IMatrixData;
1597
1603
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
1598
1604
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
1605
+ getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
1599
1606
  getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData;
1600
1607
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1601
1608
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
@@ -1811,10 +1818,10 @@ interface IInteractionCanvas extends ILeaferCanvas {
1811
1818
  interface IInteractionConfig {
1812
1819
  wheel?: IWheelConfig;
1813
1820
  pointer?: IPointerConfig;
1814
- cursor?: ICursorConfig;
1815
1821
  zoom?: IZoomConfig;
1816
1822
  move?: IMoveConfig;
1817
1823
  eventer?: IObject;
1824
+ cursor?: boolean;
1818
1825
  keyEvent?: boolean;
1819
1826
  }
1820
1827
  interface IZoomConfig {
@@ -1859,9 +1866,6 @@ interface IPointerConfig {
1859
1866
  preventDefault?: boolean;
1860
1867
  preventDefaultMenu?: boolean;
1861
1868
  }
1862
- interface ICursorConfig {
1863
- stop?: boolean;
1864
- }
1865
1869
 
1866
1870
  interface IHitCanvasManager extends ICanvasManager {
1867
1871
  maxTotal: number;
@@ -1872,7 +1876,7 @@ interface IHitCanvasManager extends ICanvasManager {
1872
1876
  interface IZoomView extends IBranch {
1873
1877
  }
1874
1878
 
1875
- type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart';
1879
+ type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
1876
1880
  interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
1877
1881
  start?: boolean;
1878
1882
  type?: ILeaferType;
@@ -1910,7 +1914,6 @@ interface ILeaferAttrData {
1910
1914
  stop(): void;
1911
1915
  unlockLayout(): void;
1912
1916
  lockLayout(): void;
1913
- forceRender(bounds?: IBoundsData): void;
1914
1917
  updateCursor(cursor?: ICursorType): void;
1915
1918
  resize(size: IScreenSizeData): void;
1916
1919
  waitReady(item: IFunction, bind?: IObject): void;
@@ -2089,8 +2092,10 @@ interface IPlatform {
2089
2092
  hitCanvasSize: number;
2090
2093
  maxCacheSize: number;
2091
2094
  maxPatternSize: number;
2092
- suffix: string;
2095
+ prefix?: string;
2096
+ suffix?: string;
2093
2097
  crossOrigin: string | false;
2098
+ getRealURL: IStringFunction;
2094
2099
  };
2095
2100
  }
2096
2101
  interface IMiniappSelect extends IObject {