@leafer-ui/interface 1.9.6 → 1.9.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-ui/interface",
3
- "version": "1.9.6",
3
+ "version": "1.9.8",
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.9.6"
25
+ "@leafer/interface": "1.9.8"
26
26
  }
27
27
  }
@@ -2,7 +2,9 @@ import { ILeaferCanvas, IBoundsData, ICachedLeaf } from '@leafer/interface'
2
2
 
3
3
  export interface ICachedShape extends ICachedLeaf {
4
4
  worldCanvas?: ILeaferCanvas // 元素太大放不下,经过裁剪后的元素区域缓存画布
5
- shapeBounds: IBoundsData
5
+ shapeBounds: IBoundsData // 形状内容的包围盒,可能缩小了,但未进行偏移
6
+ // bounds: IBoundsData // 形状内容的包围盒,可能会缩小、偏移至原点
7
+ renderBounds: IBoundsData // 渲染内容的包围盒,可能会缩小、偏移至原点
6
8
  scaleX: number
7
9
  scaleY: number
8
10
  }
@@ -1,12 +1,13 @@
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, ILeafer } 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, IKeyEvent, IUIInputData, IZoomEvent, IColorString, IDirection4, IPointData, IScaleData, ISkewData, ILayoutBoundsData, ITransition, IFourNumber, IShortcutKeys, IShortcutKeysCheck, IUIEvent, ILeafer } from '@leafer-ui/interface'
2
2
 
3
3
  export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
4
4
  config: IEditorConfig
5
5
  readonly mergeConfig: IEditorConfig // 实际使用,合并了选中元素、默认editBox上的editConfig,频繁访问会消耗性能
6
6
  readonly mergedConfig: IEditorConfig // 合并之后的缓存配置
7
7
 
8
- hoverTarget?: IUI
9
8
  target?: IUI | IUI[]
9
+ hoverTarget?: IUI
10
+ dimTarget?: IGroup | IGroup[] // 需要淡化的容器
10
11
 
11
12
  readonly list: IUI[]
12
13
  leafList: ILeafList
