@leafer/interface 1.0.0-beta.7 → 1.0.0-beta.8

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-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -63,6 +63,7 @@ export interface ILeafer extends IZoomView, IControl {
63
63
  forceFullRender(): void
64
64
  resize(size: IScreenSizeData): void
65
65
  waitViewLoaded(fun: IFunction): void
66
+ receiveEvent(event: IObject): void
66
67
  }
67
68
 
68
69
  export interface ILeaferTypeCreator {
@@ -146,13 +146,14 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
146
146
  hittable?: boolean
147
147
 
148
148
  bounds: IBounds
149
+ clientBounds: IBoundsData
149
150
 
150
151
  config: ILeaferCanvasConfig
151
152
 
152
153
  autoLayout: boolean
153
154
 
154
- view: unknown
155
- parentView: unknown
155
+ view: any
156
+ parentView: any
156
157
 
157
158
  unreal?: boolean
158
159
 
@@ -175,6 +176,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
175
176
 
176
177
  resize(size: IScreenSizeData): void
177
178
  updateViewSize(): void
179
+ updateClientBounds(): void
178
180
 
179
181
  // other
180
182
  isSameSize(options: ILeaferCanvasConfig): boolean
@@ -187,7 +189,10 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
187
189
  }
188
190
 
189
191
 
190
- export type IHitCanvas = ILeaferCanvas
192
+ export interface IHitCanvas extends ILeaferCanvas {
193
+
194
+ }
195
+
191
196
 
