@leafer-ui/interface 2.1.4 → 2.1.5

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": "2.1.4",
3
+ "version": "2.1.5",
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": "2.1.4"
25
+ "@leafer/interface": "2.1.5"
26
26
  }
27
27
  }
package/src/IUI.ts CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  ITextStyleAttrData, ITextStyleInputData, ITextStyleComputedData,
10
10
  IStrokeComputedStyle
11
11
  } from './ICommonAttr'
12
- import { IFill, IOverflow } from './type/IType'
12
+ import { IFill, IOverflow, IPaintAttr } from './type/IType'
13
13
  import { IAnimation, IAnimate, IKeyframe, IKeyframeId, IAnimateType } from './IAnimation'
14
14
  import { ILeafer } from './app/ILeafer'
15
15
  import { IEditorConfig } from './editor/IEditor'
@@ -634,8 +634,8 @@ export interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
634
634
 
635
635
  __checkComplex(): void
636
636
 
637
- __setPaint(attrName: 'fill' | 'stroke', value: IValue): void
638
- __removePaint(attrName: 'fill' | 'stroke', removeInput?: boolean): void
637
+ __setPaint(attrName: IPaintAttr, value: IValue): void
638
+ __removePaint(attrName: IPaintAttr, removeInput?: boolean): void
639
639
  }
640
640
  export interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
641
641
 
@@ -15,7 +15,7 @@ export interface IPaintModule {
15
15
  fillPathOrText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
16
16
  fillText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
17
17
 
18
- stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
18
+ stroke(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
19
19
  strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
20
20
 
21
21
  fillStroke?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
@@ -29,7 +29,7 @@ export interface IPaintModule {
29
29
 
30
30
 
31
31
  export interface IPaintImageModule {
32
- image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint
32
+ image(ui: IUI, attrName: IPaintAttr, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint
33
33
 
34
34
  film?(paint: ILeafPaint): void
35
35
  video?(paint: ILeafPaint): void
@@ -55,7 +55,7 @@ export interface IPaintImageModule {
55
55
  clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipScaleX?: number, clipScaleY?: number): void
56
56
  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
57
57
 
58
- brush?(paint: ILeafPaint, ui: IUI): void
58
+ brush?(paint: ILeafPaint, ui: IUI, attrName: IPaintAttr): void
59
59
  addBrushScale?(scaleData: IScaleData, paint: ILeafPaint, ui: IUI): void
60
60
  getBrushScale?(paint: ILeafPaint, ui: IUI): number
61
61
  cacheBrush?(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void
@@ -1,7 +1,7 @@
1
1
  import { IBlendMode, IDirection, IFilmPlayOptions, IInterlace, ILeaferImage, IMatrixData, IPointData, IScaleFixed, ITaskItem, ILeaf, ILeaferCanvas } from '@leafer/interface'
2
2
 
3
3
  import { IColorString } from './IStringType'
4
- import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode, IPaint } from './IType'
4
+ import { IStrokeAlign, IStrokeJoin, IStrokeCap, IImagePaintMode, IPaint, IPaintAttr } from './IType'
5
5
  import { IPaintType } from './IType'
6
6
  import { IStrokeComputedStyle } from '../ICommonAttr'
7
7
 
@@ -33,6 +33,7 @@ export interface ILeafPaint extends IFilmPlayOptions {
33
33
  }
34
34
 
35
35
  export interface ILeafPaintBrush {
36
+ attrName: IPaintAttr
36
37
  cache?: ILeaferCanvas
37
38
  render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void
38
39
  destroy(): void
package/types/index.d.ts CHANGED
@@ -186,6 +186,7 @@ interface ILeafPaint extends IFilmPlayOptions {
186
186
  brush?: ILeafPaintBrush;
187
187
  }
188
188
  interface ILeafPaintBrush {
189
+ attrName: IPaintAttr;
189
190
  cache?: ILeaferCanvas;
190
191
  render(canvas: any, x: number, y: number, width: number, height: number, leaf: ILeaf, paint: any, imageScaleX: number, imageScaleY: number): void;
191
192
  destroy(): void;
@@ -1194,8 +1195,8 @@ interface IUIData extends IUIAttrData, IUIComputedData, ILeafData {
1194
1195
  __computePaint(): void;
1195
1196
  __getRealStrokeWidth(childStyle?: IStrokeComputedStyle): number;
1196
1197
  __checkComplex(): void;
1197
- __setPaint(attrName: 'fill' | 'stroke', value: IValue): void;
1198
- __removePaint(attrName: 'fill' | 'stroke', removeInput?: boolean): void;
1198
+ __setPaint(attrName: IPaintAttr, value: IValue): void;
1199
+ __removePaint(attrName: IPaintAttr, removeInput?: boolean): void;
1199
1200
  }
1200
1201
  interface IUIComputedData extends IUIAttrData, IFillComputedData, IBorderComputedData, IStrokeComputedData, ITextStyleComputedData, ICornerRadiusComputedData, IEffectComputedData, ILeafComputedData {
1201
1202
  }
@@ -1341,7 +1342,7 @@ interface IPaintModule {
1341
1342
  fills(fills: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1342
1343
  fillPathOrText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1343
1344
  fillText(ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1344
- stroke(stroke: string, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1345
+ stroke(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1345
1346
  strokes(strokes: ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1346
1347
  fillStroke?(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
1347
1348
  strokeText(stroke: string | ILeafPaint[], ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
@@ -1351,7 +1352,7 @@ interface IPaintModule {
1351
1352
  shape(ui: IUI, current: ILeaferCanvas, renderOptions: IRenderOptions): ICachedShape;
1352
1353
  }
1353
1354
  interface IPaintImageModule {
1354
- image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
1355
+ image(ui: IUI, attrName: IPaintAttr, paint: IImagePaint, boxBounds: IBoundsData, firstUse: boolean): ILeafPaint;
1355
1356
  film?(paint: ILeafPaint): void;
1356
1357
  video?(paint: ILeafPaint): void;
1357
1358
  checkImage(paint: ILeafPaint, allowDraw: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): boolean;
@@ -1369,7 +1370,7 @@ interface IPaintImageModule {
1369
1370
  fillOrFitMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number): void;
1370
1371
  clipMode(data: ILeafPaintPatternData, box: IBoundsData, x: number, y: number, scaleX: number, scaleY: number, rotation: number, skew: IPointData, clipScaleX?: number, clipScaleY?: number): void;
1371
1372
  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;
1372
- brush?(paint: ILeafPaint, ui: IUI): void;
1373
+ brush?(paint: ILeafPaint, ui: IUI, attrName: IPaintAttr): void;
1373
1374
  addBrushScale?(scaleData: IScaleData$1, paint: ILeafPaint, ui: IUI): void;
1374
1375
  getBrushScale?(paint: ILeafPaint, ui: IUI): number;
1375
1376
  cacheBrush?(paint: ILeafPaint, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;