@@ -48,6 +49,9 @@ export interface IEditorBase extends IGroup, ISelectorProxy, ITransformTool {
48
49
  addItem(item: IUI): void
49
50
  removeItem(item: IUI): void
50
51
 
52
+ setDimOthers(value: boolean | number): void
53
+ setBright(value: boolean): void
54
+
51
55
  update(): void
52
56
  updateEditBox(): void
53
57
  updateEditTool(): void
@@ -101,10 +105,14 @@ export interface IEditorConfig extends IObject {
101
105
 
102
106
  point?: IEditPointInputData | IEditPointInputData[]
103
107
  middlePoint?: IEditPointInputData | IEditPointInputData[]
108
+ resizeLine?: IEditPointInputData
104
109
 
105
110
  rect?: IBoxInputData
106
111
  area?: IRectInputData
112
+
107
113
  mask?: boolean | IColorString
114
+ dimOthers?: boolean | number // 是否弱化其他内容,突出显示选中元素
115
+ bright?: boolean // 仅突出显示选中元素
108
116
 
109
117
  circle?: IEditPointInputData
110
118
  circleDirection?: IDirection4
@@ -136,6 +144,7 @@ export interface IEditorConfig extends IObject {
136
144
  hover?: boolean
137
145
  hoverStyle?: IUIInputData
138
146
  select?: 'press' | 'tap'
147
+ selectKeep?: boolean
139
148
  selectedStyle?: IUIInputData
140
149
  multipleSelect?: boolean
141
150
 
@@ -151,6 +160,7 @@ export interface IEditorConfig extends IObject {
151
160
 
152
161
  multipleSelectKey?: IShortcutKeysCheck | IShortcutKeys
153
162
  rotateKey?: IShortcutKeysCheck | IShortcutKeys
163
+ diagonalRotateKey?: IShortcutKeysCheck | IShortcutKeys // 对角旋转的快捷键
154
164
 
155
165
  beforeSelect?: IEditorBeforeSelect
156
166
  beforeEditOuter?: IEditorBeforeEditOuter
@@ -236,7 +246,7 @@ export interface IEditPoint extends IBox {
236
246
  pointType: IEditPointType
237
247
  }
238
248
 
239
- export type IEditPointType = 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button'
249
+ export type IEditPointType = 'move' | 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button'
240
250
 
241
251
  export interface IEditBoxBase extends IGroup {
242
252
 
@@ -253,7 +263,7 @@ export interface IEditBoxBase extends IGroup {
253
263
  view: IGroup // 放置默认编辑工具控制点
254
264
 
255
265
  circle: IEditPoint
256
- rect: IRect
266
+ rect: IEditPoint
257
267
 
258
268
  buttons: IGroup
259
269
 
@@ -300,9 +310,10 @@ export interface IEditBoxBase extends IGroup {
300
310
  export interface IEditorDragStartData {
301
311
  x: number
302
312
  y: number
303
- point: IPointData
304
- bounds: ILayoutBoundsData
305
- rotation: number
313
+ totalOffset: IPointData // 缩放、旋转造成的总偏移量,一般用于手势操作的move纠正
314
+ point: IPointData // 用于移动
315
+ bounds: ILayoutBoundsData // 用于resize
316
+ rotation: number // 用于旋转
306
317
  }
307
318
 
308
319
  export interface IEditorConfigFunction {
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IBoundsData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IFourNumber, IBoundsData, IMatrixData } from '@leafer/interface'
2
2
 
3
3
  import { IUI } from '../IUI'
4
4
  import { ICachedShape } from '../ICachedShape'
@@ -12,7 +12,9 @@ export interface IEffectModule {
12
12
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void
13
13
 
14
14
  // shadow
15
- getShadowSpread(ui: IUI, shadow: ILeafShadowEffect[]): number
15
+ getShadowRenderSpread(ui: IUI, shadow: ILeafShadowEffect[], spreadSign?: 1 | -1): IFourNumber
16
+ getShadowTransform(ui: IUI, canvas: ILeaferCanvas, shape: ICachedShape, shadow: ILeafShadowEffect, outBounds: IBoundsData, otherScale: number, isInnerShaodw?: boolean): IMatrixData
16
17
  isTransformShadow(shadow: ILeafShadowEffect): boolean
17
- renderTransformShadow?(ui: IUI, current: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld: IBoundsData, shadow: ILeafShadowEffect): void
18
+
19
+ getInnerShadowSpread(ui: IUI, innerShadow: ILeafShadowEffect[]): IFourNumber
18
20
  }
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAlign, IPointData, IMatrixData, ISizeData } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IBooleanMap, IBoundsData, ILeaferImage, IAlign, IPointData, IMatrixData } from '@leafer/interface'
2
2
 
3
3
  import { ILeafPaint, ILeafPaintPatternData } from '../type/IComputedType'
4
4
  import { IUI, IUIData } from '../IUI'
@@ -35,7 +35,7 @@ export interface IPaintImageModule {
35
35
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void
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
- clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipSize?: ISizeData): void
38
+ clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipScaleX?: number, clipScaleY?: number): void
39
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
 
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IBlendMode, IAlign, IUnitPointData, IExportFileType, IFourNumber, IPointData, IOptionSizeData, ISizeData, IGap, IPointGap, IScaleFixed, IPathCommandData, IAxis, IAxisReverse, IDirection, IWindingRule, IFilter, IMatrixData, ILeaferImage, ITaskItem, INumber, IString, IBoolean, IUnitData, IAnimateOptions, IAnimateEasing, IEventer, IObject, IEventParamsMap, IAnimateEasingFunction, IAnimateEnding, ITransition, IPercentData, IBounds, 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, 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, ILeafer as ILeafer$1, 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, ILayoutBoundsData, IKeyEvent, IUIEvent, IDragEvent, IMoveEvent, IZoomEvent, IRotateEvent, ITransition as ITransition$1, ILeafList, ILeafer as ILeafer$1, 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;
@@ -422,8 +422,9 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
422
422
  config: IEditorConfig;
423
423
  readonly mergeConfig: IEditorConfig;
424
424
  readonly mergedConfig: IEditorConfig;
425
- hoverTarget?: IUI$1;
426
425
  target?: IUI$1 | IUI$1[];
426
+ hoverTarget?: IUI$1;
427
+ dimTarget?: IGroup$1 | IGroup$1[];
427
428
  readonly list: IUI$1[];
428
429
  leafList: ILeafList;
429
430
  openedGroupList: ILeafList;
@@ -453,6 +454,8 @@ interface IEditorBase extends IGroup$1, ISelectorProxy, ITransformTool {
453
454
  shiftItem(item: IUI$1): void;
454
455
  addItem(item: IUI$1): void;
455
456
  removeItem(item: IUI$1): void;
457
+ setDimOthers(value: boolean | number): void;
458
+ setBright(value: boolean): void;
456
459
  update(): void;
457
460
  updateEditBox(): void;
458
461
  updateEditTool(): void;
@@ -492,9 +495,12 @@ interface IEditorConfig extends IObject$1 {
492
495
  pointRadius?: number;
493
496
  point?: IEditPointInputData | IEditPointInputData[];
494
497
  middlePoint?: IEditPointInputData | IEditPointInputData[];
498
+ resizeLine?: IEditPointInputData;
495
499
  rect?: IBoxInputData$1;
496
500
  area?: IRectInputData$1;
497
501
  mask?: boolean | IColorString$1;
502
+ dimOthers?: boolean | number;
503
+ bright?: boolean;
498
504
  circle?: IEditPointInputData;
499
505
  circleDirection?: IDirection4;
500
506
  circleMargin?: number;
@@ -520,6 +526,7 @@ interface IEditorConfig extends IObject$1 {
520
526
  hover?: boolean;
521
527
  hoverStyle?: IUIInputData$1;
522
528
  select?: 'press' | 'tap';
529
+ selectKeep?: boolean;
523
530
  selectedStyle?: IUIInputData$1;
524
531
  multipleSelect?: boolean;
525
532
  boxSelect?: boolean;
@@ -532,6 +539,7 @@ interface IEditorConfig extends IObject$1 {
532
539
  skewable?: boolean;
533
540
  multipleSelectKey?: IShortcutKeysCheck | IShortcutKeys;
534
541
  rotateKey?: IShortcutKeysCheck | IShortcutKeys;
542
+ diagonalRotateKey?: IShortcutKeysCheck | IShortcutKeys;
535
543
  beforeSelect?: IEditorBeforeSelect;
536
544
  beforeEditOuter?: IEditorBeforeEditOuter;
537
545
  beforeEditInner?: IEditorBeforeEditInner;
@@ -596,7 +604,7 @@ interface IEditPoint extends IBox$1 {
596
604
  direction: number;
597
605
  pointType: IEditPointType;
598
606
  }
599
- type IEditPointType = 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button';
607
+ type IEditPointType = 'move' | 'resize' | 'rotate' | 'skew' | 'resize-rotate' | 'button';
600
608
  interface IEditBoxBase extends IGroup$1 {
601
609
  editor: IEditorBase;
602
610
  dragging: boolean;
@@ -607,7 +615,7 @@ interface IEditBoxBase extends IGroup$1 {
607
615
  skewing: boolean;
608
616
  view: IGroup$1;
609
617
  circle: IEditPoint;
610
- rect: IRect$1;
618
+ rect: IEditPoint;
611
619
  buttons: IGroup$1;
612
620
  resizePoints: IEditPoint[];
613
621
  rotatePoints: IEditPoint[];
@@ -639,6 +647,7 @@ interface IEditBoxBase extends IGroup$1 {
639
647
  interface IEditorDragStartData {
640
648
  x: number;
641
649
  y: number;
650
+ totalOffset: IPointData$1;
642
651
  point: IPointData$1;
643
652
  bounds: ILayoutBoundsData;
644
653
  rotation: number;
@@ -1206,6 +1215,7 @@ interface IStateModule {
1206
1215
  interface ICachedShape extends ICachedLeaf {
1207
1216
  worldCanvas?: ILeaferCanvas;
1208
1217
  shapeBounds: IBoundsData;
1218
+ renderBounds: IBoundsData;
1209
1219
  scaleX: number;
1210
1220
  scaleY: number;
1211
1221
  }
@@ -1231,7 +1241,7 @@ interface IPaintImageModule {
1231
1241
  createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void;
1232
1242
  getPatternData(paint: IImagePaint, box: IBoundsData, image: ILeaferImage): ILeafPaintPatternData;
1233
1243
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
1234
- clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipSize?: ISizeData): void;
1244
+ clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipScaleX?: number, clipScaleY?: number): void;
1235
1245
  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;
1236
1246
  }
1237
1247
  interface IPaintGradientModule {
@@ -1246,9 +1256,10 @@ interface IEffectModule {
1246
1256
  innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
1247
1257
  blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void;
1248
1258
  backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void;
1249
- getShadowSpread(ui: IUI, shadow: ILeafShadowEffect[]): number;
1259
+ getShadowRenderSpread(ui: IUI, shadow: ILeafShadowEffect[], spreadSign?: 1 | -1): IFourNumber;
1260
+ getShadowTransform(ui: IUI, canvas: ILeaferCanvas, shape: ICachedShape, shadow: ILeafShadowEffect, outBounds: IBoundsData, otherScale: number, isInnerShaodw?: boolean): IMatrixData;
1250
1261
  isTransformShadow(shadow: ILeafShadowEffect): boolean;
1251
- renderTransformShadow?(ui: IUI, current: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld: IBoundsData, shadow: ILeafShadowEffect): void;
1262
+ getInnerShadowSpread(ui: IUI, innerShadow: ILeafShadowEffect[]): IFourNumber;
1252
1263
  }
1253
1264
 
1254
1265
  interface IFilterModule {