@leafer-ui/interface 1.8.0 → 1.9.1

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-ui/interface",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "@leafer-ui/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/interface": "1.8.0"
25
+ "@leafer/interface": "1.9.1"
26
26
  }
27
27
  }
@@ -1,7 +1,7 @@
1
1
  import { ILeaferCanvas, IBoundsData, ICachedLeaf } from '@leafer/interface'
2
2
 
3
3
  export interface ICachedShape extends ICachedLeaf {
4
- worldCanvas?: ILeaferCanvas
4
+ worldCanvas?: ILeaferCanvas // 元素太大放不下,经过裁剪后的元素区域缓存画布
5
5
  shapeBounds: IBoundsData
6
6
  scaleX: number
7
7
  scaleY: number
@@ -1,4 +1,4 @@
1
- import { INumber, IBoolean, IString, IFourNumber, IUnitData } from '@leafer/interface'
1
+ import { INumber, IBoolean, IString, IFourNumber, IUnitData, IScaleFixed } from '@leafer/interface'
2
2
  import { IStrokeAlign, IStrokeCap, IStrokeJoin, IBlurEffect, IFontWeight, ITextCase, ITextDecoration, IShadowEffect, IGrayscaleEffect, ITextAlign, IVerticalAlign, IOverflow, ITextWrap, IStroke, IFill, IArrowType, IWritingMode } from './type/IType'
3
3
  import { ILeafStrokePaint, ILeafShadowEffect, ILeafPaint } from './type/IComputedType'
4
4
  import { IDashPatternString, IShadowString, IColorString, IStrokeWidthString, ICornerRadiusString } from './type/IStringType'
@@ -53,7 +53,7 @@ export interface IStrokeInputData extends IStrokeStyle {
53
53
  export interface IStrokeStyle {
54
54
  strokeAlign?: IStrokeAlign
55
55
  strokeWidth?: IFourNumber | IStrokeWidthString
56
- strokeWidthFixed?: IBoolean
56
+ strokeWidthFixed?: IScaleFixed
57
57
  strokeCap?: IStrokeCap
58
58
  strokeJoin?: IStrokeJoin
59
59
  dashPattern?: INumber[] | IDashPatternString
@@ -72,7 +72,7 @@ export interface IStrokeComputedStyle {
72
72
  strokeAlign?: IStrokeAlign
73
73
  strokeWidth?: number
74
74
  strokeWidths?: number[]
75
- strokeWidthFixed?: boolean
75
+ strokeWidthFixed?: IScaleFixed
76
76
  strokeCap?: IStrokeCap
77
77
  strokeJoin?: IStrokeJoin
78
78
  dashPattern?: number[]
@@ -1,4 +1,4 @@
1
- import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IMoveEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IKeyEvent, IUIInputData, IZoomEvent, IColorString, IDirection4, IPointData, IScaleData, ISkewData, ILayoutBoundsData, ITransition, IFourNumber } from '@leafer-ui/interface'
1
+ import { IGroup, IUI, IBox, IRectInputData, ISelectorProxy, IEditSize, ICursorType, IAlign, IUnitPointData, IDragEvent, IMoveEvent, IRotateEvent, IStroke, IFill, ILeaf, ILeafList, IObject, IBoxInputData, IGroupInputData, IImageCursor, IRect, IKeyEvent, IUIInputData, IZoomEvent, IColorString, IDirection4, IPointData, IScaleData, ISkewData, ILayoutBoundsData, ITransition, IFourNumber, IShortcutKeys, IShortcutKeysCheck, IUIEvent } from '@leafer-ui/interface'
2
2
 
3
3
  export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
4
4
  config: IEditorConfig
@@ -115,6 +115,8 @@ export interface IEditorConfig extends IObject {
115
115
 
116
116
  hideOnMove?: boolean
117
117
  hideOnSmall?: boolean | number
118
+ hideRotatePoints?: boolean // 是否隐藏透明的旋转控制点
119
+ hideResizeLines?: boolean // 是否隐藏透明的resize线条
118
120
 
119
121
  moveCursor?: ICursorType
120
122
  resizeCursor?: IImageCursor
@@ -125,6 +127,7 @@ export interface IEditorConfig extends IObject {
125
127
  rotateAround?: IAlign | IUnitPointData // 单独设置旋转围绕的中心点,比 around 优先级高
126
128
  rotateGap?: number
127
129
  lockRatio?: boolean | 'corner'
130
+ dragLimitAnimate?: boolean | number // 限制拖动范围的元素,可在拖拽结束时进行动画归位,默认采用 app.config.pointer.dragLimitAnimate 的值
128
131
 
129
132
  selector?: boolean
130
133
  editBox?: boolean
@@ -133,6 +136,7 @@ export interface IEditorConfig extends IObject {
133
136
  select?: 'press' | 'tap'
134
137
  selectedStyle?: IUIInputData
135
138
  multipleSelect?: boolean
139
+
136
140
  boxSelect?: boolean
137
141
  continuousSelect?: boolean // 点击可以连续选择
138
142
  openInner?: 'double' | 'long' // 双击/长按打开内部
@@ -143,6 +147,9 @@ export interface IEditorConfig extends IObject {
143
147
  rotateable?: boolean | 'gesture' | 'rotate'
144
148
  skewable?: boolean
145
149
 
150
+ multipleSelectKey?: IShortcutKeysCheck | IShortcutKeys
151
+ rotateKey?: IShortcutKeysCheck | IShortcutKeys
152
+
146
153
  beforeSelect?: IEditorBeforeSelect
147
154
  beforeMove?: IEditorBeforeMove
148
155
  beforeScale?: IEditorBeforeScale
@@ -265,6 +272,7 @@ export interface IEditBoxBase extends IGroup {
265
272
  unload(): void
266
273
 
267
274
  onArrow(e: IKeyEvent): void
275
+ isHoldRotateKey(e: IUIEvent): boolean
268
276
 
269
277
  }
270
278
 
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAround, IPointData, IMatrixData, ISizeData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAlign, IPointData, IMatrixData, ISizeData } from '@leafer/interface'
2
2
 
3
3
  import { ILeafPaint, ILeafPaintPatternData } from '../type/IComputedType'
4
4
  import { IUI, IUIData } from '../IUI'
@@ -36,7 +36,7 @@ export interface IPaintImageModule {
36
36
  getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData
37
37
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void
38
38
  clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipSize?: ISizeData): void
39
- repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void
39
+ repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, align: IAlign, freeTransform?: boolean): void
40
40
  }
41
41
 
42
42
  export interface IPaintGradientModule {
@@ -1,4 +1,4 @@
1
- import { IBlendMode, ILeaferImage, IMatrixData, ITaskItem } from '@leafer/interface'
1
+ import { IBlendMode, ILeaferImage, IMatrixData, IPointData, IScaleFixed, ITaskItem } from '@leafer/interface'
2
2
 
3
3
  import { IColorString } from './IStringType'
4
4
  import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode, IImageFilters } from './IType'
@@ -22,7 +22,7 @@ export interface ILeafPaint {
22
22
  isTransparent?: boolean // 是否为透明色
23
23
  data?: ILeafPaintPatternData
24
24
  editing?: boolean // 标记编辑中
25
- scaleFixed?: boolean // 平铺图片不跟随画布缩放
25
+ scaleFixed?: IScaleFixed // 平铺图片不跟随画布缩放
26
26
  }
27
27
 
28
28
  export interface ILeafPaintPatternData {
@@ -30,6 +30,7 @@ export interface ILeafPaintPatternData {
30
30
  height?: number
31
31
  scaleX?: number
32
32
  scaleY?: number
33
+ gap?: IPointData
33
34
  opacity?: number
34
35
  transform?: IMatrixData
35
36
  filters?: IImageFilters
@@ -56,4 +57,5 @@ export interface ILeafShadowEffect {
56
57
  color: IColorString
57
58
  blendMode?: IBlendMode
58
59
  box?: boolean
60
+ scaleFixed?: IScaleFixed
59
61
  }
package/src/type/IType.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, IFourNumber, IAlign, IUnitPointData, IAxis, IAxisReverse, IFilter, IOptionSizeData, ISizeData } from '@leafer/interface'
1
+ import { IPointData, IPathCommandData, IWindingRule, IBlendMode, IExportFileType, IFourNumber, IAlign, IUnitPointData, IAxis, IAxisReverse, IFilter, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed } from '@leafer/interface'
2
2
  import { IColorString, IPaintString } from './IStringType'
3
3
  import { IStrokeStyle } from '../ICommonAttr'
4
4
 
@@ -88,10 +88,13 @@ export interface IImagePaint extends IPaintBase {
88
88
  rotation?: number
89
89
  skew?: | IPointData
90
90
 
91
+ freeTransform?: boolean // 平铺模式下是否进行自由变换,默认90度、缩放会进行特殊处理
92
+
91
93
  clipSize?: ISizeData
92
94
 
93
95
  repeat?: IRepeat
94
- scaleFixed?: boolean // 平铺图片不跟随画布缩放
96
+ gap?: IGap | IPointGap
97
+ scaleFixed?: IScaleFixed // 平铺图片不跟随画布缩放
95
98
 
96
99
  changeful?: boolean // 会频繁变化,不生成图案(有特殊性能优化,一般用于游戏精灵、动图场景)
97
100
  sync?: boolean // 同步显示,不走任务列表生成图案
@@ -109,7 +112,7 @@ export interface IImageFilters {
109
112
  shadows?: number // 阴影
110
113
  }
111
114
  export type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat'
112
- export type IRepeat = boolean | 'x' | 'y'
115
+ export type IRepeat = boolean | 'x' | 'y' | IPointData
113
116
 
114
117
  // 描边
115
118
  export type IStrokeAlign = 'inside' | 'outside' | 'center'
@@ -179,6 +182,7 @@ export interface IShadowEffect {
179
182
  blendMode?: IBlendMode
180
183
  visible?: boolean
181
184
  box?: boolean
185
+ scaleFixed?: IScaleFixed
182
186
  }
183
187
 
184
188
  export interface IBlurEffect {
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IPathCommandData, IAxis, IAxisReverse, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, IBoolean, INumber, IString, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventParamsMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, ILeafInputData, ILeaf as ILeaf$1, ILeafComputedData, ILeafData, IBoundsData, IValue, IPathCreator, IJSONOptions, IFindCondition, IAnswer, IPathString, IPathDrawer, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPickOptions, IPickResult, ICanvasContext2DSettings, ICanvasContext2D, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IAround, IMatrixWithBoundsScaleData } from '@leafer/interface';
1
+ import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IPathCommandData, IAxis, IAxisReverse, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, INumber, IString, IBoolean, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventParamsMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, ILeafInputData, ILeaf as ILeaf$1, ILeafComputedData, ILeafData, IBoundsData, IValue, IPathCreator, IJSONOptions, IFindCondition, IAnswer, IPathString, IPathDrawer, ILeaferCanvas, IRenderOptions, IExportOptions, IExportResult, IPickOptions, IPickResult, ICanvasContext2DSettings, ICanvasContext2D, ILeaferAttrData, IControl, ILeaferType, ILeaferConfig, ILeafRender, ILeafBounds, ILeafHit, ICachedLeaf, IBooleanMap, IMatrixWithBoundsScaleData } from '@leafer/interface';
2
2
  export * from '@leafer/interface';
3
- import { IObject as IObject$1, IEditSize, IStroke as IStroke$1, IFourNumber as IFourNumber$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IUI as IUI$1, IPointData as IPointData$1, IScaleData, ISkewData, IGroup as IGroup$1, ISelectorProxy, IBox as IBox$1, IRect as IRect$1, ILayoutBoundsData, IKeyEvent, IDragEvent, IMoveEvent, IZoomEvent, IRotateEvent, ITransition as ITransition$1, ILeafList, ILeaf, IGroupInputData as IGroupInputData$1, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
3
+ import { IObject as IObject$1, IEditSize, IStroke as IStroke$1, IFourNumber as IFourNumber$1, IFill as IFill$1, IBoxInputData as IBoxInputData$1, IRectInputData as IRectInputData$1, IColorString as IColorString$1, IDirection4, ICursorType, IImageCursor, IAlign as IAlign$1, IUnitPointData as IUnitPointData$1, IUIInputData as IUIInputData$1, IShortcutKeysCheck, IShortcutKeys, IUI as IUI$1, IPointData as IPointData$1, IScaleData, ISkewData, IGroup as IGroup$1, ISelectorProxy, IBox as IBox$1, IRect as IRect$1, ILayoutBoundsData, IKeyEvent, IUIEvent, IDragEvent, IMoveEvent, IZoomEvent, IRotateEvent, ITransition as ITransition$1, ILeafList, ILeaf, IGroupInputData as IGroupInputData$1, IStateName as IStateName$1, IString as IString$1, IBoolean as IBoolean$1, IStateStyle as IStateStyle$1 } from '@leafer-ui/interface';
4
4
 
5
5
  type IPercent = string;
6
6
  type IColorString = string;
@@ -70,9 +70,11 @@ interface IImagePaint extends IPaintBase {
70
70
  scale?: number | IPointData;
71
71
  rotation?: number;
72
72
  skew?: IPointData;
73
+ freeTransform?: boolean;
73
74
  clipSize?: ISizeData;
74
75
  repeat?: IRepeat;
75
- scaleFixed?: boolean;
76
+ gap?: IGap | IPointGap;
77
+ scaleFixed?: IScaleFixed;
76
78
  changeful?: boolean;
77
79
  sync?: boolean;
78
80
  showProgress?: boolean;
@@ -89,7 +91,7 @@ interface IImageFilters {
89
91
  shadows?: number;
90
92
  }
91
93
  type IImagePaintMode = 'normal' | 'cover' | 'fit' | 'stretch' | 'clip' | 'repeat';
92
- type IRepeat = boolean | 'x' | 'y';
94
+ type IRepeat = boolean | 'x' | 'y' | IPointData;
93
95
  type IStrokeAlign = 'inside' | 'outside' | 'center';
94
96
  type IStrokeCap = 'none' | 'round' | 'square';
95
97
  type IStrokeJoin = 'bevel' | 'round' | 'miter';
@@ -135,6 +137,7 @@ interface IShadowEffect {
135
137
  blendMode?: IBlendMode;
136
138
  visible?: boolean;
137
139
  box?: boolean;
140
+ scaleFixed?: IScaleFixed;
138
141
  }
139
142
  interface IBlurEffect {
140
143
  blur: number;
@@ -164,13 +167,14 @@ interface ILeafPaint {
164
167
  isTransparent?: boolean;
165
168
  data?: ILeafPaintPatternData;
166
169
  editing?: boolean;
167
- scaleFixed?: boolean;
170
+ scaleFixed?: IScaleFixed;
168
171
  }
169
172
  interface ILeafPaintPatternData {
170
173
  width?: number;
171
174
  height?: number;
172
175
  scaleX?: number;
173
176
  scaleY?: number;
177
+ gap?: IPointData;
174
178
  opacity?: number;
175
179
  transform?: IMatrixData;
176
180
  filters?: IImageFilters;
@@ -194,6 +198,7 @@ interface ILeafShadowEffect {
194
198
  color: IColorString;
195
199
  blendMode?: IBlendMode;
196
200
  box?: boolean;
201
+ scaleFixed?: IScaleFixed;
197
202
  }
198
203
 
199
204
  interface ICornerRadiusAttrData {
@@ -234,7 +239,7 @@ interface IStrokeInputData extends IStrokeStyle {
234
239
  interface IStrokeStyle {
235
240
  strokeAlign?: IStrokeAlign;
236
241
  strokeWidth?: IFourNumber | IStrokeWidthString;
237
- strokeWidthFixed?: IBoolean;
242
+ strokeWidthFixed?: IScaleFixed;
238
243
  strokeCap?: IStrokeCap;
239
244
  strokeJoin?: IStrokeJoin;
240
245
  dashPattern?: INumber[] | IDashPatternString;
@@ -250,7 +255,7 @@ interface IStrokeComputedStyle {
250
255
  strokeAlign?: IStrokeAlign;
251
256
  strokeWidth?: number;
252
257
  strokeWidths?: number[];
253
- strokeWidthFixed?: boolean;
258
+ strokeWidthFixed?: IScaleFixed;
254
259
  strokeCap?: IStrokeCap;
255
260
  strokeJoin?: IStrokeJoin;
256
261
  dashPattern?: number[];
@@ -483,6 +488,8 @@ interface IEditorConfig extends IObject$1 {
483
488
  buttonsMargin?: number;
484
489
  hideOnMove?: boolean;
485
490
  hideOnSmall?: boolean | number;
491
+ hideRotatePoints?: boolean;
492
+ hideResizeLines?: boolean;
486
493
  moveCursor?: ICursorType;
487
494
  resizeCursor?: IImageCursor;
488
495
  rotateCursor?: IImageCursor;
@@ -491,6 +498,7 @@ interface IEditorConfig extends IObject$1 {
491
498
  rotateAround?: IAlign$1 | IUnitPointData$1;
492
499
  rotateGap?: number;
493
500
  lockRatio?: boolean | 'corner';
501
+ dragLimitAnimate?: boolean | number;
494
502
  selector?: boolean;
495
503
  editBox?: boolean;
496
504
  hover?: boolean;
@@ -506,6 +514,8 @@ interface IEditorConfig extends IObject$1 {
506
514
  flipable?: boolean;
507
515
  rotateable?: boolean | 'gesture' | 'rotate';
508
516
  skewable?: boolean;
517
+ multipleSelectKey?: IShortcutKeysCheck | IShortcutKeys;
518
+ rotateKey?: IShortcutKeysCheck | IShortcutKeys;
509
519
  beforeSelect?: IEditorBeforeSelect;
510
520
  beforeMove?: IEditorBeforeMove;
511
521
  beforeScale?: IEditorBeforeScale;
@@ -595,6 +605,7 @@ interface IEditBoxBase extends IGroup$1 {
595
605
  update(): void;
596
606
  unload(): void;
597
607
  onArrow(e: IKeyEvent): void;
608
+ isHoldRotateKey(e: IUIEvent): boolean;
598
609
  }
599
610
  interface IEditorDragStartData {
600
611
  x: number;
@@ -1158,7 +1169,7 @@ interface IPaintImageModule {
1158
1169
  getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData;
1159
1170
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
1160
1171
  clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipSize?: ISizeData): void;
1161
- repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, around: IAround): void;
1172
+ repeatMode(data: ILeafPaintPatternData, box: IBoundsData, width: number, height: number, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, align: IAlign, freeTransform?: boolean): void;
1162
1173
  }
1163
1174
  interface IPaintGradientModule {
1164
1175
  linearGradient(paint: IGradientPaint, box: IBoundsData): ILeafPaint;