@leafer-ui/display 1.0.0-rc.26 → 1.0.0-rc.28
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 +8 -8
- package/src/Canvas.ts +4 -7
- package/src/Group.ts +1 -1
- package/src/Leafer.ts +7 -4
- package/src/UI.ts +7 -2
- package/types/index.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.28",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.0-rc.
|
|
26
|
-
"@leafer-ui/data": "1.0.0-rc.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.0-rc.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.0-rc.
|
|
29
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer/core": "1.0.0-rc.28",
|
|
26
|
+
"@leafer-ui/data": "1.0.0-rc.28",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.0-rc.28",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.0-rc.28",
|
|
29
|
+
"@leafer-ui/external": "1.0.0-rc.28"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.0-rc.
|
|
33
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
32
|
+
"@leafer/interface": "1.0.0-rc.28",
|
|
33
|
+
"@leafer-ui/interface": "1.0.0-rc.28"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Canvas.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData, ISizeData
|
|
2
|
-
import { Creator, Matrix, Platform, dataProcessor, registerUI
|
|
1
|
+
import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData, ISizeData } from '@leafer/interface'
|
|
2
|
+
import { Creator, Matrix, Platform, dataProcessor, registerUI } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
|
|
5
5
|
import { CanvasData } from '@leafer-ui/data'
|
|
@@ -31,9 +31,6 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
31
31
|
@resizeType()
|
|
32
32
|
public contextSettings: ICanvasContext2DSettings
|
|
33
33
|
|
|
34
|
-
@hitType('all')
|
|
35
|
-
declare public hitFill: IHitType
|
|
36
|
-
|
|
37
34
|
public canvas: ILeaferCanvas
|
|
38
35
|
|
|
39
36
|
public context: ICanvasContext2D
|
|
@@ -42,7 +39,7 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
42
39
|
super(data)
|
|
43
40
|
this.canvas = Creator.canvas(this.__ as ILeaferCanvasConfig)
|
|
44
41
|
this.context = this.canvas.context
|
|
45
|
-
this.__.__drawAfterFill = true
|
|
42
|
+
this.__.__isCanvas = this.__.__drawAfterFill = true
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
public draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void {
|
|
@@ -67,7 +64,7 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
67
64
|
public __drawAfterFill(canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
68
65
|
const origin = this.canvas.view as ISizeData
|
|
69
66
|
const { width, height } = this
|
|
70
|
-
if (this.__.cornerRadius) {
|
|
67
|
+
if (this.__.cornerRadius || this.pathInputed) {
|
|
71
68
|
canvas.save()
|
|
72
69
|
canvas.clip()
|
|
73
70
|
canvas.drawImage(this.canvas.view as any, 0, 0, origin.width, origin.height, 0, 0, width, height)
|
package/src/Group.ts
CHANGED
|
@@ -84,7 +84,7 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
|
84
84
|
this.add(child, this.children.indexOf(after) + 1)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
public addBefore(child:
|
|
87
|
+
public addBefore(child: IUI, before: IUI): void {
|
|
88
88
|
this.add(child, this.children.indexOf(before))
|
|
89
89
|
}
|
|
90
90
|
|
package/src/Leafer.ts
CHANGED
|
@@ -196,7 +196,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
196
196
|
Object.keys(data).forEach(key => (this as any)[key] = data[key])
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
override forceRender(bounds?: IBoundsData): void {
|
|
200
200
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds)
|
|
201
201
|
if (this.viewReady) this.renderer.update()
|
|
202
202
|
}
|
|
@@ -247,7 +247,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
override __setAttr(attrName: string, newValue: IValue): boolean {
|
|
251
251
|
if (this.canvas) {
|
|
252
252
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
253
253
|
this.__changeCanvasSize(attrName, newValue as number)
|
|
@@ -255,12 +255,15 @@ export class Leafer extends Group implements ILeafer {
|
|
|
255
255
|
this.__changeFill(newValue as string)
|
|
256
256
|
} else if (attrName === 'hittable') {
|
|
257
257
|
if (!this.parent) this.canvas.hittable = newValue as boolean
|
|
258
|
+
} else if (attrName === 'zIndex') {
|
|
259
|
+
this.canvas.zIndex = newValue as any
|
|
260
|
+
setTimeout(() => this.parent && this.parent.__updateSortChildren())
|
|
258
261
|
}
|
|
259
262
|
}
|
|
260
263
|
return super.__setAttr(attrName, newValue)
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
|
|
266
|
+
override __getAttr(attrName: string): IValue {
|
|
264
267
|
if (this.canvas && canvasSizeAttrs.includes(attrName)) return this.canvas[attrName]
|
|
265
268
|
return super.__getAttr(attrName)
|
|
266
269
|
}
|
|
@@ -404,7 +407,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
404
407
|
this.__eventIds.length = 0
|
|
405
408
|
}
|
|
406
409
|
|
|
407
|
-
|
|
410
|
+
override destroy(sync?: boolean): void {
|
|
408
411
|
const doDestory = () => {
|
|
409
412
|
if (!this.destroyed) {
|
|
410
413
|
Leafer.list.remove(this)
|
package/src/UI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData } from '@leafer/interface'
|
|
1
|
+
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction } from '@leafer-ui/interface'
|
|
@@ -326,6 +326,11 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
326
326
|
public disabledStyle: IUIInputData
|
|
327
327
|
|
|
328
328
|
|
|
329
|
+
// 预留给用户使用的数据对象
|
|
330
|
+
@dataType({})
|
|
331
|
+
public data: IObject
|
|
332
|
+
|
|
333
|
+
|
|
329
334
|
public set scale(value: INumber | IPointData) {
|
|
330
335
|
if (typeof value === 'number') {
|
|
331
336
|
this.scaleX = this.scaleY = value
|
|
@@ -411,7 +416,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
411
416
|
public __onUpdateSize(): void {
|
|
412
417
|
if (this.__.__input) {
|
|
413
418
|
const data = this.__;
|
|
414
|
-
(data.lazy && this.
|
|
419
|
+
(data.lazy && !this.__inLazyBounds && !Export.running) ? data.__needComputePaint = true : data.__computePaint()
|
|
415
420
|
}
|
|
416
421
|
}
|
|
417
422
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent,
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D, IUnitData } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
3
|
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IEditorConfig, IFindUIMethod, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
|
|
4
4
|
|
|
@@ -93,6 +93,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
93
93
|
focusStyle: IUIInputData;
|
|
94
94
|
selectedStyle: IUIInputData;
|
|
95
95
|
disabledStyle: IUIInputData;
|
|
96
|
+
data: IObject;
|
|
96
97
|
set scale(value: INumber | IPointData);
|
|
97
98
|
get scale(): INumber | IPointData;
|
|
98
99
|
get pen(): IPathCreator;
|
|
@@ -141,7 +142,7 @@ declare class Group extends UI implements IGroup {
|
|
|
141
142
|
pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
|
|
142
143
|
addAt(child: IUI, index: number): void;
|
|
143
144
|
addAfter(child: IUI, after: IUI): void;
|
|
144
|
-
addBefore(child:
|
|
145
|
+
addBefore(child: IUI, before: IUI): void;
|
|
145
146
|
add(_child: IUI, _index?: number): void;
|
|
146
147
|
addMany(..._children: IUI[]): void;
|
|
147
148
|
remove(_child?: IUI, _destroy?: boolean): void;
|
|
@@ -341,7 +342,6 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
341
342
|
pixelRatio: INumber;
|
|
342
343
|
smooth: boolean;
|
|
343
344
|
contextSettings: ICanvasContext2DSettings;
|
|
344
|
-
hitFill: IHitType;
|
|
345
345
|
canvas: ILeaferCanvas;
|
|
346
346
|
context: ICanvasContext2D;
|
|
347
347
|
constructor(data?: ICanvasInputData);
|