@leafer/interface 1.0.0-rc.9 → 1.0.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.
@@ -16,8 +16,9 @@ export interface IPathDrawer {
16
16
  roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): void
17
17
  }
18
18
 
19
- export interface IPathCreator {
19
+ export interface IPathCreator extends IPathDrawer {
20
20
  path: IPathCommandData
21
+ __path: IPathCommandData
21
22
 
22
23
  beginPath(): IPathCreator
23
24
 
@@ -27,9 +28,9 @@ export interface IPathCreator {
27
28
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator
28
29
  closePath(): IPathCreator
29
30
 
30
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
31
+ arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
31
32
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator
32
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
33
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
33
34
 
34
35
  rect(x: number, y: number, width: number, height: number): IPathCreator
35
36
  roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
@@ -38,4 +39,6 @@ export interface IPathCreator {
38
39
  drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
39
40
  drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
40
41
  drawPoints(points: number[], curve?: boolean | number, close?: boolean): IPathCreator
42
+
43
+ clearPath(): IPathCreator
41
44
  }
@@ -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'
@@ -9,6 +9,7 @@ import { ICanvasType } from '../canvas/ISkiaCanvas'
9
9
  export interface IPlatform {
10
10
  name?: 'web' | 'node' | 'miniapp'
11
11
  os?: 'Mac' | 'Windows' | 'Linux'
12
+ toURL(text: string, fileType?: 'text' | 'svg'): string
12
13
  requestRender?(render: IFunction): void
13
14
  canvas?: ILeaferCanvas
14
15
  canvasType?: ICanvasType
@@ -18,7 +19,7 @@ export interface IPlatform {
18
19
  intWheelDeltaY?: boolean // firefox / Windows need
19
20
  conicGradientSupport?: boolean
20
21
  conicGradientRotate90?: boolean // firefox need rotate
21
- fullImageShadow?: boolean // safari need
22
+ fullImageShadow?: boolean // safari need
22
23
  syncDomFont?: boolean // firefox need
23
24
  layout?(target: ILeaf): void
24
25
  origin?: {
@@ -26,6 +27,7 @@ export interface IPlatform {
26
27
  canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
27
28
  canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
28
29
  canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
30
+ download(url: string, filename: string): Promise<void>
29
31
  loadImage(url: string): Promise<any>
30
32
  noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
31
33
  },
@@ -38,9 +40,13 @@ export interface IPlatform {
38
40
  },
39
41
  miniapp?: IMiniapp
40
42
  image: {
43
+ hitCanvasSize: number // 图片生成碰撞画布的最大尺寸(单边)
41
44
  maxCacheSize: number // 最大等级缓存,一般取当前屏幕大小,默认2k: 2560 * 1600
42
45
  maxPatternSize: number // 最大repeat pattern缓存, 默认4k: 4096 * 2160
43
- suffix: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
46
+ prefix?: string // url加前缀
47
+ suffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
48
+ crossOrigin: string | false // 跨域设置
49
+ getRealURL: IStringFunction // 处理前缀、后缀
44
50
  }
45
51
  }
46
52
 
@@ -1,6 +1,6 @@
1
1
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
2
  import { ILeaf } from '../display/ILeaf'
3
- import { IBounds, IMatrix } from '../math/IMath'
3
+ import { IBounds, IMatrixWithScaleData } from '../math/IMath'
4
4
  import { IFunction } from '../function/IFunction'
5
5
  import { IControl } from '../control/IControl'
6
6
 
@@ -8,7 +8,7 @@ export interface IRenderOptions {
8
8
  includes?: boolean,
9
9
  bounds?: IBounds,
10
10
  hideBounds?: IBounds,
11
- matrix?: IMatrix,
11
+ matrix?: IMatrixWithScaleData,
12
12
  inCamera?: boolean
13
13
  }
14
14
 
@@ -32,6 +32,7 @@ export interface IRenderer extends IControl {
32
32
 
33
33
  waitAgain: boolean
34
34
  changed: boolean
35
+ ignore: boolean
35
36
 
36
37
  config: IRendererConfig
37
38
 
@@ -1,33 +1,44 @@
1
1
  import { ILeaf } from '../display/ILeaf'
2
2
  import { ILeafList } from '../data/IList'
3
3
  import { IPointData } from '../math/IMath'
4
+ import { IBranch } from '../display/IBranch'
4
5
 
5
- export interface ISelectPathResult {
6
- leaf: ILeaf
6
+ export interface IPickResult {
7
+ target: ILeaf
7
8
  path: ILeafList
8
9
  throughPath?: ILeafList
9
10
  }
10
11
 
11
- export interface ISelectPathOptions {
12
+ export interface IPickOptions {
12
13
  name?: string
14
+ hitRadius?: number
13
15
  through?: boolean
16
+ target?: IBranch
17
+ findList?: ILeaf[]
18
+ bottomList?: IPickBottom[] // 底部可拾取的虚拟元素
14
19
  exclude?: ILeafList
15
20
  ignoreHittable?: boolean
16
21
  }
17
22
 
23
+ export interface IPickBottom {
24
+ target: ILeaf
25
+ proxy?: ILeaf
26
+ }
27
+
18
28
  export interface ISelectorConfig {
19
29
 
20
30
  }
21
31
 
22
- export enum AnswerType {
23
- No = 0,
24
- Yes = 1,
25
- NoAndSkip = 2,
26
- YesAndSkip = 3
32
+ export type IAnswer = 0 | 1 | 2 | 3
33
+
34
+ export interface IFindCondition {
35
+ id?: number | string,
36
+ className?: string,
37
+ tag?: string | string[]
27
38
  }
28
39
 
29
40
  export interface IFindMethod {
30
- (leaf: ILeaf, options?: any): AnswerType
41
+ (leaf: ILeaf, options?: any): IAnswer
31
42
  }
32
43
 
33
44
  export interface ISelectorProxy {
@@ -41,7 +52,7 @@ export interface ISelector {
41
52
 
42
53
  config: ISelectorConfig
43
54
 
44
- getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
55
+ getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult
45
56
 
46
57
  getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
47
58
  getByInnerId(innerId: number, branch?: ILeaf): ILeaf