192
197
  export interface IBlobFunction {
193
198
  (blob: IBlob | null): void
@@ -1,6 +1,6 @@
1
1
  import { IExportFileType, IExportImageType } from '../file/IFileType'
2
2
 
3
- export type ICanvasType = 'skia' | 'canvas'
3
+ export type ICanvasType = 'skia' | 'canvas' | 'wx'
4
4
 
5
5
  export interface ISkiaCanvas {
6
6
  toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
@@ -158,6 +158,8 @@ export interface ILeafComputedData {
158
158
  // other
159
159
  __childBranchNumber?: number // 存在子分支的个数
160
160
  __complex?: boolean // 外观是否复杂
161
+ __naturalWidth?: number
162
+ __naturalHeight?: number
161
163
  }
162
164
 
163
165
  export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
@@ -2,7 +2,7 @@ import { IEventer } from './IEventer'
2
2
  import { IWatchEventData } from '../watcher/IWatcher'
3
3
  import { ILayoutBlockData } from '../layouter/ILayouter'
4
4
  import { ILeaf } from '../display/ILeaf'
5
- import { IScreenSizeData } from '../math/IMath'
5
+ import { IScreenSizeData, IPointData } from '../math/IMath'
6
6
 
7
7
  export interface IEvent {
8
8
  type?: string
@@ -95,4 +95,17 @@ export interface ITransformEvent extends IEvent, ITransformEventData {
95
95
  readonly scaleY: number
96
96
  readonly rotation: number
97
97
  }
98
- export type TransformMode = 'move' | 'zoom' | 'rotate'
98
+ export type TransformMode = 'move' | 'zoom' | 'rotate'
99
+
100
+
101
+ export interface IMultiTouchData {
102
+ move: IPointData,
103
+ scale: number,
104
+ angle: number,
105
+ center: IPointData
106
+ }
107
+
108
+ export interface IKeepTouchData {
109
+ from: IPointData
110
+ to: IPointData
111
+ }
@@ -2,6 +2,8 @@ import { IObject } from '../data/IData'
2
2
  import { ILeafList } from '../data/IList'
3
3
  import { IEvent } from './IEvent'
4
4
  import { ILeaferImage } from '../image/ILeaferImage'
5
+ import { ILeaf } from '../display/ILeaf'
6
+ import { IPointData } from '../math/IMath'
5
7
 
6
8
  export interface IUIEvent extends IEvent {
7
9
  x: number
@@ -22,6 +24,9 @@ export interface IUIEvent extends IEvent {
22
24
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
23
25
 
24
26
  origin?: IObject
27
+
28
+ getInner?(target?: ILeaf): IPointData
29
+ getLocal?(target?: ILeaf): IPointData
25
30
  }
26
31
 
27
32
 
@@ -42,6 +47,9 @@ export interface IDragEvent extends IPointerEvent {
42
47
  moveY: number
43
48
  totalX: number
44
49
  totalY: number
50
+
51
+ getInnerMove?(target?: ILeaf): IPointData
52
+ getLocalMove?(target?: ILeaf): IPointData
45
53
  }
46
54
 
47
55
  export interface IDropEvent extends IPointerEvent {
package/src/index.ts CHANGED
@@ -30,7 +30,7 @@ export { ITaskProcessor, ITaskProcessorConfig } from './task/ITaskProcessor'
30
30
 
31
31
 
32
32
  export { IControl } from './control/IControl'
33
- export { IPlatform } from './platform/IPlatform'
33
+ export { IPlatform, IMiniapp, IMiniappSelect, IMiniappSizeView } from './platform/IPlatform'
34
34
  export { IPlugin } from './plugin/IPlugin'
35
35
 
36
36
 
@@ -44,7 +44,7 @@ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnE
44
44
  export { IExportFileType, IExportImageType } from './file/IFileType'
45
45
 
46
46
  export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
47
- export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
47
+ export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode, IMultiTouchData, IKeepTouchData } from './event/IEvent'
48
48
  export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
49
49
  export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
50
50
 
@@ -6,6 +6,8 @@ import { IPointData } from '../math/IMath'
6
6
  import { ISelector } from '../selector/ISelector'
7
7
  import { IBounds } from '../math/IMath'
8
8
  import { IControl } from '../control/IControl'
9
+ import { IKeepTouchData } from '../event/IEvent'
10
+ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
9
11
 
10
12
  export interface IInteraction extends IControl {
11
13
  target: ILeaf
@@ -23,12 +25,16 @@ export interface IInteraction extends IControl {
23
25
  downData: IPointerEvent
24
26
  downTime: number
25
27
 
28
+ receive(event: any): void
29
+
26
30
  pointerDown(data: IPointerEvent): void
27
31
  pointerMove(data: IPointerEvent): void
28
32
  pointerMoveReal(data: IPointerEvent): void
29
33
  pointerUp(data: IPointerEvent): void
30
34
  pointerCancel(): void
31
35
 
36
+ multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
37
+
32
38
  move(data: IMoveEvent): void
33
39
  zoom(data: IZoomEvent): void
34
40
  rotate(data: IRotateEvent): void
@@ -36,9 +42,8 @@ export interface IInteraction extends IControl {
36
42
  emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
37
43
  }
38
44
 
39
- export interface IInteractionCanvas {
40
- bounds: IBounds
41
- view: unknown
45
+ export interface IInteractionCanvas extends ILeaferCanvas {
46
+
42
47
  }
43
48
 
44
49
  export interface IInteractionConfig {
@@ -2,6 +2,8 @@ import { IFunction } 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'
5
+ import { IBoundsData, ISizeData } from '../math/IMath'
6
+ import { IObject } from '../data/IData'
5
7
 
6
8
  export interface IPlatform {
7
9
  name?: 'web' | 'node' | 'miniapp'
@@ -22,5 +24,22 @@ export interface IPlatform {
22
24
  canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
23
25
  canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
24
26
  loadImage(url: string): Promise<any>
25
- }
27
+ },
28
+ miniapp?: IMiniapp
29
+ }
30
+
31
+
32
+ export interface IMiniappSelect extends IObject { }
33
+
34
+ export interface IMiniappSizeView extends ISizeData {
35
+ view: any
36
+ }
37
+
38
+ export interface IMiniapp {
39
+ select(name: string): IMiniappSelect
40
+ getBounds(select: IMiniappSelect): Promise<IBoundsData>
41
+ getSizeView(select: IMiniappSelect): Promise<IMiniappSizeView>
42
+ onWindowResize(fun: IFunction): void
43
+ offWindowResize(fun: IFunction): void
44
+ saveToAlbum(path: string): Promise<any>
26
45
  }
@@ -1,3 +1,4 @@
1
+ import { ILeafer } from '../app/ILeafer'
1
2
  import { IObject } from '../data/IData'
2
3
 
3
4
  export interface IPlugin extends IObject {
@@ -5,4 +6,5 @@ export interface IPlugin extends IObject {
5
6
  importVersion: string
6
7
  import: string[]
7
8
  run(LeaferUI: IObject, config: IObject): void
9
+ onLeafer?(leafer: ILeafer): void
8
10
  }