@leafer-ui/display 1.0.4 → 1.0.6
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 +11 -11
- package/src/Box.ts +28 -37
- package/src/Canvas.ts +5 -14
- package/src/Group.ts +13 -24
- package/src/Line.ts +3 -7
- package/src/Path.ts +0 -1
- package/src/Polygon.ts +2 -2
- package/src/Text.ts +5 -4
- package/src/UI.ts +8 -16
- package/types/index.d.ts +16 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,23 +13,23 @@
|
|
|
13
13
|
],
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/leaferjs/ui.git"
|
|
16
|
+
"url": "https://github.com/leaferjs/leafer-ui.git"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/leaferjs/ui/tree/main/packages/display",
|
|
19
|
-
"bugs": "https://github.com/leaferjs/ui/issues",
|
|
18
|
+
"homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display",
|
|
19
|
+
"bugs": "https://github.com/leaferjs/leafer-ui/issues",
|
|
20
20
|
"keywords": [
|
|
21
21
|
"leafer-ui",
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.
|
|
26
|
-
"@leafer-ui/data": "1.0.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.
|
|
29
|
-
"@leafer-ui/external": "1.0.
|
|
25
|
+
"@leafer/core": "1.0.6",
|
|
26
|
+
"@leafer-ui/data": "1.0.6",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.6",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.6",
|
|
29
|
+
"@leafer-ui/external": "1.0.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.
|
|
33
|
-
"@leafer-ui/interface": "1.0.
|
|
32
|
+
"@leafer/interface": "1.0.6",
|
|
33
|
+
"@leafer-ui/interface": "1.0.6"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Box.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { BoxData } from '@leafer-ui/data'
|
|
|
7
7
|
import { Group } from './Group'
|
|
8
8
|
import { Rect } from './Rect'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
|
|
11
|
+
const { copy, add, includes } = BoundsHelper
|
|
12
|
+
const rect = Rect.prototype, group = Group.prototype
|
|
12
13
|
const childrenRenderBounds = {} as IBoundsData
|
|
13
|
-
const { copy, add, includes, copyAndSpread } = BoundsHelper
|
|
14
14
|
|
|
15
15
|
@rewriteAble()
|
|
16
16
|
@registerUI()
|
|
@@ -26,6 +26,9 @@ export class Box extends Group implements IBox {
|
|
|
26
26
|
@dataType(false)
|
|
27
27
|
public resizeChildren?: IBoolean
|
|
28
28
|
|
|
29
|
+
@dataType(false)
|
|
30
|
+
public textBox?: IBoolean
|
|
31
|
+
|
|
29
32
|
@affectRenderBoundsType('show')
|
|
30
33
|
declare public overflow?: IOverflow
|
|
31
34
|
|
|
@@ -42,43 +45,40 @@ export class Box extends Group implements IBox {
|
|
|
42
45
|
@rewrite(rect.__updateRenderSpread)
|
|
43
46
|
public __updateRectRenderSpread(): number { return 0 }
|
|
44
47
|
|
|
45
|
-
public __updateRenderSpread(): number {
|
|
46
|
-
return this.__updateRectRenderSpread() || -1
|
|
47
|
-
}
|
|
48
|
+
public __updateRenderSpread(): number { return this.__updateRectRenderSpread() || -1 }
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
@rewrite(rect.__updateBoxBounds)
|
|
51
52
|
public __updateRectBoxBounds(): void { }
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
// @leafer-in/flow will rewrite
|
|
56
|
+
public __updateBoxBounds(_secondLayout?: boolean): void {
|
|
54
57
|
const data = this.__
|
|
55
58
|
|
|
56
59
|
if (this.children.length) {
|
|
60
|
+
|
|
57
61
|
if (data.__autoSide) {
|
|
58
62
|
|
|
59
|
-
if (this.leafer && this.leafer.ready) this.leafer.layouter.addExtra(this)
|
|
60
63
|
super.__updateBoxBounds()
|
|
61
64
|
|
|
62
65
|
const { boxBounds } = this.__layout
|
|
63
66
|
|
|
64
67
|
if (!data.__autoSize) {
|
|
65
|
-
if (data.__autoWidth)
|
|
66
|
-
|
|
68
|
+
if (data.__autoWidth) {
|
|
69
|
+
boxBounds.width += boxBounds.x, boxBounds.x = 0
|
|
70
|
+
boxBounds.height = data.height, boxBounds.y = 0
|
|
71
|
+
} else {
|
|
72
|
+
boxBounds.height += boxBounds.y, boxBounds.y = 0
|
|
73
|
+
boxBounds.width = data.width, boxBounds.x = 0
|
|
74
|
+
}
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
if (secondLayout && data.flow && data.padding) copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'))
|
|
70
|
-
|
|
71
77
|
this.__updateNaturalSize()
|
|
72
78
|
|
|
73
|
-
} else
|
|
74
|
-
this.__updateRectBoxBounds()
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (data.flow) this.__updateContentBounds()
|
|
79
|
+
} else this.__updateRectBoxBounds()
|
|
78
80
|
|
|
79
|
-
} else
|
|
80
|
-
this.__updateRectBoxBounds()
|
|
81
|
-
}
|
|
81
|
+
} else this.__updateRectBoxBounds()
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
@rewrite(rect.__updateStrokeBounds)
|
|
@@ -93,13 +93,11 @@ export class Box extends Group implements IBox {
|
|
|
93
93
|
copy(childrenRenderBounds, renderBounds)
|
|
94
94
|
this.__updateRectRenderBounds()
|
|
95
95
|
|
|
96
|
-
isOverflow = !includes(renderBounds, childrenRenderBounds)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
96
|
+
isOverflow = !includes(renderBounds, childrenRenderBounds)
|
|
97
|
+
if (isOverflow && this.__.overflow !== 'hide') add(renderBounds, childrenRenderBounds)
|
|
98
|
+
} else this.__updateRectRenderBounds()
|
|
100
99
|
|
|
101
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow)
|
|
102
|
-
if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow) add(renderBounds, childrenRenderBounds)
|
|
100
|
+
!this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow) // 节省赋值
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
@rewrite(rect.__updateRenderBounds)
|
|
@@ -130,18 +128,11 @@ export class Box extends Group implements IBox {
|
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
canvas.save()
|
|
137
|
-
canvas.clip()
|
|
138
|
-
if (length) this.__renderGroup(canvas, options)
|
|
139
|
-
canvas.restore()
|
|
140
|
-
} else {
|
|
141
|
-
if (length) this.__renderGroup(canvas, options)
|
|
142
|
-
}
|
|
131
|
+
// in __drawAfterFill()
|
|
132
|
+
public __drawContent(canvas: ILeaferCanvas, options: IRenderOptions): void {
|
|
133
|
+
this.__renderGroup(canvas, options)
|
|
143
134
|
|
|
144
|
-
if (this.__.
|
|
135
|
+
if (this.__.__hasStroke) { // 还原绘制路径
|
|
145
136
|
canvas.setWorld(this.__nowWorld)
|
|
146
137
|
this.__drawRenderPath(canvas)
|
|
147
138
|
}
|
package/src/Canvas.ts
CHANGED
|
@@ -43,7 +43,6 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
43
43
|
super(data)
|
|
44
44
|
this.canvas = Creator.canvas(this.__ as ILeaferCanvasConfig)
|
|
45
45
|
this.context = this.canvas.context
|
|
46
|
-
this.__.__isCanvas = this.__.__drawAfterFill = true
|
|
47
46
|
if (data && data.url) this.drawImage(data.url)
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -57,9 +56,7 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
public draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void {
|
|
60
|
-
ui.
|
|
61
|
-
|
|
62
|
-
const matrix = new Matrix(ui.__world).invert()
|
|
59
|
+
const matrix = new Matrix(ui.worldTransform).invert()
|
|
63
60
|
|
|
64
61
|
const m = new Matrix()
|
|
65
62
|
if (offset) m.translate(offset.x, offset.y)
|
|
@@ -75,16 +72,10 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
75
72
|
this.forceRender()
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
canvas.clip()
|
|
83
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height)
|
|
84
|
-
canvas.restore()
|
|
85
|
-
} else {
|
|
86
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height)
|
|
87
|
-
}
|
|
75
|
+
// in __drawAfterFill()
|
|
76
|
+
public __drawContent(canvas: ILeaferCanvas, _options: IRenderOptions): void {
|
|
77
|
+
const { width, height } = this.__, { view } = this.canvas
|
|
78
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height)
|
|
88
79
|
}
|
|
89
80
|
|
|
90
81
|
public __updateSize(): void {
|
package/src/Group.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IJSONOptions, IPickOptions, IPickResult, IPointData } from '@leafer/interface'
|
|
2
|
-
import { Branch, useModule, dataProcessor, registerUI
|
|
2
|
+
import { Branch, useModule, dataProcessor, registerUI } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData, IUIJSONData } from '@leafer-ui/interface'
|
|
4
|
+
import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData, IUIJSONData, IFindCondition, IFindUIMethod } from '@leafer-ui/interface'
|
|
5
5
|
import { GroupData } from '@leafer-ui/data'
|
|
6
6
|
|
|
7
7
|
import { UI } from './UI'
|
|
@@ -39,27 +39,16 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
|
39
39
|
public set(data: IUIInputData, isTemp?: boolean): void {
|
|
40
40
|
if (data.children) {
|
|
41
41
|
const { children } = data
|
|
42
|
-
delete data.children
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} else {
|
|
47
|
-
this.clear()
|
|
48
|
-
}
|
|
43
|
+
delete data.children
|
|
44
|
+
this.children ? this.clear() : this.__setBranch()
|
|
49
45
|
|
|
50
46
|
super.set(data, isTemp)
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
children.forEach(childData => {
|
|
54
|
-
child = (childData as IUI).__ ? childData as IUI : UICreator.get(childData.tag, childData) as IUI
|
|
55
|
-
this.add(child)
|
|
56
|
-
})
|
|
57
|
-
|
|
48
|
+
children.forEach(child => this.add(child))
|
|
58
49
|
data.children = children
|
|
59
50
|
|
|
60
|
-
} else
|
|
61
|
-
super.set(data, isTemp)
|
|
62
|
-
}
|
|
51
|
+
} else super.set(data, isTemp)
|
|
63
52
|
}
|
|
64
53
|
|
|
65
54
|
public toJSON(options?: IJSONOptions): IUIJSONData {
|
|
@@ -76,28 +65,28 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
|
76
65
|
|
|
77
66
|
// add
|
|
78
67
|
|
|
79
|
-
public addAt(child: IUI, index: number): void {
|
|
68
|
+
public addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void {
|
|
80
69
|
this.add(child, index)
|
|
81
70
|
}
|
|
82
71
|
|
|
83
|
-
public addAfter(child: IUI, after: IUI): void {
|
|
72
|
+
public addAfter(child: IUI | IUI[] | IUIInputData | IUIInputData[], after: IUI): void {
|
|
84
73
|
this.add(child, this.children.indexOf(after) + 1)
|
|
85
74
|
}
|
|
86
75
|
|
|
87
|
-
public addBefore(child: IUI, before: IUI): void {
|
|
76
|
+
public addBefore(child: IUI | IUI[] | IUIInputData | IUIInputData[], before: IUI): void {
|
|
88
77
|
this.add(child, this.children.indexOf(before))
|
|
89
78
|
}
|
|
90
79
|
|
|
91
80
|
// Branch rewrite
|
|
92
81
|
|
|
93
|
-
public add(_child: IUI, _index?: number): void { }
|
|
82
|
+
public add(_child: IUI | IUI[] | IUIInputData | IUIInputData[], _index?: number): void { }
|
|
94
83
|
|
|
95
|
-
public addMany(..._children: IUI[]): void { }
|
|
84
|
+
public addMany(..._children: IUI[] | IUIInputData[]): void { }
|
|
96
85
|
|
|
97
|
-
public remove(_child?: IUI, _destroy?: boolean): void { }
|
|
86
|
+
public remove(_child?: IUI | number | string | IFindCondition | IFindUIMethod, _destroy?: boolean): void { }
|
|
98
87
|
|
|
99
88
|
public removeAll(_destroy?: boolean): void { }
|
|
100
89
|
|
|
101
90
|
public clear(): void { }
|
|
102
91
|
|
|
103
|
-
}
|
|
92
|
+
}
|
package/src/Line.ts
CHANGED
|
@@ -28,7 +28,7 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
|
28
28
|
declare public height?: INumber
|
|
29
29
|
|
|
30
30
|
@pathType()
|
|
31
|
-
public points?: number[]
|
|
31
|
+
public points?: number[] | IPointData[]
|
|
32
32
|
|
|
33
33
|
@pathType(0)
|
|
34
34
|
public curve?: boolean | number
|
|
@@ -79,17 +79,13 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
|
79
79
|
if (!this.pathInputed && data.points && data.curve) {
|
|
80
80
|
drawPoints(data.__pathForRender = [], data.points, data.curve, data.closed)
|
|
81
81
|
if (data.__useArrow) PathArrow.addArrows(this, false)
|
|
82
|
-
} else
|
|
83
|
-
super.__updateRenderPath()
|
|
84
|
-
}
|
|
82
|
+
} else super.__updateRenderPath()
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
public __updateBoxBounds(): void {
|
|
88
86
|
if (this.points) {
|
|
89
87
|
toBounds(this.__.__pathForRender, this.__layout.boxBounds)
|
|
90
|
-
} else
|
|
91
|
-
super.__updateBoxBounds()
|
|
92
|
-
}
|
|
88
|
+
} else super.__updateBoxBounds()
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
}
|
package/src/Path.ts
CHANGED
package/src/Polygon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INumber } from '@leafer/interface'
|
|
1
|
+
import { INumber, IPointData } from '@leafer/interface'
|
|
2
2
|
import { PathCommandDataHelper, dataProcessor, pathType, registerUI, rewrite, rewriteAble } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IPolygon, IPolygonData, IPolygonInputData } from '@leafer-ui/interface'
|
|
@@ -25,7 +25,7 @@ export class Polygon extends UI implements IPolygon {
|
|
|
25
25
|
public sides?: INumber
|
|
26
26
|
|
|
27
27
|
@pathType()
|
|
28
|
-
public points?: number[]
|
|
28
|
+
public points?: number[] | IPointData[]
|
|
29
29
|
|
|
30
30
|
@pathType(0)
|
|
31
31
|
public curve?: boolean | number
|
package/src/Text.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IStrin
|
|
|
2
2
|
import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, dataType, hitType, MathHelper } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IStrokeAlign, IHitType, ITextWrap } from '@leafer-ui/interface'
|
|
5
|
-
import { TextData
|
|
5
|
+
import { TextData } from '@leafer-ui/data'
|
|
6
6
|
|
|
7
|
-
import { TextConvert } from '@leafer-ui/external'
|
|
7
|
+
import { TextConvert, UnitConvert } from '@leafer-ui/external'
|
|
8
8
|
|
|
9
9
|
import { UI } from './UI'
|
|
10
10
|
|
|
@@ -77,14 +77,15 @@ export class Text extends UI implements IText {
|
|
|
77
77
|
@boundsType('top')
|
|
78
78
|
public verticalAlign?: IVerticalAlign
|
|
79
79
|
|
|
80
|
+
@boundsType(true)
|
|
81
|
+
public autoSizeAlign?: IBoolean
|
|
82
|
+
|
|
80
83
|
@boundsType('normal')
|
|
81
84
|
public textWrap?: ITextWrap
|
|
82
85
|
|
|
83
86
|
@boundsType('show')
|
|
84
87
|
public textOverflow?: IOverflow | string
|
|
85
88
|
|
|
86
|
-
public get editInner(): string { return 'TextEditor' }
|
|
87
|
-
|
|
88
89
|
public get textDrawData(): ITextDrawData {
|
|
89
90
|
this.__layout.update()
|
|
90
91
|
return this.__.__textDrawData
|
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, IObject, IScaleData, IUnitData } 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, IScaleData, IUnitData, IPathCommandObject } 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, MathHelper, needPlugin } 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, IKeyframe, IAnimation, IAnimate, IStates, IStateName, ITransition, IAnimateType } from '@leafer-ui/interface'
|
|
@@ -138,7 +138,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
138
138
|
|
|
139
139
|
// path
|
|
140
140
|
@pathInputType()
|
|
141
|
-
public path?: IPathCommandData | IPathString
|
|
141
|
+
public path?: IPathCommandData | IPathCommandObject[] | IPathString
|
|
142
142
|
|
|
143
143
|
@pathType()
|
|
144
144
|
public windingRule?: IWindingRule
|
|
@@ -352,13 +352,13 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
|
|
355
|
-
//
|
|
355
|
+
// @leafer-in/editor rewrite
|
|
356
356
|
|
|
357
357
|
public get editConfig(): IEditorConfig { return undefined }
|
|
358
358
|
|
|
359
|
-
public get editOuter(): string { return
|
|
359
|
+
public get editOuter(): string { return '' }
|
|
360
360
|
|
|
361
|
-
public get editInner(): string { return '
|
|
361
|
+
public get editInner(): string { return '' }
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
constructor(data?: IUIInputData) {
|
|
@@ -377,9 +377,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
377
377
|
this.lockNormalStyle = true
|
|
378
378
|
Object.assign(this, data)
|
|
379
379
|
this.lockNormalStyle = false
|
|
380
|
-
} else
|
|
381
|
-
Object.assign(this, data)
|
|
382
|
-
}
|
|
380
|
+
} else Object.assign(this, data)
|
|
383
381
|
}
|
|
384
382
|
|
|
385
383
|
public get(name?: string | string[] | IUIInputData): IUIInputData | IValue {
|
|
@@ -444,11 +442,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
444
442
|
}
|
|
445
443
|
|
|
446
444
|
public __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void {
|
|
447
|
-
|
|
448
|
-
PathDrawer.drawPathByData(drawer, data)
|
|
449
|
-
} else {
|
|
450
|
-
this.__drawPathByBox(drawer)
|
|
451
|
-
}
|
|
445
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer)
|
|
452
446
|
}
|
|
453
447
|
|
|
454
448
|
public __drawPathByBox(drawer: IPathDrawer): void {
|
|
@@ -456,9 +450,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
456
450
|
if (this.__.cornerRadius) {
|
|
457
451
|
const { cornerRadius } = this.__
|
|
458
452
|
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius) // 修复微信浏览器bug, 后续需进一步优化
|
|
459
|
-
} else
|
|
460
|
-
drawer.rect(x, y, width, height)
|
|
461
|
-
}
|
|
453
|
+
} else drawer.rect(x, y, width, height)
|
|
462
454
|
}
|
|
463
455
|
|
|
464
456
|
// @leafer-in/animate rewrite
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
|
-
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, ITransition, IStates, IStateName, IAnimate, IEditorConfig, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, 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';
|
|
3
|
+
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, ITransition, IStates, IStateName, IAnimate, IEditorConfig, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, IFindCondition as IFindCondition$1, 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
|
|
|
5
5
|
declare class UI extends Leaf implements IUI {
|
|
6
6
|
__: IUIData;
|
|
@@ -39,7 +39,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
39
39
|
around?: IAlign | IUnitPointData;
|
|
40
40
|
lazy?: IBoolean;
|
|
41
41
|
pixelRatio?: INumber;
|
|
42
|
-
path?: IPathCommandData | IPathString;
|
|
42
|
+
path?: IPathCommandData | IPathCommandObject[] | IPathString;
|
|
43
43
|
windingRule?: IWindingRule;
|
|
44
44
|
closed?: boolean;
|
|
45
45
|
flow?: IFlowType;
|
|
@@ -153,12 +153,12 @@ declare class Group extends UI implements IGroup {
|
|
|
153
153
|
set(data: IUIInputData, isTemp?: boolean): void;
|
|
154
154
|
toJSON(options?: IJSONOptions): IUIJSONData;
|
|
155
155
|
pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
|
|
156
|
-
addAt(child: IUI, index: number): void;
|
|
157
|
-
addAfter(child: IUI, after: IUI): void;
|
|
158
|
-
addBefore(child: IUI, before: IUI): void;
|
|
159
|
-
add(_child: IUI, _index?: number): void;
|
|
160
|
-
addMany(..._children: IUI[]): void;
|
|
161
|
-
remove(_child?: IUI, _destroy?: boolean): void;
|
|
156
|
+
addAt(child: IUI | IUI[] | IUIInputData | IUIInputData[], index: number): void;
|
|
157
|
+
addAfter(child: IUI | IUI[] | IUIInputData | IUIInputData[], after: IUI): void;
|
|
158
|
+
addBefore(child: IUI | IUI[] | IUIInputData | IUIInputData[], before: IUI): void;
|
|
159
|
+
add(_child: IUI | IUI[] | IUIInputData | IUIInputData[], _index?: number): void;
|
|
160
|
+
addMany(..._children: IUI[] | IUIInputData[]): void;
|
|
161
|
+
remove(_child?: IUI | number | string | IFindCondition$1 | IFindUIMethod, _destroy?: boolean): void;
|
|
162
162
|
removeAll(_destroy?: boolean): void;
|
|
163
163
|
clear(): void;
|
|
164
164
|
}
|
|
@@ -259,6 +259,7 @@ declare class Box extends Group implements IBox {
|
|
|
259
259
|
get isBranchLeaf(): boolean;
|
|
260
260
|
__: IBoxData;
|
|
261
261
|
resizeChildren?: IBoolean;
|
|
262
|
+
textBox?: IBoolean;
|
|
262
263
|
overflow?: IOverflow;
|
|
263
264
|
isOverflow: boolean;
|
|
264
265
|
constructor(data?: IBoxInputData);
|
|
@@ -266,7 +267,7 @@ declare class Box extends Group implements IBox {
|
|
|
266
267
|
__updateRectRenderSpread(): number;
|
|
267
268
|
__updateRenderSpread(): number;
|
|
268
269
|
__updateRectBoxBounds(): void;
|
|
269
|
-
__updateBoxBounds(
|
|
270
|
+
__updateBoxBounds(_secondLayout?: boolean): void;
|
|
270
271
|
__updateStrokeBounds(): void;
|
|
271
272
|
__updateRenderBounds(): void;
|
|
272
273
|
__updateRectRenderBounds(): void;
|
|
@@ -275,7 +276,7 @@ declare class Box extends Group implements IBox {
|
|
|
275
276
|
__renderRect(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
276
277
|
__renderGroup(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
277
278
|
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
278
|
-
|
|
279
|
+
__drawContent(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
declare class Frame extends Box implements IFrame {
|
|
@@ -307,7 +308,7 @@ declare class Polygon extends UI implements IPolygon {
|
|
|
307
308
|
get __tag(): string;
|
|
308
309
|
__: IPolygonData;
|
|
309
310
|
sides?: INumber;
|
|
310
|
-
points?: number[];
|
|
311
|
+
points?: number[] | IPointData[];
|
|
311
312
|
curve?: boolean | number;
|
|
312
313
|
constructor(data?: IPolygonInputData);
|
|
313
314
|
__updatePath(): void;
|
|
@@ -329,7 +330,7 @@ declare class Line extends UI implements ILine {
|
|
|
329
330
|
__: ILineData;
|
|
330
331
|
strokeAlign?: IStrokeAlign;
|
|
331
332
|
height?: INumber;
|
|
332
|
-
points?: number[];
|
|
333
|
+
points?: number[] | IPointData[];
|
|
333
334
|
curve?: boolean | number;
|
|
334
335
|
closed?: boolean;
|
|
335
336
|
get toPoint(): IPointData;
|
|
@@ -367,7 +368,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
367
368
|
drawImage(url: string): void;
|
|
368
369
|
draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
|
|
369
370
|
paint(): void;
|
|
370
|
-
|
|
371
|
+
__drawContent(canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
371
372
|
__updateSize(): void;
|
|
372
373
|
destroy(): void;
|
|
373
374
|
}
|
|
@@ -394,9 +395,9 @@ declare class Text extends UI implements IText {
|
|
|
394
395
|
paraSpacing?: INumber;
|
|
395
396
|
textAlign?: ITextAlign;
|
|
396
397
|
verticalAlign?: IVerticalAlign;
|
|
398
|
+
autoSizeAlign?: IBoolean;
|
|
397
399
|
textWrap?: ITextWrap;
|
|
398
400
|
textOverflow?: IOverflow | string;
|
|
399
|
-
get editInner(): string;
|
|
400
401
|
get textDrawData(): ITextDrawData;
|
|
401
402
|
constructor(data?: ITextInputData);
|
|
402
403
|
__drawHitPath(canvas: ILeaferCanvas): void;
|